示例#1
0
func (hb *HitboxImpl) MouseMove(position mgl32.Vec2) {
	if util.PointLiesInsideAABB(mgl32.Vec2{}, hb.size, position) {
		if !hb.hoverState {
			hb.hoverState = true
			hb.eventHandler.onHover()
		}
		hb.eventHandler.onMouseMove(position)
	} else if hb.hoverState {
		hb.hoverState = false
		hb.eventHandler.onUnHover()
	}
}
示例#2
0
func (hb *HitboxImpl) MouseClick(button int, release bool, position mgl32.Vec2) {
	if util.PointLiesInsideAABB(mgl32.Vec2{}, hb.size, position) {
		hb.eventHandler.onClick(button, release, position)
	}
}