func onKey(window *glfw.Window, k glfw.Key, s int, action glfw.Action, mods glfw.ModifierKey) { if action != glfw.Press { return } switch glfw.Key(k) { case glfw.KeyEscape: window.SetShouldClose(true) default: return } }
func onKey(window *glfw.Window, k glfw.Key, s int, action glfw.Action, mods glfw.ModifierKey) { if action != glfw.Press { return } // disable if event handlers are flagged off if birdCollided && (k != glfw.KeyEscape) { return } switch glfw.Key(k) { case glfw.KeyEscape: window.SetShouldClose(true) case glfw.KeySpace: jump() default: return } }
func (e *EventHandler) GetKey(code KeyCode) Action { return Action(e.window.GetKey(glfw.Key(code))) }