Exemple #1
0
//SetCursorPositionCallback sets the cursor position callback which is called
//when the cursor is moved. The callback is provided with the position relative
//to the upper-left corner of the client area of the window.
func (w *Window) SetCursorPositionCallback(cbfun func(w *Window, xpos float64, ypos float64)) {
	if cbfun == nil {
		C.glfwSetCursorPosCallback(w.data, nil)
	} else {
		w.fCursorPosHolder = cbfun
		C.glfwSetCursorPosCallbackCB(w.data)
	}
}
Exemple #2
0
// SetCursorPosCallback sets the cursor position callback which is called
// when the cursor is moved. The callback is provided with the position relative
// to the upper-left corner of the client area of the window.
func (w *Window) SetCursorPosCallback(cbfun CursorPosCallback) (previous CursorPosCallback) {
	previous = w.fCursorPosHolder
	w.fCursorPosHolder = cbfun
	if cbfun == nil {
		C.glfwSetCursorPosCallback(w.data, nil)
	} else {
		C.glfwSetCursorPosCallbackCB(w.data)
	}
	panicError()
	return previous
}