From fe8a002d0b563a8d2182fe358307ca6c4e3e2ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Susa=20M=C3=A1rk?= <susa.mark@hallgato.ppke.hu> Date: Mon, 20 May 2024 12:23:06 +0000 Subject: [PATCH] Upload New File --- oswidget.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 oswidget.cpp diff --git a/oswidget.cpp b/oswidget.cpp new file mode 100644 index 0000000..e13290a --- /dev/null +++ b/oswidget.cpp @@ -0,0 +1,10 @@ +#include "oswidget.hpp" + +OSWidget::OSWidget(Window* window, int pos_x, int pos_y, int width, int height) + : _window(window), _pos_x(pos_x), _pos_y(pos_y), _width(width), _height(height) {} + +bool OSWidget::is_selected(int mouse_x, int mouse_y) { + return (mouse_x >= _pos_x && mouse_x <= _pos_x + _width && + mouse_y >= _pos_y && mouse_y <= _pos_y + _height); +} + -- GitLab