func HandleKeyboardEvent(_event *sdl.KeyboardEvent) { switch _event.Evtype { case sdl.SDL_KEYDOWN: if g_game.keydownFun != nil { g_game.keydownFun(int(_event.Keysym().Scancode)) } if g_game.guiManager != nil { g_game.guiManager.KeyDown(int(_event.Keysym().Scancode)) } case sdl.SDL_KEYUP: if g_game.keyupFun != nil { g_game.keyupFun(int(_event.Keysym().Scancode)) } if g_game.guiManager != nil { g_game.guiManager.KeyUp(int(_event.Keysym().Scancode)) } case sdl.SDL_TEXTINPUT: keysym := uint8(_event.State) if keysym != 0 && keysym > 31 { if g_game.textinputFun != nil { g_game.textinputFun(keysym) } } if g_game.guiManager != nil { g_game.guiManager.TextInput(keysym) } } }
func HandleKeyboardEvent(_event *sdl.KeyboardEvent) { switch _event.Evtype { case sdl.SDL_KEYDOWN: g_gui.KeyDown(0, int(_event.Keysym().Sym)) g_game.KeyDown(0, int(_event.Keysym().Scancode)) case sdl.SDL_TEXTINPUT: g_gui.KeyDown(int(_event.State), int(_event.Keysym().Scancode)) g_game.KeyDown(int(_event.State), int(_event.Keysym().Scancode)) } }