示例#1
0
文件: window.go 项目: velovix/paunch
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)
	}
}
示例#2
0
文件: window.go 项目: velovix/paunch
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)
	}
}
示例#3
0
文件: window.go 项目: velovix/paunch
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)
	}
}