-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmouse.h
More file actions
55 lines (40 loc) · 1.08 KB
/
mouse.h
File metadata and controls
55 lines (40 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* mouse.h - PS/2 Mouse Driver for GegOS
*/
#ifndef MOUSE_H
#define MOUSE_H
#include <stdint.h>
/* Mouse button flags */
#define MOUSE_LEFT (1 << 0)
#define MOUSE_RIGHT (1 << 1)
#define MOUSE_MIDDLE (1 << 2)
/* Mouse state structure */
typedef struct {
int x;
int y;
int dx;
int dy;
uint8_t buttons;
uint8_t prev_buttons;
} mouse_state_t;
/* Initialize mouse */
void mouse_init(void);
/* Update mouse state (call in main loop) */
void mouse_update(void);
/* Get current mouse state */
mouse_state_t* mouse_get_state(void);
/* Get mouse X position */
int mouse_get_x(void);
/* Get mouse Y position */
int mouse_get_y(void);
/* Check if button is currently pressed */
int mouse_button_down(uint8_t button);
/* Check if button was just clicked (pressed this frame) */
int mouse_button_clicked(uint8_t button);
/* Check if button was just released */
int mouse_button_released(uint8_t button);
/* Set mouse position */
void mouse_set_position(int x, int y);
/* Set mouse bounds */
void mouse_set_bounds(int min_x, int min_y, int max_x, int max_y);
#endif /* MOUSE_H */