diff --git a/glfwcanvas/glfwcanvas.go b/glfwcanvas/glfwcanvas.go index b2c0c8a..556d863 100644 --- a/glfwcanvas/glfwcanvas.go +++ b/glfwcanvas/glfwcanvas.go @@ -170,3 +170,8 @@ func (wnd *Window) MainLoop(run func()) { wnd.FinishFrame() } } + +// Size returns the current width and height of the window +func (wnd *Window) Size() (int, int) { + return wnd.Window.GetSize() +} diff --git a/sdlcanvas/sdlcanvas.go b/sdlcanvas/sdlcanvas.go index 3809029..c7f044d 100644 --- a/sdlcanvas/sdlcanvas.go +++ b/sdlcanvas/sdlcanvas.go @@ -250,3 +250,9 @@ func (wnd *Window) MainLoop(run func()) { wnd.FinishFrame() } } + +// Size returns the current width and height of the window +func (wnd *Window) Size() (int, int) { + w, h := wnd.Window.GetSize() + return int(w), int(h) +}