typedef struct { bool drawn; // should we draw it bool selectable; // is it selectable? you can turn this off and use this to make pictures on the menu for example bool free; // is this button availible to be overwriten SDL_Rect button_rect; // location relative to menu and width / height SDL_Rect surface_rect; SDL_Surface* surface; int (*func)(int); } buttonelement; typedef struct { bool drawn; bool free; SFont_Font* font; int xrel; int yrel; int width; int height; char *text; } textelement; typedef struct { bool free; int keysym; // SDL_BUTTON_LEFT, SDLK_F11, etc int (*func)(int); // Function to run } menuaction; class menu { public: menu (); ~menu (); int init (unsigned short tx, unsigned short ty, unsigned char r, unsigned char g, unsigned char b, unsigned char a, SDL_Surface* tileset); // this automaticly sets focused and drawn to true int predraw (); int draw (SDL_Surface* screen); int move (int x, int y); void setfocus (bool f); void setdrawn (bool d); void setnoborder (bool b); void setbgcolor (unsigned char r, unsigned char g, unsigned char b, unsigned char a); void setbackgroundtype (int b); bool isfocused (); bool isdrawn (); int addmenuaction (int keysym, int (*func)(int)); // returns menuaction number int addbutton (unsigned short xrel, unsigned short yrel, unsigned short w, unsigned short h, SDL_Rect surface_rect, SDL_Surface* buttonsurface, bool selectable, int (*func)(int)); // returns the button number int modbuttonsurface (int num, SDL_Rect surface_rect, SDL_Surface* buttonsurface); //returns the text number int addtext (unsigned short xrel, unsigned short yrel, SFont_Font* font, const char* text); int modtextstring (int num, const char* text); int modtextfont (int num, SFont_Font* font); int modtextposition (int num, unsigned short xrel, unsigned short yrel); int modtextpositionx (int num, unsigned short xrel); int modtextpositiony (int num, unsigned short yrel); int modbuttonselectable (int num, bool selectable); int modbuttondrawn (int num, bool drawn); int removebutton (int num); int removetext (int num); int removemenuaction (int num); int movetextcursor (int num, int offset); bool textcursorshown (); void settextcursor (bool t); int runactions (int x, int y, SDL_Event event); // find the collisions / keypresses on a menu and runs the pointed functions. SDL_Surface* getsurface (); private: SDL_Surface* surface; buttonelement buttons[MAXBUTTONELEMENTS]; textelement texts[MAXTEXTELEMENTS]; menuaction actions[MAXMENUACTIONS]; xy loc; xy txty; xy textcursorloc; SDL_Surface* bordertileset; bool focused; bool drawn; bool textcursor; bool noborder; int backgroundtype; unsigned char color_r; unsigned char color_g; unsigned char color_b; unsigned char color_a; };