Added generic button

This commit is contained in:
2022-06-21 14:52:36 +02:00
parent a3a1e900b5
commit 2402567330
8 changed files with 100 additions and 4 deletions
+9
View File
@@ -4,6 +4,7 @@
#include "objectids.hpp"
#include "edit_box.hpp"
#include "tool_box.hpp"
#include <memory>
#define SELECTED_LEFT_MAP 0x00000001
#define SELECTED_RIGHT_MAP 0x00000002
@@ -15,6 +16,7 @@
#define SELECTED_LEFT_MOD 0x00000080
#define SELECTED_RIGHT_CHARACTER 0x00000100
#define SELECTED_LEFT_CHARACTER 0x00000200
#define SELECTED_BUTTON 0x00000400
void MouseVisitor::visit(const SDLPP::RenderObject &obj) {
auto id = obj.getId();
@@ -52,6 +54,10 @@ void MouseVisitor::visit(const SDLPP::RenderObject &obj) {
tool_box_location = dynamic_cast<const ToolBox &>(obj).getIndexes();
tool_box_type = dynamic_cast<const ToolBox &>(obj).getType();
break;
case BUTTON_ID:
select_flags |= SELECTED_BUTTON;
cur_button = reinterpret_cast<const Button*>(&obj);
break;
default:
break;
}
@@ -88,6 +94,9 @@ bool MouseVisitor::moveCharactersLeft(uint64_t flags) {
bool MouseVisitor::moveCharactersRight(uint64_t flags) {
return flags & SELECTED_RIGHT_CHARACTER;
}
bool MouseVisitor::button(uint64_t flags) {
return flags & SELECTED_BUTTON;
}
void ToolVisitor::visit(const SDLPP::RenderObject &obj) {
auto id = obj.getCollisions()[0]->getId();