コード例 #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)
	}
}