return sdirs;
}
+std::string FileSystem::dirname(const std::string& filename)
+{
+ std::string::size_type p = filename.find_last_of('/');
+ if(p == std::string::npos)
+ return "";
+
+ return filename.substr(0, p+1);
+}
+
void Setup::init(const std::string& _package_name,
const std::string& _package_symbol_name,
const std::string& _package_version)
// try current directory as datadir
if(datadir.empty()) {
- if(FileSystem::faccessible("./data/intro.txt"))
+ if(FileSystem::faccessible("./data/credits.txt"))
datadir = "./data/";
}
{
std::string exedir = std::string(dirname(exe_file)) + "/";
- datadir = exedir + "../data/"; // SuperTux run from source dir
+ datadir = exedir + "./data/"; // SuperTux run from source dir
if (access(datadir.c_str(), F_OK) != 0)
{
- datadir = exedir + "../../data/"; //SuperTux run from source dir (with libtool script)
+ datadir = exedir + "../../../../data/"; //SuperTux run from source dir (with libtool script)
if (access(datadir.c_str(), F_OK) != 0)
{
glViewport(0, 0, screen->w, screen->h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glOrtho(0, screen->w, screen->h, 0, -1.0, 1.0);
+ glOrtho(0, 800, 600, 0, -1.0, 1.0);
+ //glOrtho(0, 800SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
{
use_fullscreen = false;
}
+ else if (strcmp(argv[i], "--geometry") == 0 ||
+ strcmp(argv[i], "-g") == 0)
+ {
+ assert(i+1 < argc);
+ if (sscanf(argv[++i],
+ "%dx%d", &screen_width, &screen_height) != 2)
+ {
+ puts("Warning: Invalid geometry spec, should be \"WIDTHxHEIGHT\"");
+ }
+ }
else if (strcmp(argv[i], "--joystick") == 0 || strcmp(argv[i], "-j") == 0)
{
assert(i+1 < argc);
else if (strcmp(argv[i], "--show-fps") == 0)
{
/* Use full screen: */
-
show_fps = true;
}
else if (strcmp(argv[i], "--opengl") == 0 ||
{
#ifndef NOOPENGL
/* Use OpengGL: */
-
use_gl = true;
#endif
}
else if (strcmp(argv[i], "--usage") == 0)
{
/* Show usage: */
-
usage(argv[0], 0);
}
else if (strcmp(argv[i], "--version") == 0)
" --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"
+ " --geometry WIDTHxHEIGHT Run SuperTux in the given resolution\n"
"\n"
"Sound Options:\n"
" --disable-sound If sound support was compiled in, this will\n"
/* Display the usage message: */
- fprintf(fi, _("Usage: %s [--fullscreen] [--opengl] [--disable-sound] [--disable-music] [--debug] | [--usage | --help | --version] [--leveleditor] [--worldmap] [--flip-levels] FILENAME\n"),
+ fprintf(fi, _("Usage: %s [--fullscreen] [--opengl] [--geometry WIDTHxHEIGHT] [--disable-sound] [--disable-music] [--debug] | [--usage | --help | --version] [--leveleditor] [--worldmap] [--flip-levels] FILENAME\n"),
prog);