#define DATA_PREFIX "./data/"
#endif
-/* Screen proprities: */
-/* Don't use this to test for the actual screen sizes. Use screen->w/h instead! */
-#define SCREEN_W 800
-#define SCREEN_H 600
-
/* Local function prototypes: */
void seticon(void);
free(strings[i]);
}
+void SuperTux::st_info_setup(const std::string& _package_name, const std::string& _package_symbol_name, const std::string& _package_version)
+{
+package_name = _package_name;
+package_symbol_name = _package_symbol_name;
+package_version = _package_version;
+}
+
/* --- SETUP --- */
/* Set SuperTux configuration and save directories */
void SuperTux::st_directory_setup(void)
else
home = ".";
+ std::string st_dir_tmp = "/." + package_symbol_name;
st_dir = (char *) malloc(sizeof(char) * (strlen(home) +
- strlen("/.supertux") + 1));
+ strlen(st_dir_tmp.c_str()) + 1));
strcpy(st_dir, home);
- strcat(st_dir, "/.supertux");
+ strcat(st_dir,st_dir_tmp.c_str());
/* Remove .supertux config-file from old SuperTux versions */
if(faccessible(st_dir))
datadir = exedir + "../data"; // SuperTux run from source dir
if (access(datadir.c_str(), F_OK) != 0)
{
- datadir = exedir + "../share/supertux"; // SuperTux run from PATH
+ datadir = exedir + "../share/" + package_symbol_name; // SuperTux run from PATH
if (access(datadir.c_str(), F_OK) != 0)
{ // If all fails, fall back to compiled path
datadir = DATA_PREFIX;
}
-void SuperTux::st_video_setup(void)
+void SuperTux::st_video_setup(unsigned int screen_w, unsigned int screen_h)
{
/* Init SDL Video: */
if (SDL_Init(SDL_INIT_VIDEO) < 0)
/* Open display: */
if(use_gl)
- st_video_setup_gl();
+ st_video_setup_gl(screen_w, screen_h);
else
- st_video_setup_sdl();
+ st_video_setup_sdl(screen_w, screen_h);
Surface::reload_all();
/* Set window manager stuff: */
- SDL_WM_SetCaption("SuperTux " VERSION, "SuperTux");
+ SDL_WM_SetCaption((package_name + " " + package_version).c_str(), package_name.c_str());
}
-void SuperTux::st_video_setup_sdl(void)
+void SuperTux::st_video_setup_sdl(unsigned int screen_w, unsigned int screen_h)
{
if (use_fullscreen)
{
- screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */
+ screen = SDL_SetVideoMode(screen_w, screen_h, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */
if (screen == NULL)
{
fprintf(stderr,
}
else
{
- screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_HWSURFACE | SDL_DOUBLEBUF );
+ screen = SDL_SetVideoMode(screen_w, screen_h, 0, SDL_HWSURFACE | SDL_DOUBLEBUF );
if (screen == NULL)
{
}
}
-void SuperTux::st_video_setup_gl(void)
+void SuperTux::st_video_setup_gl(unsigned int screen_w, unsigned int screen_h)
{
#ifndef NOOPENGL
if (use_fullscreen)
{
- screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_FULLSCREEN | SDL_OPENGL) ; /* | SDL_HWSURFACE); */
+ screen = SDL_SetVideoMode(screen_w, screen_h, 0, SDL_FULLSCREEN | SDL_OPENGL) ; /* | SDL_HWSURFACE); */
if (screen == NULL)
{
fprintf(stderr,
}
else
{
- screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_OPENGL);
+ screen = SDL_SetVideoMode(screen_w, screen_h, 0, SDL_OPENGL);
if (screen == NULL)
{
/* Load icon into a surface: */
- icon = IMG_Load((datadir + "/images/supertux.xpm").c_str());
+ icon = IMG_Load((datadir + "/images/" + package_symbol_name + ".xpm").c_str());
if (icon == NULL)
{
fprintf(stderr,
"\nError: I could not load the icon image: %s%s\n"
"The Simple DirectMedia error that occured was:\n"
- "%s\n\n", datadir.c_str(), "/images/supertux.xpm", SDL_GetError());
+ "%s\n\n", datadir.c_str(), ("/images/" + package_symbol_name + ".xpm").c_str(), SDL_GetError());
exit(1);
}
else if (strcmp(argv[i], "--version") == 0)
{
/* Show version: */
- printf("SuperTux " VERSION "\n");
+ printf((package_name + package_version + "\n").c_str() );
exit(0);
}
else if (strcmp(argv[i], "--disable-sound") == 0)
string_list_type dsubdirs(const char *rel_path, const char* expected_file);
string_list_type dfiles(const char *rel_path, const char* glob, const char* exception_str);
void free_strings(char **strings, int num);
+void st_info_setup(const std::string& _package_name, const std::string& _package_symbol_name, const std::string& _package_version);
void st_directory_setup(void);
void st_general_setup(void);
void st_general_free();
-void st_video_setup_sdl(void);
-void st_video_setup_gl(void);
-void st_video_setup(void);
+void st_video_setup_sdl(unsigned int screen_w, unsigned int screen_h);
+void st_video_setup_gl(unsigned int screen_w, unsigned int screen_h);
+void st_video_setup(unsigned int screen_w, unsigned int screen_h);
void st_audio_setup(void);
void st_joystick_setup(void);
void st_shutdown(void);