Exemple #1
0
func (w *Window) MousePosition() (float64, float64) {
	var x, y C.double
	C.glfwGetCursorPos(w.w, &x, &y)
	return float64(x), float64(y)
}
Exemple #2
0
// GetCursorPos returns the last reported position of the cursor.
//
// If the cursor is disabled (with CursorDisabled) then the cursor position is
// unbounded and limited only by the minimum and maximum values of a double.
//
// The coordinate can be converted to their integer equivalents with the floor
// function. Casting directly to an integer type works for positive coordinates,
// but fails for negative ones.
func (w *Window) GetCursorPos() (x, y float64) {
	var xpos, ypos C.double
	C.glfwGetCursorPos(w.data, &xpos, &ypos)
	panicError()
	return float64(xpos), float64(ypos)
}
Exemple #3
0
func CursorPos(window Window) (x, y int) {
	var cx, cy C.int
	C.glfwGetCursorPos(C.GLFWwindow(window), &cx, &cy)
	return int(cx), int(cy)
}