#include <cctype>
-#include "app/globals.h"
-#include "app/defines.h"
-#include "app/setup.h"
-#include "video/screen.h"
-#include "video/surface.h"
-#include "gui/menu.h"
-#include "utils/configfile.h"
-#include "audio/sound_manager.h"
-#include "app/gettext.h"
-
+#include "../app/globals.h"
+#include "../app/defines.h"
+#include "../app/setup.h"
+#include "../video/screen.h"
+#include "../video/surface.h"
+#include "../gui/menu.h"
+#include "../utils/configfile.h"
+#include "../audio/sound_manager.h"
+#include "../app/gettext.h"
+
+using namespace SuperTux;
#ifdef WIN32
#define mkdir(dir, mode) mkdir(dir)
void usage(char * prog, int ret);
/* Does the given file exist and is it accessible? */
-int faccessible(const char *filename)
+int SuperTux::faccessible(const char *filename)
{
struct stat filestat;
if (stat(filename, &filestat) == -1)
}
/* Can we write to this location? */
-int fwriteable(const char *filename)
+int SuperTux::fwriteable(const char *filename)
{
FILE* fi;
fi = fopen(filename, "wa");
}
/* Makes sure a directory is created in either the SuperTux home directory or the SuperTux base directory.*/
-int fcreatedir(const char* relative_dir)
+int SuperTux::fcreatedir(const char* relative_dir)
{
char path[1024];
snprintf(path, 1024, "%s/%s/", st_dir, relative_dir);
}
}
-FILE * opendata(const char * rel_filename, const char * mode)
+FILE * SuperTux::opendata(const char * rel_filename, const char * mode)
{
char * filename = NULL;
FILE * fi;
/* Get all names of sub-directories in a certain directory. */
/* Returns the number of sub-directories found. */
/* Note: The user has to free the allocated space. */
-string_list_type dsubdirs(const char *rel_path,const char* expected_file)
+string_list_type SuperTux::dsubdirs(const char *rel_path,const char* expected_file)
{
DIR *dirStructP;
struct dirent *direntp;
return sdirs;
}
-string_list_type dfiles(const char *rel_path, const char* glob, const char* exception_str)
+string_list_type SuperTux::dfiles(const char *rel_path, const char* glob, const char* exception_str)
{
DIR *dirStructP;
struct dirent *direntp;
return sdirs;
}
-void free_strings(char **strings, int num)
+void SuperTux::free_strings(char **strings, int num)
{
int i;
for(i=0; i < num; ++i)
/* --- SETUP --- */
/* Set SuperTux configuration and save directories */
-void st_directory_setup(void)
+void SuperTux::st_directory_setup(void)
{
char *home;
char str[1024];
printf("Datadir: %s\n", datadir.c_str());
}
-void st_general_setup(void)
+void SuperTux::st_general_setup(void)
{
/* Seed random number generator: */
}
-void st_general_free(void)
+void SuperTux::st_general_free(void)
{
/* Free global images: */
/* Free mouse-cursor */
delete mouse_cursor;
- /* Free menus */
- 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 save_game_menu;
- delete load_game_menu;
}
-void st_video_setup(void)
+void SuperTux::st_video_setup(void)
{
/* Init SDL Video: */
if (SDL_Init(SDL_INIT_VIDEO) < 0)
SDL_WM_SetCaption("SuperTux " VERSION, "SuperTux");
}
-void st_video_setup_sdl(void)
+void SuperTux::st_video_setup_sdl(void)
{
if (use_fullscreen)
{
}
}
-void st_video_setup_gl(void)
+void SuperTux::st_video_setup_gl(void)
{
#ifndef NOOPENGL
}
-void st_joystick_setup(void)
+void SuperTux::st_joystick_setup(void)
{
/* Init Joystick: */
}
}
-void st_audio_setup(void)
+void SuperTux::st_audio_setup(void)
{
/* Init SDL Audio silently even if --disable-sound : */
/* --- SHUTDOWN --- */
-void st_shutdown(void)
+void SuperTux::st_shutdown(void)
{
close_audio();
SDL_Quit();
/* --- ABORT! --- */
-void st_abort(const std::string& reason, const std::string& details)
+void SuperTux::st_abort(const std::string& reason, const std::string& details)
{
fprintf(stderr, "\nError: %s\n%s\n\n", reason.c_str(), details.c_str());
st_shutdown();
/* Parse command-line arguments: */
-void parseargs(int argc, char * argv[])
+void SuperTux::parseargs(int argc, char * argv[])
{
int i;
exit(ret);
}
-std::vector<std::string> read_directory(const std::string& pathname)
+std::vector<std::string> SuperTux::read_directory(const std::string& pathname)
{
std::vector<std::string> dirnames;