wok-6.x rev 2114
Add: SuperTux 0.1.3
author | Mallory MOLLO <mallory@skyrock.com> |
---|---|
date | Fri Jan 30 00:46:35 2009 +0100 (2009-01-30) |
parents | ff607e8ddd3e |
children | a6b13b5d9e03 |
files | supertux/receipt supertux/stuff/menu.h |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/supertux/receipt Fri Jan 30 00:46:35 2009 +0100 1.3 @@ -0,0 +1,32 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="supertux" 1.7 +VERSION="0.1.3" 1.8 +CATEGORY="games" 1.9 +SHORT_DESC="SuperTux is a classic 2D jump'n run sidescroller game in a style similar to the original SuperMario games." 1.10 +MAINTAINER="mallory@skyrock.com" 1.11 +DEPENDS="libSDL libsdl-image libsdl-mixer" 1.12 +BUILD_DEPENDS="libSDL-dev libsdl-image-dev libsdl-mixer-dev" 1.13 +TARBALL="$PACKAGE-$VERSION.tar.bz2" 1.14 +WEB_SITE="http://supertux.lethargik.org/" 1.15 +WGET_URL="http://download.berlios.de/supertux/$TARBALL" 1.16 + 1.17 +# Rules to configure and make the package. 1.18 +compile_rules() 1.19 +{ 1.20 + cd $src 1.21 + cp ../stuff/menu.h src 1.22 + ./configure --prefix=/usr --infodir=/usr/share/info \ 1.23 + --mandir=/usr/share/man $CONFIGURE_ARGS && \ 1.24 + make && make DESTDIR=$PWD/_pkg install 1.25 +} 1.26 + 1.27 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.28 +genpkg_rules() 1.29 +{ 1.30 + mkdir -p $fs/usr 1.31 + cp -a $_pkg/usr/bin $fs/usr 1.32 + echo Copying data... 1.33 + cp -a $_pkg/usr/share $fs/usr 1.34 +} 1.35 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/supertux/stuff/menu.h Fri Jan 30 00:46:35 2009 +0100 2.3 @@ -0,0 +1,247 @@ 2.4 +// $Id: menu.h 1053 2004-05-09 18:08:02Z tobgle $ 2.5 +// 2.6 +// SuperTux 2.7 +// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de> 2.8 +// 2.9 +// This program is free software; you can redistribute it and/or 2.10 +// modify it under the terms of the GNU General Public License 2.11 +// as published by the Free Software Foundation; either version 2 2.12 +// of the License, or (at your option) any later version. 2.13 +// 2.14 +// This program is distributed in the hope that it will be useful, 2.15 +// but WITHOUT ANY WARRANTY; without even the implied warranty of 2.16 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2.17 +// GNU General Public License for more details. 2.18 +// 2.19 +// You should have received a copy of the GNU General Public License 2.20 +// along with this program; if not, write to the Free Software 2.21 +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 2.22 + 2.23 +#ifndef SUPERTUX_MENU_H 2.24 +#define SUPERTUX_MENU_H 2.25 + 2.26 +#include <SDL.h> 2.27 +#include <vector> 2.28 +#include "texture.h" 2.29 +#include "timer.h" 2.30 +#include "type.h" 2.31 +#include "mousecursor.h" 2.32 + 2.33 +/* IDs for menus */ 2.34 + 2.35 +enum MainMenuIDs { 2.36 + MNID_STARTGAME, 2.37 + MNID_CONTRIB, 2.38 + MNID_OPTIONMENU, 2.39 + MNID_LEVELEDITOR, 2.40 + MNID_CREDITS, 2.41 + MNID_QUITMAINMENU 2.42 + }; 2.43 + 2.44 +enum OptionsMenuIDs { 2.45 + MNID_OPENGL, 2.46 + MNID_FULLSCREEN, 2.47 + MNID_SOUND, 2.48 + MNID_MUSIC, 2.49 + MNID_SHOWFPS 2.50 + }; 2.51 + 2.52 +enum GameMenuIDs { 2.53 + MNID_CONTINUE, 2.54 + MNID_ABORTLEVEL 2.55 + }; 2.56 + 2.57 +enum WorldMapMenuIDs { 2.58 + MNID_RETURNWORLDMAP, 2.59 + MNID_QUITWORLDMAP 2.60 + }; 2.61 + 2.62 +enum LevelEditorMainMenuIDs { 2.63 + MNID_RETURNLEVELEDITOR, 2.64 + MNID_SUBSETSETTINGS, 2.65 + MNID_QUITLEVELEDITOR 2.66 + }; 2.67 + 2.68 +enum LevelEditorSubsetSettingsIDs { 2.69 + MNID_SUBSETTITLE, 2.70 + MNID_SUBSETDESCRIPTION, 2.71 + MNID_SUBSETSAVECHANGES 2.72 + }; 2.73 + 2.74 +enum LevelEditorSubsetNewIDs { 2.75 + MNID_SUBSETNAME, 2.76 + MNID_CREATESUBSET 2.77 +}; 2.78 + 2.79 +enum LevelEditorSettingsMenuIDs { 2.80 + MNID_NAME, 2.81 + MNID_AUTHOR, 2.82 + MNID_SONG, 2.83 + MNID_BGIMG, 2.84 + MNID_PARTICLE, 2.85 + MNID_LENGTH, 2.86 + MNID_TIME, 2.87 + MNID_GRAVITY, 2.88 + MNID_BGSPEED, 2.89 + MNID_TopRed, 2.90 + MNID_TopGreen, 2.91 + MNID_TopBlue, 2.92 + MNID_BottomRed, 2.93 + MNID_BottomGreen, 2.94 + MNID_BottomBlue, 2.95 + MNID_APPLY 2.96 + }; 2.97 + 2.98 +bool confirm_dialog(std::string text); 2.99 + 2.100 +/* Kinds of menu items */ 2.101 +enum MenuItemKind { 2.102 + MN_ACTION, 2.103 + MN_GOTO, 2.104 + MN_TOGGLE, 2.105 + MN_BACK, 2.106 + MN_DEACTIVE, 2.107 + MN_TEXTFIELD, 2.108 + MN_NUMFIELD, 2.109 + MN_CONTROLFIELD, 2.110 + MN_STRINGSELECT, 2.111 + MN_LABEL, 2.112 + MN_HL, /* horizontal line */ 2.113 +}; 2.114 + 2.115 +class Menu; 2.116 + 2.117 +class MenuItem 2.118 +{ 2.119 +public: 2.120 + MenuItemKind kind; 2.121 + int toggled; 2.122 + char *text; 2.123 + char *input; 2.124 + int *int_p; // used for setting keys (can be used for more stuff...) 2.125 + int id; // item id 2.126 + string_list_type* list; 2.127 + Menu* target_menu; 2.128 + 2.129 + void change_text (const char *text); 2.130 + void change_input(const char *text); 2.131 + 2.132 + static MenuItem* create(MenuItemKind kind, const char *text, int init_toggle, Menu* target_menu, int id, int* int_p); 2.133 + 2.134 + std::string get_input_with_symbol(bool active_item); // returns the text with an input symbol 2.135 +private: 2.136 + bool input_flickering; 2.137 + Timer input_flickering_timer; 2.138 +}; 2.139 + 2.140 +class Menu 2.141 +{ 2.142 +private: 2.143 + static std::vector<Menu*> last_menus; 2.144 + static Menu* current_; 2.145 + 2.146 + static void push_current(Menu* pmenu); 2.147 + static void pop_current(); 2.148 + 2.149 +public: 2.150 + /** Set the current menu, if pmenu is NULL, hide the current menu */ 2.151 + static void set_current(Menu* pmenu); 2.152 + 2.153 + /** Return the current active menu or NULL if none is active */ 2.154 + static Menu* current() { return current_; } 2.155 + 2.156 +private: 2.157 + /* Action done on the menu */ 2.158 + enum MenuAction { 2.159 + MENU_ACTION_NONE = -1, 2.160 + MENU_ACTION_UP, 2.161 + MENU_ACTION_DOWN, 2.162 + MENU_ACTION_LEFT, 2.163 + MENU_ACTION_RIGHT, 2.164 + MENU_ACTION_HIT, 2.165 + MENU_ACTION_INPUT, 2.166 + MENU_ACTION_REMOVE 2.167 + }; 2.168 + 2.169 + /** Number of the item that got 'hit' (ie. pressed) in the last 2.170 + event()/action() call, -1 if none */ 2.171 + int hit_item; 2.172 + 2.173 + // position of the menu (ie. center of the menu, not top/left) 2.174 + int pos_x; 2.175 + int pos_y; 2.176 + 2.177 + /** input event for the menu (up, down, left, right, etc.) */ 2.178 + MenuAction menuaction; 2.179 + 2.180 + /* input implementation variables */ 2.181 + int delete_character; 2.182 + char mn_input_char; 2.183 + 2.184 +public: 2.185 + Timer effect; 2.186 + int arrange_left; 2.187 + int active_item; 2.188 + 2.189 + std::vector<MenuItem> item; 2.190 + 2.191 + Menu(); 2.192 + ~Menu(); 2.193 + 2.194 + void additem(MenuItem* pmenu_item); 2.195 + void additem(MenuItemKind kind, const std::string& text, int init_toggle, Menu* target_menu, int id = -1, int *int_p = NULL); 2.196 + 2.197 + void action (); 2.198 + 2.199 + /** Remove all entries from the menu */ 2.200 + void clear(); 2.201 + 2.202 + /** Return the index of the menu item that was 'hit' (ie. the user 2.203 + clicked on it) in the last event() call */ 2.204 + int check (); 2.205 + 2.206 + MenuItem& get_item(int index) { return item[index]; } 2.207 + MenuItem& get_item_by_id(int id); 2.208 + 2.209 + int get_active_item_id(); 2.210 + 2.211 + bool isToggled(int id); 2.212 + 2.213 + void get_controlfield_key_into_input(MenuItem *item); 2.214 + 2.215 + void draw (); 2.216 + void draw_item(int index, int menu_width, int menu_height); 2.217 + void set_pos(int x, int y, float rw = 0, float rh = 0); 2.218 + 2.219 + /** translate a SDL_Event into a menu_action */ 2.220 + void event(SDL_Event& event); 2.221 + 2.222 + int get_width() const; 2.223 + int get_height() const; 2.224 + 2.225 + bool is_toggled(int id) const; 2.226 +}; 2.227 + 2.228 +extern Surface* checkbox; 2.229 +extern Surface* checkbox_checked; 2.230 +extern Surface* back; 2.231 +extern Surface* arrow_left; 2.232 +extern Surface* arrow_right; 2.233 + 2.234 +extern Menu* contrib_menu; 2.235 +extern Menu* contrib_subset_menu; 2.236 +extern Menu* main_menu; 2.237 +extern Menu* game_menu; 2.238 +extern Menu* worldmap_menu; 2.239 +extern Menu* options_menu; 2.240 +extern Menu* options_keys_menu; 2.241 +extern Menu* options_joystick_menu; 2.242 +extern Menu* highscore_menu; 2.243 +extern Menu* load_game_menu; 2.244 +extern Menu* save_game_menu; 2.245 + 2.246 +#endif /*SUPERTUX_MENU_H*/ 2.247 + 2.248 +/* Local Variables: */ 2.249 +/* mode: c++ */ 2.250 +/* End: */