package allg5 // #include import "C" type MouseButton uint const ( MouseButtonLeft MouseButton = 1 MouseButtonRight = 2 MouseButtonMiddle = 3 ) type MouseCursor uint const ( MouseCursorNone MouseCursor = 0 MouseCursorDefault = 1 MouseCursorArrow = 2 MouseCursorBusy = 3 MouseCursorQuestion = 4 MouseCursorEdit = 5 MouseCursorMove = 6 MouseCursorResizeN = 7 MouseCursorResizeW = 8 MouseCursorResizeS = 9 MouseCursorResizeE = 10 MouseCursorResizeNW = 11 MouseCursorResizeSW = 12 MouseCursorResizeSE = 13 MouseCursorResizeNE = 14 MouseCursorProgress = 15 MouseCursorPrecision = 16 MouseCursorLink = 17 MouseCursorAltSelect = 18 MouseCursorUnavailable = 19 ) func IsMouseButtonDown(b MouseButton) bool { var state C.ALLEGRO_MOUSE_STATE C.al_get_mouse_state(&state) return bool(C.al_mouse_button_down(&state, C.int(b))) } func IsAnyMouseButtonDown(buttons ...MouseButton) bool { var state C.ALLEGRO_MOUSE_STATE C.al_get_mouse_state(&state) for _, b := range buttons { if bool(C.al_mouse_button_down(&state, C.int(b))) { return true } } 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) }