double click support

This commit is contained in:
MihailRis
2024-05-16 06:43:53 +03:00
parent b6f2456a82
commit a678eddb77
7 changed files with 102 additions and 10 deletions
+14
View File
@@ -64,10 +64,24 @@ UINode* UINode::listenAction(onaction action) {
return this;
}
UINode* UINode::listenDoubleClick(onaction action) {
doubleClickCallbacks.push_back(action);
return this;
}
void UINode::click(GUI*, int, int) {
pressed = true;
}
void UINode::doubleClick(GUI* gui, int x, int y) {
pressed = true;
if (isInside(glm::vec2(x, y))) {
for (auto callback : doubleClickCallbacks) {
callback(gui);
}
}
}
void UINode::mouseRelease(GUI* gui, int x, int y) {
pressed = false;
if (isInside(glm::vec2(x, y))) {