Example #1
0
func GetKeyboardState() *KeyboardState {
	var state C.ALLEGRO_KEYBOARD_STATE

	C.al_get_keyboard_state(&state)

	return (*KeyboardState)(&state)
}
Example #2
0
// Gets the state of a given keyboard key by keycode. True is down, false is up.
func KeyDown(keycode int) bool {
	state := &C.ALLEGRO_KEYBOARD_STATE{}
	C.al_get_keyboard_state(state)
	return bool(C.al_key_down(state, C.int(keycode)))
}
Example #3
0
func GetKeyboardState() *KeyboardState {
	ks := new(C.ALLEGRO_KEYBOARD_STATE)
	C.al_get_keyboard_state(ks)
	return (*KeyboardState)(unsafe.Pointer(ks))
}