// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#include <assert.h>
-#include <stdio.h>
+#include <cassert>
+#include <cstdio>
#include <iostream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <cerrno>
#include <unistd.h>
-#include <SDL.h>
-#include <SDL_image.h>
+
+#include "SDL.h"
+#include "SDL_image.h"
#ifndef NOOPENGL
-#include <SDL_opengl.h>
+#include "SDL_opengl.h"
#endif
#include <sys/stat.h>
#ifndef WIN32
#include <libgen.h>
#endif
-#include <ctype.h>
+
+#include <cctype>
#include "defines.h"
#include "globals.h"
#include "setup.h"
#include "screen/screen.h"
-#include "screen/texture.h"
+#include "screen/surface.h"
#include "menu.h"
#include "gameloop.h"
#include "configfile.h"
#include "resources.h"
#include "intro.h"
#include "sound_manager.h"
+#include "gettext.h"
#include "player.h"
worldmap_menu = new Menu();
main_menu->set_pos(screen->w/2, 335);
- main_menu->additem(MN_GOTO, "Start Game",0,load_game_menu, MNID_STARTGAME);
- main_menu->additem(MN_GOTO, "Contrib Levels",0,contrib_menu, MNID_CONTRIB);
- main_menu->additem(MN_GOTO, "Options",0,options_menu, MNID_OPTIONMENU);
- main_menu->additem(MN_ACTION,"Level Editor",0,0, MNID_LEVELEDITOR);
- main_menu->additem(MN_ACTION,"Credits",0,0, MNID_CREDITS);
- main_menu->additem(MN_ACTION,"Quit",0,0, MNID_QUITMAINMENU);
-
- options_menu->additem(MN_LABEL,"Options",0,0);
+ main_menu->additem(MN_GOTO, _("Start Game"),0,load_game_menu, MNID_STARTGAME);
+ main_menu->additem(MN_GOTO, _("Contrib Levels"),0,contrib_menu, MNID_CONTRIB);
+ main_menu->additem(MN_GOTO, _("Options"),0,options_menu, MNID_OPTIONMENU);
+ main_menu->additem(MN_ACTION, _("Level Editor"),0,0, MNID_LEVELEDITOR);
+ main_menu->additem(MN_ACTION, _("Credits"),0,0, MNID_CREDITS);
+ main_menu->additem(MN_ACTION, _("Quit"),0,0, MNID_QUITMAINMENU);
+
+ options_menu->additem(MN_LABEL,_("Options"),0,0);
options_menu->additem(MN_HL,"",0,0);
#ifndef NOOPENGL
- options_menu->additem(MN_TOGGLE,"OpenGL",use_gl,0, MNID_OPENGL);
+ options_menu->additem(MN_TOGGLE,_("OpenGL "),use_gl,0, MNID_OPENGL);
#else
- options_menu->additem(MN_DEACTIVE,"OpenGL (not supported)",use_gl, 0, MNID_OPENGL);
+ options_menu->additem(MN_DEACTIVE,_("OpenGL (not supported)"),use_gl, 0, MNID_OPENGL);
#endif
- options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0, MNID_FULLSCREEN);
+ options_menu->additem(MN_TOGGLE,_("Fullscreen"),use_fullscreen,0, MNID_FULLSCREEN);
if(audio_device)
{
- options_menu->additem(MN_TOGGLE,"Sound ", use_sound,0, MNID_SOUND);
- options_menu->additem(MN_TOGGLE,"Music ", use_music,0, MNID_MUSIC);
+ options_menu->additem(MN_TOGGLE,_("Sound "), use_sound,0, MNID_SOUND);
+ options_menu->additem(MN_TOGGLE,_("Music "), use_music,0, MNID_MUSIC);
}
else
{
- options_menu->additem(MN_DEACTIVE,"Sound ", false,0, MNID_SOUND);
- options_menu->additem(MN_DEACTIVE,"Music ", false,0, MNID_MUSIC);
+ options_menu->additem(MN_DEACTIVE,_("Sound "), false,0, MNID_SOUND);
+ options_menu->additem(MN_DEACTIVE,_("Music "), false,0, MNID_MUSIC);
}
- options_menu->additem(MN_TOGGLE,"Show FPS ",show_fps,0, MNID_SHOWFPS);
- options_menu->additem(MN_GOTO,"Keyboard Setup",0,options_keys_menu);
+ options_menu->additem(MN_TOGGLE,_("Show FPS "),show_fps,0, MNID_SHOWFPS);
+ options_menu->additem(MN_GOTO,_("Setup Keys"),0,options_keys_menu);
if(use_joystick)
- options_menu->additem(MN_GOTO,"Joystick Setup",0,options_joystick_menu);
+ options_menu->additem(MN_GOTO,_("Setup Joystick"),0,options_joystick_menu);
options_menu->additem(MN_HL,"",0,0);
- options_menu->additem(MN_BACK,"Back",0,0);
+ options_menu->additem(MN_BACK,_("Back"),0,0);
- options_keys_menu->additem(MN_LABEL,"Key Setup",0,0);
+ options_keys_menu->additem(MN_LABEL,_("Keyboard Setup"),0,0);
options_keys_menu->additem(MN_HL,"",0,0);
- options_keys_menu->additem(MN_CONTROLFIELD_KB,"Left move", 0,0, 0,&keymap.left);
- options_keys_menu->additem(MN_CONTROLFIELD_KB,"Right move", 0,0, 0,&keymap.right);
- options_keys_menu->additem(MN_CONTROLFIELD_KB,"Jump", 0,0, 0,&keymap.jump);
- options_keys_menu->additem(MN_CONTROLFIELD_KB,"Duck", 0,0, 0,&keymap.duck);
- options_keys_menu->additem(MN_CONTROLFIELD_KB,"Activate", 0, 0, 0,
+ options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Left move"), 0,0, 0,&keymap.left);
+ options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Right move"), 0,0, 0,&keymap.right);
+ options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Jump"), 0,0, 0,&keymap.jump);
+ options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Duck"), 0,0, 0,&keymap.duck);
+ options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Activate"), 0, 0, 0,
&keymap.activate);
- options_keys_menu->additem(MN_CONTROLFIELD_KB,"Power/Run", 0,0, 0,&keymap.fire);
+ options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Power/Run"), 0,0, 0,&keymap.fire);
options_keys_menu->additem(MN_HL,"",0,0);
- options_keys_menu->additem(MN_BACK,"Back",0,0);
+ options_keys_menu->additem(MN_BACK,_("Back"),0,0);
if(use_joystick)
{
- options_joystick_menu->additem(MN_LABEL,"Joystick Setup",0,0);
+ options_joystick_menu->additem(MN_LABEL,_("Joystick Setup"),0,0);
options_joystick_menu->additem(MN_HL,"",0,0);
//options_joystick_menu->additem(MN_CONTROLFIELD_JS,"X axis", 0,0, 0,&joystick_keymap.x_axis);
//options_joystick_menu->additem(MN_CONTROLFIELD_JS,"Y axis", 0,0, 0,&joystick_keymap.y_axis);
- options_joystick_menu->additem(MN_CONTROLFIELD_JS,"A button", 0,0, 0,&joystick_keymap.a_button);
- options_joystick_menu->additem(MN_CONTROLFIELD_JS,"B button", 0,0, 0,&joystick_keymap.b_button);
+ options_joystick_menu->additem(MN_CONTROLFIELD_JS,_("A button"), 0,0, 0,&joystick_keymap.a_button);
+ options_joystick_menu->additem(MN_CONTROLFIELD_JS,_("B button"), 0,0, 0,&joystick_keymap.b_button);
//options_joystick_menu->additem(MN_CONTROLFIELD_JS,"Start", 0,0, 0,&joystick_keymap.start_button);
//options_joystick_menu->additem(MN_CONTROLFIELD_JS,"DeadZone", 0,0, 0,&joystick_keymap.dead_zone);
options_joystick_menu->additem(MN_HL,"",0,0);
- options_joystick_menu->additem(MN_BACK,"Back",0,0);
+ options_joystick_menu->additem(MN_BACK,_("Back"),0,0);
}
- load_game_menu->additem(MN_LABEL,"Start Game",0,0);
+ load_game_menu->additem(MN_LABEL,_("Start Game"),0,0);
load_game_menu->additem(MN_HL,"",0,0);
load_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0, 1);
load_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0, 2);
load_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0, 4);
load_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0, 5);
load_game_menu->additem(MN_HL,"",0,0);
- load_game_menu->additem(MN_BACK,"Back",0,0);
+ load_game_menu->additem(MN_BACK,_("Back"),0,0);
- save_game_menu->additem(MN_LABEL,"Save Game",0,0);
+ save_game_menu->additem(MN_LABEL,_("Save Game"),0,0);
save_game_menu->additem(MN_HL,"",0,0);
save_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0, 1);
save_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0, 2);
save_game_menu->additem(MN_HL,"",0,0);
save_game_menu->additem(MN_BACK,"Back",0,0);
- game_menu->additem(MN_LABEL,"Pause",0,0);
+ game_menu->additem(MN_LABEL,_("Pause"),0,0);
game_menu->additem(MN_HL,"",0,0);
- game_menu->additem(MN_ACTION,"Continue",0,0,MNID_CONTINUE);
- game_menu->additem(MN_GOTO,"Options",0,options_menu);
+ game_menu->additem(MN_ACTION,_("Continue"),0,0,MNID_CONTINUE);
+ game_menu->additem(MN_GOTO,_("Options"),0,options_menu);
game_menu->additem(MN_HL,"",0,0);
- game_menu->additem(MN_ACTION,"Abort Level",0,0,MNID_ABORTLEVEL);
+ game_menu->additem(MN_ACTION,_("Abort Level"),0,0,MNID_ABORTLEVEL);
- worldmap_menu->additem(MN_LABEL,"Pause",0,0);
+ worldmap_menu->additem(MN_LABEL,_("Pause"),0,0);
worldmap_menu->additem(MN_HL,"",0,0);
- worldmap_menu->additem(MN_ACTION,"Continue",0,0,MNID_RETURNWORLDMAP);
- worldmap_menu->additem(MN_GOTO,"Options",0,options_menu);
+ worldmap_menu->additem(MN_ACTION,_("Continue"),0,0,MNID_RETURNWORLDMAP);
+ worldmap_menu->additem(MN_GOTO,_("Options"),0,options_menu);
worldmap_menu->additem(MN_HL,"",0,0);
- worldmap_menu->additem(MN_ACTION,"Quit Game",0,0,MNID_QUITWORLDMAP);
+ worldmap_menu->additem(MN_ACTION,_("Quit Game"),0,0,MNID_QUITWORLDMAP);
- highscore_menu->additem(MN_TEXTFIELD,"Enter your name:",0,0);
+ highscore_menu->additem(MN_TEXTFIELD,_("Enter your name:"),0,0);
}
void update_load_save_game_menu(Menu* pmenu)
}
// shrink_fade(Point((screen->w/2),(screen->h/2)), 1000);
- fadeout(200);
+ fadeout(256);
WorldMapNS::WorldMap worldmap;
// Load the game or at least set the savegame_file variable
SDL_EnableUNICODE(1);
/* Load global images: */
-
- black_text = new Font(datadir + "/images/status/letters-black.png", TEXT_TEXT, 16,18);
- gold_text = new Font(datadir + "/images/status/letters-gold.png", TEXT_TEXT, 16,18);
- silver_text = new Font(datadir + "/images/status/letters-silver.png", TEXT_TEXT, 16,18);
- blue_text = new Font(datadir + "/images/status/letters-blue.png", TEXT_TEXT,
- 16,18, 3);
- red_text = new Font(datadir + "/images/status/letters-red.png", TEXT_TEXT, 16,18);
- green_text = new Font(datadir + "/images/status/letters-green.png", TEXT_TEXT, 16,18);
- white_text = new Font(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18);
- white_small_text = new Font(datadir +
- "/images/status/letters-white-small.png", TEXT_TEXT, 8,9, 1);
- white_big_text = new Font(datadir + "/images/status/letters-white-big.png",
- TEXT_TEXT, 20,22, 3);
- yellow_nums = new Font(datadir + "/images/status/numbers.png", TEXT_NUM, 32,32);
+ gold_text = new Font(datadir + "/images/fonts/gold.png", Font::TEXT, 16,18);
+ blue_text = new Font(datadir + "/images/fonts/blue.png", Font::TEXT, 16,18,3);
+ white_text = new Font(datadir + "/images/fonts/white.png",
+ Font::TEXT, 16,18);
+ gray_text = new Font(datadir + "/images/fonts/gray.png",
+ Font::TEXT, 16,18);
+ white_small_text = new Font(datadir + "/images/fonts/white-small.png",
+ Font::TEXT, 8,9, 1);
+ white_big_text = new Font(datadir + "/images/fonts/white-big.png",
+ Font::TEXT, 20,22, 3);
+ yellow_nums = new Font(datadir + "/images/fonts/numbers.png",
+ Font::NUM, 32,32);
/* Load GUI/menu images: */
checkbox = new Surface(datadir + "/images/status/checkbox.png", USE_ALPHA);
{
/* Free global images: */
- delete black_text;
delete gold_text;
- delete silver_text;
delete white_text;
delete blue_text;
- delete red_text;
- delete green_text;
delete white_small_text;
delete white_big_text;
delete yellow_nums;
delete main_menu;
delete game_menu;
delete options_menu;
+ delete options_keys_menu;
+ delete options_joystick_menu;
delete highscore_menu;
+ delete contrib_menu;
+ delete contrib_subset_menu;
+ delete worldmap_menu;
delete save_game_menu;
delete load_game_menu;
}
{
fprintf(stderr,
"\nWarning: I could not set up fullscreen video for "
- "640x480 mode.\n"
+ "800x600 mode.\n"
"The Simple DirectMedia error that occured was:\n"
"%s\n\n", SDL_GetError());
use_fullscreen = false;
if (screen == NULL)
{
fprintf(stderr,
- "\nError: I could not set up video for 640x480 mode.\n"
+ "\nError: I could not set up video for 800x600 mode.\n"
"The Simple DirectMedia error that occured was:\n"
"%s\n\n", SDL_GetError());
exit(1);
/* Open joystick: */
if (SDL_NumJoysticks() <= 0)
{
- fprintf(stderr, "Warning: No joysticks are available.\n");
+ fprintf(stderr, "Info: No joysticks were found.\n");
use_joystick = false;
}
if (strcmp(argv[i], "--fullscreen") == 0 ||
strcmp(argv[i], "-f") == 0)
{
- /* Use full screen: */
-
use_fullscreen = true;
}
+ else if (strcmp(argv[i], "--window") == 0 ||
+ strcmp(argv[i], "-w") == 0)
+ {
+ use_fullscreen = false;
+ }
else if (strcmp(argv[i], "--joystick") == 0 || strcmp(argv[i], "-j") == 0)
{
assert(i+1 < argc);
}
else if (strcmp(argv[i], "--help") == 0)
{ /* Show help: */
- puts("Super Tux " VERSION "\n"
- " Please see the file \"README.txt\" for more details.\n");
- printf("Usage: %s [OPTIONS] FILENAME\n\n", argv[0]);
- puts("Display Options:\n"
- " --fullscreen Run in fullscreen mode.\n"
- " --opengl If opengl support was compiled in, this will enable\n"
- " the EXPERIMENTAL OpenGL mode.\n"
- " --sdl Use non-opengl renderer\n"
+ puts(_(" SuperTux " VERSION "\n"
+ " Please see the file \"README.txt\" for more details.\n"));
+ printf(_("Usage: %s [OPTIONS] FILENAME\n\n"), argv[0]);
+ puts(_("Display Options:\n"
+ " -f, --fullscreen Run in fullscreen mode.\n"
+ " -w, --window Run in window mode.\n"
+ " --opengl If OpenGL support was compiled in, this will tell\n"
+ " SuperTux to make use of it.\n"
+ " --sdl Use the SDL software graphical renderer\n"
"\n"
"Sound Options:\n"
" --disable-sound If sound support was compiled in, this will\n"
" options, license and game controls.\n"
" --usage Display a brief message summarizing command-line options.\n"
" --version Display the version of SuperTux you're running.\n\n"
- );
+ ));
exit(0);
}
else if (argv[i][0] != '-')
/* Display the usage message: */
- fprintf(fi, "Usage: %s [--fullscreen] [--opengl] [--disable-sound] [--disable-music] [--debug-mode] | [--usage | --help | --version] [--leveleditor] FILENAME\n",
+ fprintf(fi, _("Usage: %s [--fullscreen] [--opengl] [--disable-sound] [--disable-music] [--debug-mode] | [--usage | --help | --version] [--leveleditor] FILENAME\n"),
prog);
exit(ret);
}
+std::vector<std::string> read_directory(const std::string& pathname)
+{
+ std::vector<std::string> dirnames;
+
+ DIR* dir = opendir(pathname.c_str());
+ if (dir)
+ {
+ struct dirent *direntp;
+
+ while((direntp = readdir(dir)))
+ {
+ dirnames.push_back(direntp->d_name);
+ }
+
+ closedir(dir);
+ }
+
+ return dirnames;
+}
+
+/* EOF */