예제 #1
0
파일: input.go 프로젝트: jasonrpowers/glfw3
//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)
	}
}
예제 #2
0
파일: input.go 프로젝트: godispy/glfw
// 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
}