Move some initing to widget

This commit is contained in:
simon.kagstrom 2009-12-19 18:33:18 +00:00
parent 24568dc5ed
commit b3fffe82d9
4 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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);