projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- converted text_type into a class
[supertux.git]
/
src
/
menu.h
diff --git
a/src/menu.h
b/src/menu.h
index
3da7a97
..
e8baf70
100644
(file)
--- a/
src/menu.h
+++ b/
src/menu.h
@@
-14,6
+14,7
@@
#define SUPERTUX_MENU_H
#include <SDL.h>
#define SUPERTUX_MENU_H
#include <SDL.h>
+#include <vector>
#include "texture.h"
#include "timer.h"
#include "type.h"
#include "texture.h"
#include "timer.h"
#include "type.h"
@@
-36,51
+37,59
@@
enum MenuItemKind {
class Menu;
class Menu;
-struct menu_item_type
-
{
- MenuItemKind kind;
-
int toggle
d;
-
char *text
;
-
char *inpu
t;
-
string_list_type* lis
t;
-
Menu* target_menu
;
-
}
;
+class MenuItem
+{
+public:
+
MenuItemKind kin
d;
+
int toggled
;
+
char *tex
t;
+
char *inpu
t;
+
string_list_type* list
;
+
Menu* target_menu
;
-menu_item_type* menu_item_create(MenuItemKind kind, char *text, int init_toggle, Menu* target_menu);
-void menu_item_change_text (menu_item_type* pmenu_item, const char *text);
-void menu_item_change_input(menu_item_type* pmenu_item, const char *text);
+ void change_text (const char *text);
+ void change_input(const char *text);
+
+ static MenuItem* create(MenuItemKind kind, const char *text, int init_toggle, Menu* target_menu);
+};
class Menu
{
class Menu
{
-friend void menu_event(SDL_Event& event);
-
private:
// position of the menu (ie. center of the menu, not top/left)
int pos_x;
int pos_y;
private:
// position of the menu (ie. center of the menu, not top/left)
int pos_x;
int pos_y;
- int num_items;
Menu* last_menu;
int width();
int height();
Menu* last_menu;
int width();
int height();
-
+
public:
public:
-
timer_type
effect;
+
Timer
effect;
int arrange_left;
int active_item;
int arrange_left;
int active_item;
-
menu_item_type *
item;
+
std::vector<MenuItem>
item;
static void set_current(Menu* pmenu);
Menu();
~Menu();
static void set_current(Menu* pmenu);
Menu();
~Menu();
- void additem(
menu_item_type
* pmenu_item);
- void additem(MenuItemKind kind, c
har *
text, int init_toggle, Menu* target_menu);
+ void additem(
MenuItem
* pmenu_item);
+ void additem(MenuItemKind kind, c
onst std::string&
text, int init_toggle, Menu* target_menu);
void action ();
void action ();
+
+ /** Remove all entries from the menu */
+ void clear();
+
+ /** Check, if the value of the active menu item has changed. */
int check ();
void draw ();
void draw_item(int index, int menu_width, int menu_height);
int check ();
void draw ();
void draw_item(int index, int menu_width, int menu_height);
+ void set_pos(int x, int y, float rw = 0, float rh = 0);
+
+ /* Check for a menu event */
+ void event(SDL_Event& event);
};
};
@@
-100,10
+109,18
@@
enum MenuAction {
extern MenuAction menuaction;
extern bool show_menu;
extern bool menu_change;
extern MenuAction menuaction;
extern bool show_menu;
extern bool menu_change;
-extern texture_type checkbox, checkbox_checked, back, arrow_left, arrow_right;
+extern Surface* checkbox;
+extern Surface* checkbox_checked;
+extern Surface* back;
+extern Surface* arrow_left;
+extern Surface* arrow_right;
+
+extern Menu* contrib_menu;
+extern Menu* contrib_subset_menu;
extern Menu* main_menu;
extern Menu* game_menu;
extern Menu* main_menu;
extern Menu* game_menu;
+extern Menu* worldmap_menu;
extern Menu* options_menu;
extern Menu* options_controls_menu;
extern Menu* highscore_menu;
extern Menu* options_menu;
extern Menu* options_controls_menu;
extern Menu* highscore_menu;
@@
-121,11
+138,8
@@
void menu_reset(void);
/* "Calculate" and draw the menu */
void menu_process_current(void);
/* "Calculate" and draw the menu */
void menu_process_current(void);
-/* Check for a menu event */
-void menu_event(SDL_Event& event);
-
#endif /*SUPERTUX_MENU_H*/
/* Local Variables: */
#endif /*SUPERTUX_MENU_H*/
/* Local Variables: */
-/* mode:c++ */
-/* End */
+/* mode:
c++ */
+/* End
:
*/