make window resizable

This commit is contained in:
filifa 2024-08-24 18:33:07 -05:00
parent b1ac211369
commit 1d81506ef6
1 changed files with 8 additions and 1 deletions

View File

@ -27,7 +27,7 @@ func main() {
}
defer sdl.Quit()
window, err := sdl.CreateWindow("milkbucket", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED, int32(windowWidth), int32(windowHeight), sdl.WINDOW_OPENGL)
window, err := sdl.CreateWindow("milkbucket", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED, int32(windowWidth), int32(windowHeight), sdl.WINDOW_OPENGL|sdl.WINDOW_RESIZABLE)
if err != nil {
panic(err)
}
@ -60,6 +60,13 @@ func main() {
case *sdl.QuitEvent:
running = false
break
case *sdl.WindowEvent:
event := event.(*sdl.WindowEvent)
switch event.Event {
case sdl.WINDOWEVENT_RESIZED:
w, h := event.Data1, event.Data2
C.projectm_set_window_size(handle, C.ulong(w), C.ulong(h))
}
}
}