Files
tim/src/event.c
2026-01-12 21:54:15 +05:00

16 lines
432 B
C
Executable File

#include "tim.h"
bool tim_is_event_key(TimEventType type, TimKey key) {
return tim->event.type == type && tim->event.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);
}