Added methods to query the current mouse position.

This commit is contained in:
Sander Schobers 2020-02-20 18:07:05 +01:00
parent a38d4fce4d
commit 6468ff1b33

View File

@ -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)
}