make window resizable
This commit is contained in:
parent
b1ac211369
commit
1d81506ef6
9
main.go
9
main.go
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue