make handleWindowEvent function
This commit is contained in:
parent
85c55e5a21
commit
01e888ad25
14
main.go
14
main.go
|
@ -37,17 +37,21 @@ func render(window *sdl.Window, handle C.projectm_handle) (bool, error) {
|
|||
return true, nil
|
||||
}
|
||||
|
||||
func handleWindowEvent(event *sdl.WindowEvent, handle C.projectm_handle) {
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
||||
func handleEvent(event sdl.Event, handle C.projectm_handle) bool {
|
||||
switch event.(type) {
|
||||
case *sdl.QuitEvent:
|
||||
return false
|
||||
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))
|
||||
}
|
||||
handleWindowEvent(event, handle)
|
||||
}
|
||||
|
||||
return true
|
||||
|
|
Loading…
Reference in New Issue