Added methods to query the current mouse position.
This commit is contained in:
parent
a38d4fce4d
commit
6468ff1b33
12
mouse.go
12
mouse.go
@ -52,3 +52,15 @@ func IsAnyMouseButtonDown(buttons ...MouseButton) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func MousePosition() (int, int) {
|
||||
var state C.ALLEGRO_MOUSE_STATE
|
||||
C.al_get_mouse_state(&state)
|
||||
return int(state.x), int(state.y)
|
||||
}
|
||||
|
||||
func MousePositionScreen() (int, int, bool) {
|
||||
var x, y C.int
|
||||
var result = C.al_get_mouse_cursor_position(&x, &y)
|
||||
return int(x), int(y), bool(result)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user