#include <SDL_image.h>
#include <physfs.h>
#include <iostream>
+#include <binreloc.h>
+#include <tinygettext/log.hpp>
#ifdef MACOSX
namespace supertux_apple {
} // namespace supertux_apple
#endif
-#include "tinygettext/log.hpp"
-
#include "addon/addon_manager.hpp"
#include "audio/sound_manager.hpp"
-#include "binreloc/binreloc.h"
#include "control/joystickkeyboardcontroller.hpp"
#include "math/random_generator.hpp"
#include "physfs/ifile_stream.hpp"
}
}
- void
+void
Main::init_physfs(const char* argv0)
{
if(!PHYSFS_init(argv0)) {
void
Main::print_usage(const char* argv0)
{
- fprintf(stderr, _("Usage: %s [OPTIONS] [LEVELFILE]\n\n"), argv0);
- fprintf(stderr,
- _("Options:\n"
- " -f, --fullscreen Run in fullscreen mode\n"
- " -w, --window Run in window mode\n"
- " -g, --geometry WIDTHxHEIGHT Run SuperTux in given resolution\n"
- " -a, --aspect WIDTH:HEIGHT Run SuperTux with given aspect ratio\n"
- " -d, --default Reset video settings to default values\n"
- " --renderer RENDERER Use sdl, opengl, or auto to render\n"
- " --disable-sfx Disable sound effects\n"
- " --disable-music Disable music\n"
- " -h, --help Show this help message and quit\n"
- " -v, --version Show SuperTux version and quit\n"
- " --console Enable ingame scripting console\n"
- " --noconsole Disable ingame scripting console\n"
- " --show-fps Display framerate in levels\n"
- " --no-show-fps Do not display framerate in levels\n"
- " --record-demo FILE LEVEL Record a demo to FILE\n"
- " --play-demo FILE LEVEL Play a recorded demo\n"
- " -s, --debug-scripts Enable script debugger.\n"
- "%s\n"), "");
+ std::cerr << _("Usage: ") << argv0 << _(" [OPTIONS] [LEVELFILE]\n\n")
+ << _("Options:\n"
+ " -f, --fullscreen Run in fullscreen mode\n"
+ " -w, --window Run in window mode\n"
+ " -g, --geometry WIDTHxHEIGHT Run SuperTux in given resolution\n"
+ " -a, --aspect WIDTH:HEIGHT Run SuperTux with given aspect ratio\n"
+ " -d, --default Reset video settings to default values\n"
+ " --renderer RENDERER Use sdl, opengl, or auto to render\n"
+ " --disable-sfx Disable sound effects\n"
+ " --disable-music Disable music\n"
+ " -h, --help Show this help message and quit\n"
+ " -v, --version Show SuperTux version and quit\n"
+ " --console Enable ingame scripting console\n"
+ " --noconsole Disable ingame scripting console\n"
+ " --show-fps Display framerate in levels\n"
+ " --no-show-fps Do not display framerate in levels\n"
+ " --record-demo FILE LEVEL Record a demo to FILE\n"
+ " --play-demo FILE LEVEL Play a recorded demo\n"
+ " -s, --debug-scripts Enable script debugger.\n"
+ "\n")
+ << std::flush;
}
/**
} else if(arg == "--default" || arg == "-d") {
g_config->use_fullscreen = false;
- g_config->window_width = 800;
- g_config->window_height = 600;
-
- g_config->fullscreen_width = 800;
- g_config->fullscreen_height = 600;
-
- g_config->aspect_width = 0; // auto detect
- g_config->aspect_height = 0;
+ g_config->window_size = Size(800, 600);
+ g_config->fullscreen_size = Size(800, 600);
+ g_config->aspect_size = Size(0, 0); // auto detect
} else if(arg == "--window" || arg == "-w") {
g_config->use_fullscreen = false;
}
else
{
- g_config->window_width = width;
- g_config->window_height = height;
-
- g_config->fullscreen_width = width;
- g_config->fullscreen_height = height;
+ g_config->window_size = Size(width, height);
+ g_config->fullscreen_size = Size(width, height);
}
}
} else if(arg == "--aspect" || arg == "-a") {
}
else
{
- float aspect_ratio = static_cast<double>(g_config->aspect_width) /
- static_cast<double>(g_config->aspect_height);
+ float aspect_ratio = static_cast<float>(aspect_width) / static_cast<float>(aspect_height);
// use aspect ratio to calculate logical resolution
if (aspect_ratio > 1) {
- g_config->aspect_width = static_cast<int> (600 * aspect_ratio + 0.5);
- g_config->aspect_height = 600;
+ g_config->aspect_size = Size(static_cast<int>(600 * aspect_ratio + 0.5),
+ 600);
} else {
- g_config->aspect_width = 600;
- g_config->aspect_height = static_cast<int> (600 * 1/aspect_ratio + 0.5);
+ g_config->aspect_size = Size(600,
+ static_cast<int>(600 * 1/aspect_ratio + 0.5));
}
}
}
SDL_ShowCursor(0);
log_info << (g_config->use_fullscreen?"fullscreen ":"window ")
- << " Window: " << g_config->window_width << "x" << g_config->window_height
- << " Fullscreen: " << g_config->fullscreen_width << "x" << g_config->fullscreen_height
- << " Area: " << g_config->aspect_width << "x" << g_config->aspect_height << std::endl;
+ << " Window: " << g_config->window_size
+ << " Fullscreen: " << g_config->fullscreen_size
+ << " Area: " << g_config->aspect_size << std::endl;
}
void