moved code from header to source files
This commit is contained in:
19
src/event.c
Executable file
19
src/event.c
Executable file
@@ -0,0 +1,19 @@
|
||||
#include "tim.h"
|
||||
|
||||
bool tim_is_event_key(TimEventType type, TimKey key) {
|
||||
return tim.event.type == type && tim.event.key == key;
|
||||
}
|
||||
|
||||
bool tim_is_key_press(TimKey key) {
|
||||
return tim_is_event_key(TimEvent_Key, key);
|
||||
}
|
||||
|
||||
bool tim_is_mouse_over(TimRect r) {
|
||||
i32 x = tim.event.x;
|
||||
i32 y = tim.event.y;
|
||||
return x >= r.x && x < r.x + r.w && y >= r.y && y < r.y + r.h;
|
||||
}
|
||||
|
||||
bool tim_is_mouse_click_over(TimRect r) {
|
||||
return tim_is_event_key(TimEvent_Mouse, TimKey_MouseButtonLeft) && tim_is_mouse_over(r);
|
||||
}
|
||||
Reference in New Issue
Block a user