Пример #1
0
// GetKey returns the last reported state of a keyboard key. The returned state
// is one of Press or Release. The higher-level state Repeat is only reported to
// the key callback.
//
// If the StickyKeys input mode is enabled, this function returns Press the first
// time you call this function after a key has been pressed, even if the key has
// already been released.
//
// The key functions deal with physical keys, with key tokens named after their
// use on the standard US keyboard layout. If you want to input text, use the
// Unicode character callback instead.
func (w *Window) GetKey(key Key) Action {
	ret := Action(C.glfwGetKey(w.data, C.int(key)))
	panicError()
	return ret
}
Пример #2
0
// Key returns glfw.Pressed if the given key is held down, or glfw.Released
// otherwise.
//
// Note: Not all key codes are supported on all systems. Also, while some keys
// are available on some keyboard layouts, they may not be available on other
// keyboard layouts.
//
// Note: For systems that do not distinguish between left and right versions of
// modifier keys (shift, alt and control), the left version is used (e.g. glfw.KeyLshift).
func Key(key int) int { return int(C.glfwGetKey(C.int(key))) }
Пример #3
0
// KeyDown returns true if the corresponding key is currently (since the last
// polling of events) pressed down. Otherwise it returns false.
func (w *Window) KeyDown(k Key) bool {
	state := C.glfwGetKey(w.glfwWin, C.int(k))
	return (state == C.GLFW_PRESS)
}
Пример #4
0
Файл: glfw.go Проект: maun/glfw
func Key(window Window, key int) int {
	return int(C.glfwGetKey(C.GLFWwindow(window), C.int(key)))
}
Пример #5
0
//GetKey returns the last reported state of a keyboard key. The returned state
//is one of Press or Release. The higher-level state Repeat is only reported to
//the key callback.
//
//If the StickyKeys input mode is enabled, this function returns Press the first
//time you call this function after a key has been pressed, even if the key has
//already been released.
//
//The key functions deal with physical keys, with key tokens named after their
//use on the standard US keyboard layout. If you want to input text, use the
//Unicode character callback instead.
func (w *Window) GetKey(key Key) Action {
	return Action(C.glfwGetKey(w.data, C.int(key)))
}
Пример #6
0
func GetKey(param int) int {
	return int(C.glfwGetKey(C.int(param)))
}