git repos / blockattack-game

commit 792dafd6

sago007 · 2020-07-01 19:00
792dafd6aa1ac7eaeaae5378d3362c6b10098ae7 patch · browse files
parent d7f4a888ee5225a6fc509a03e049382628df4b2d

Replaced Button with default conructor and destructor

Changed files

M source/code/MenuSystem.cpp before
M source/code/MenuSystem.h before
diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp index f22e7f5..3ecfc61 100644 --- a/source/code/MenuSystem.cpp +++ b/source/code/MenuSystem.cpp
@@ -59,15 +59,6 @@ sago::SagoTextField* ButtonGfx::getLabel(const std::string& text) {
return labels[text].get();
}
-Button::Button() {
- label = "";
- marked = false;
- action = nullptr;
- popOnRun = false;
-}
-
-Button::~Button() {
-}
Button::Button(const Button& b) : action{b.action}, label{b.label}, marked{b.marked} {
}
diff --git a/source/code/MenuSystem.h b/source/code/MenuSystem.h index 024bf3a..02d643b 100644 --- a/source/code/MenuSystem.h +++ b/source/code/MenuSystem.h
@@ -67,10 +67,10 @@ public:
int x = 0;
int y = 0;
- Button();
+ Button() = default;
Button(const Button& b);
Button& operator=(const Button& other);
- virtual ~Button();
+ virtual ~Button() = default;
//Set the text to write on the button
@@ -107,10 +107,10 @@ public:
Menu(SDL_Renderer *screen);
Menu(SDL_Renderer *screen, const std::string& title, bool isSubmenu);
virtual ~Menu() {}
-
+
//Add a button to the menu
void addButton(Button *b);
-
+
bool IsActive() override;
void Draw(SDL_Renderer* target) override;
void ProcessInput(const SDL_Event& event, bool &processed) override;