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

	C.al_get_keyboard_state(&state)

	return (*KeyboardState)(&state)
}
예제 #2
0
파일: keyboard.go 프로젝트: beoran/algo
// 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)))
}
예제 #3
0
func GetKeyboardState() *KeyboardState {
	ks := new(C.ALLEGRO_KEYBOARD_STATE)
	C.al_get_keyboard_state(ks)
	return (*KeyboardState)(unsafe.Pointer(ks))
}