aboutsummaryrefslogtreecommitdiff
path: root/src/mouse/inc/mouse.h
blob: 44c4f5cb420c0ba9cc6157342f00d4df4cb18fc5 (plain) (blame)
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
#ifndef MOUSE_H
#define MOUSE_H

#include <stdbool.h>

#ifdef __cplusplus
extern "C"
{
#endif

enum mouse_button
{
    MOUSE_BUTTON_LEFT,
    MOUSE_BUTTON_RIGHT
};

struct mouse
{
    short x, y, dx, dy;
    int mask, oldmask;
    bool first_clicked, hovering;
};

void mouse_init(struct mouse *m);
void mouse_update(struct mouse *m);
bool mouse_available(void);
bool mouse_pressed(const struct mouse *m, enum mouse_button b);
bool mouse_justpressed(const struct mouse *m, enum mouse_button b);
bool mouse_justreleased(const struct mouse *m, enum mouse_button b);

#ifdef __cplusplus
}
#endif

#endif /* MOUSE_H */