diff --git a/Makefile b/Makefile index e4c1870..efc57d3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ OBJS=menu.oo main.oo utils.oo gui.oo dialogue_box.oo menu_messages.oo \ - timer.oo game_info.oo + timer.oo game_info.oo widget.oo all: menu @@ -8,6 +8,8 @@ all: menu menu.oo: menu.cpp menu.hh utils.hh font.hh widget.hh Makefile +widget.oo: widget.cpp widget.hh + gui.oo: gui.cpp gui.hh Makefile font.hh menu.hh sdl_ttf_font.hh \ dialogue_box.hh help_box.hh main_menu.cpp disc_menu.cpp \ file_browser.hh timer.hh game_info.hh diff --git a/menu.cpp b/menu.cpp index dc1e014..e7fe4b9 100644 --- a/menu.cpp +++ b/menu.cpp @@ -371,7 +371,7 @@ void Menu::setText(const char **messages, int *submenu_defaults) this->selectOne(0); } -Menu::Menu(Font *font) +Menu::Menu(Font *font) : Widget() { this->setTextColor((SDL_Color){0xff,0xff,0xff,0}); this->font = font; @@ -391,9 +391,6 @@ Menu::Menu(Font *font) this->cur_sel = 0; this->mouse_x = -1; this->mouse_y = -1; - - memset(this->event_stack, 0, sizeof(this->event_stack)); - this->ev_head = this->ev_tail = 0; } void Menu::setTextColor(SDL_Color clr) diff --git a/widget.cpp b/widget.cpp index 3140ba5..dad3df1 100644 --- a/widget.cpp +++ b/widget.cpp @@ -1,5 +1,11 @@ #include "widget.hh" +Widget::Widget() +{ + memset(this->event_stack, 0, sizeof(this->event_stack)); + this->ev_head = this->ev_tail = 0; +} + event_t Widget::popEvent() { event_t out; diff --git a/widget.hh b/widget.hh index 088afee..5865b9d 100644 --- a/widget.hh +++ b/widget.hh @@ -21,6 +21,8 @@ typedef enum key_event event_t; class Widget { public: + Widget(); + virtual void pushEvent(event_t ev); virtual void pushEvent(SDL_Event *ev);