Refractor and cleanup binding logic

This commit is contained in:
2026-05-05 16:19:49 +01:00
parent 6a29c113e0
commit d362bbc114
7 changed files with 357 additions and 306 deletions
+3 -3
View File
@@ -384,7 +384,8 @@ bool Window::poll(Event &event) {
break;
case SDL_EVENT_KEY_DOWN:
#warning This is a bit of a hack to prevent key down/up events from being generated when text input is active on certian keys, but this list is not enough, need to look more into it
#warning "This is a bit of a hack to prevent key down/up events from being generated when text input is active on certian keys," \
"but this list is not enough, need to look more into it"
if (text_input_active && sdl_event.key.key > '0' && sdl_event.key.key < 'z')
return false;
event.type = Event::KEY_DOWN;
@@ -516,6 +517,5 @@ void Window::compute_transform() {
bool Window::mouse_in_window(const Vec2<float> real_position, Vec2<float> &virtual_position) {
virtual_position = (real_position - offset) / scale;
return virtual_position.x >= 0 && virtual_position.x <= virtual_size.x &&
virtual_position.y >= 0 && virtual_position.y <= virtual_size.y;
return virtual_position.x >= 0 && virtual_position.x <= virtual_size.x && virtual_position.y >= 0 && virtual_position.y <= virtual_size.y;
}