mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2025-02-16 20:39:15 +01:00
Add widget base class
This commit is contained in:
parent
d0f0dc3b50
commit
39db099cd4
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ all: menu
|
||||
%.oo: %.cpp
|
||||
g++ -Wall -g -c `sdl-config --cflags` -o $@ $<
|
||||
|
||||
menu.oo: menu.cpp menu.hh utils.hh font.hh Makefile
|
||||
menu.oo: menu.cpp menu.hh utils.hh font.hh widget.hh Makefile
|
||||
|
||||
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 \
|
||||
|
17
menu.hh
17
menu.hh
@ -17,20 +17,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "font.hh"
|
||||
|
||||
enum {
|
||||
EVENT_NONE = 0,
|
||||
KEY_UP = 1,
|
||||
KEY_DOWN = 2,
|
||||
KEY_LEFT = 4,
|
||||
KEY_RIGHT = 8,
|
||||
KEY_SELECT = 16,
|
||||
KEY_ESCAPE = 32,
|
||||
KEY_PAGEDOWN = 64,
|
||||
KEY_PAGEUP = 128,
|
||||
KEY_HELP = 256,
|
||||
};
|
||||
|
||||
#include "widget.hh"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -41,7 +28,7 @@ typedef struct
|
||||
|
||||
typedef int event_t;
|
||||
|
||||
class Menu
|
||||
class Menu : public Widget
|
||||
{
|
||||
public:
|
||||
Menu(Font *font);
|
||||
|
@ -24,7 +24,7 @@ class StringListener
|
||||
void stringCallback(const char *str);
|
||||
};
|
||||
|
||||
class VirtualKeyboard
|
||||
class VirtualKeyboard : public Widget
|
||||
{
|
||||
public:
|
||||
VirtualKeyboard(TTF_Font *font);
|
||||
|
31
widget.hh
Normal file
31
widget.hh
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef WIDGET_HH
|
||||
#define WIDGET_HH
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
enum {
|
||||
EVENT_NONE = 0,
|
||||
KEY_UP = 1,
|
||||
KEY_DOWN = 2,
|
||||
KEY_LEFT = 4,
|
||||
KEY_RIGHT = 8,
|
||||
KEY_SELECT = 16,
|
||||
KEY_ESCAPE = 32,
|
||||
KEY_PAGEDOWN = 64,
|
||||
KEY_PAGEUP = 128,
|
||||
KEY_HELP = 256,
|
||||
};
|
||||
|
||||
|
||||
class Widget
|
||||
{
|
||||
public:
|
||||
virtual void pushEvent(SDL_Event *ev) = 0;
|
||||
|
||||
virtual void runLogic() = 0;
|
||||
|
||||
virtual void draw(SDL_Surface *where,
|
||||
int x, int y, int w, int h) = 0;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user