예제 #1
0
파일: input.go 프로젝트: jasonrpowers/glfw3
//SetCharacterCallback sets the character callback which is called when a
//Unicode character is input.
//
//The character callback is intended for text input. If you want to know whether
//a specific key was pressed or released, use the key callback instead.
func (w *Window) SetCharacterCallback(cbfun func(w *Window, char uint)) {
	if cbfun == nil {
		C.glfwSetCharCallback(w.data, nil)
	} else {
		w.fCharHolder = cbfun
		C.glfwSetCharCallbackCB(w.data)
	}
}
예제 #2
0
파일: input.go 프로젝트: godispy/glfw
// SetCharCallback sets the character callback which is called when a
// Unicode character is input.
//
// The character callback is intended for Unicode text input. As it deals with
// characters, it is keyboard layout dependent, whereas the
// key callback is not. Characters do not map 1:1
// to physical keys, as a key may produce zero, one or more characters. If you
// want to know whether a specific physical key was pressed or released, see
// the key callback instead.
//
// The character callback behaves as system text input normally does and will
// not be called if modifier keys are held down that would prevent normal text
// input on that platform, for example a Super (Command) key on OS X or Alt key
// on Windows. There is a character with modifiers callback that receives these events.
func (w *Window) SetCharCallback(cbfun CharCallback) (previous CharCallback) {
	previous = w.fCharHolder
	w.fCharHolder = cbfun
	if cbfun == nil {
		C.glfwSetCharCallback(w.data, nil)
	} else {
		C.glfwSetCharCallbackCB(w.data)
	}
	panicError()
	return previous
}