Exemple #1
0
func mousePositionCallback(window *glfw.Window, x, y float64) {

	var windHeight int
	if paunchWindow.nativeMousePos {
		x *= float64(paunchWindow.nativeWidth) / float64(paunchWindow.width)
		y *= float64(paunchWindow.nativeHeight) / float64(paunchWindow.height)
		windHeight = paunchWindow.nativeHeight
	} else {
		_, windHeight = window.GetSize()
	}

	for _, eventManager := range paunchWindow.eventManagers {
		eventManager.RunMousePositionEvent(x, float64(windHeight)-y)
	}
}
Exemple #2
0
func mouseEnterWindowCallback(window *glfw.Window, entered bool) {

	x, y := window.GetCursorPosition()

	var windHeight int
	if paunchWindow.nativeMousePos {
		x *= float64(paunchWindow.nativeWidth) / float64(paunchWindow.width)
		y *= float64(paunchWindow.nativeHeight) / float64(paunchWindow.height)
		windHeight = paunchWindow.nativeHeight
	} else {
		_, windHeight = window.GetSize()
	}

	for _, eventManager := range paunchWindow.eventManagers {
		eventManager.RunMouseEnterWindowEvent(x, float64(windHeight)-y, entered)
	}
}
Exemple #3
0
func mouseButtonCallback(window *glfw.Window, button glfw.MouseButton, action glfw.Action, mod glfw.ModifierKey) {

	x, y := window.GetCursorPosition()

	var windHeight int
	if paunchWindow.nativeMousePos {
		x *= float64(paunchWindow.nativeWidth) / float64(paunchWindow.width)
		y *= float64(paunchWindow.nativeHeight) / float64(paunchWindow.height)
		windHeight = paunchWindow.nativeHeight
	} else {
		_, windHeight = window.GetSize()
	}

	for _, eventManager := range paunchWindow.eventManagers {
		eventManager.RunMouseButtonEvent(MouseButton(button), Action(action), x, float64(windHeight)-y)
	}
}