frodo-wii/widget.hh

43 lines
701 B
C++
Raw Normal View History

2009-12-19 16:46:15 +01:00
#ifndef WIDGET_HH
#define WIDGET_HH
#include <SDL.h>
enum key_event {
2009-12-26 13:19:35 +01:00
EVENT_NONE = (1 << 8),
KEY_UP = (1 << 9),
KEY_DOWN = (1 << 10),
KEY_LEFT = (1 << 11),
KEY_RIGHT = (1 << 12),
KEY_SELECT = (1 << 13),
KEY_ESCAPE = (1 << 14),
KEY_PAGEDOWN = (1 << 15),
KEY_PAGEUP = (1 << 16),
KEY_HELP = (1 << 17),
2009-12-19 16:46:15 +01:00
};
typedef enum key_event event_t;
2009-12-19 16:46:15 +01:00
class Widget
{
public:
2009-12-19 19:33:18 +01:00
Widget();
virtual void pushEvent(event_t ev);
virtual void pushEvent(SDL_Event *ev);
2009-12-19 16:46:15 +01:00
virtual void runLogic() = 0;
virtual void draw(SDL_Surface *where,
2009-12-20 10:31:46 +01:00
int x, int y, int w, int h);
virtual event_t popEvent();
protected:
int ev_head, ev_tail;
event_t event_stack[8];
2009-12-19 16:46:15 +01:00
};
#endif