X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=lib%2Fapp%2Fsetup.h;h=ad70bd4d81bb2eb5ef33a5f291d4149ded7af73c;hb=8e0bad9f82ccbc811a18edd7ce6c6f69c5bca082;hp=53a8b17c3e8c70911e9bc11dcdee0d192fbdee29;hpb=edaacb3651cf0560314dd008d7243be4b3b2f8c6;p=supertux.git diff --git a/lib/app/setup.h b/lib/app/setup.h index 53a8b17c3..ad70bd4d8 100644 --- a/lib/app/setup.h +++ b/lib/app/setup.h @@ -21,36 +21,49 @@ #define SUPERTUX_SETUP_H #include +#include #include -#include "gui/menu.h" -#include "audio/sound.h" -#include "special/base.h" namespace SuperTux { -int faccessible(const char *filename); -int fcreatedir(const char* relative_dir); -int fwriteable(const char *filename); -std::vector read_directory(const std::string& pathname); - -FILE * opendata(const char * filename, const char * mode); -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_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_audio_setup(void); -void st_joystick_setup(void); -void st_shutdown(void); -void st_abort(const std::string& reason, const std::string& details); - -void parseargs(int argc, char * argv[]); - -} +/// File system utility functions +struct FileSystem + { + static bool faccessible(const std::string& filename); + static bool fcreatedir(const std::string& relative_dir); + static bool fwriteable(const std::string& filename); + static std::set read_directory(const std::string& pathname); + static std::set dsubdirs(const std::string& rel_path, const std::string& expected_file); + static std::set dfiles(const std::string& rel_path, const std::string& glob, const std::string& exception_str); + + static std::string dirname(const std::string& filename); + }; + +/// All you need to get an application up and running +struct Setup + { + static void init(const std::string& _package_name, const std::string& _package_symbol_name, const std::string& _package_version); + static void directories(void); + static void general(void); + static void general_free(); + static void video(unsigned int screen_w, unsigned int screen_h); + static void audio(void); + static void joystick(void); + static void parseargs(int argc, char * argv[]); + + private: + static void video_sdl(unsigned int screen_w, unsigned int screen_h); + static void video_gl(unsigned int screen_w, unsigned int screen_h); + }; + +/// Termination handling +struct Termination + { + static void shutdown(void); + static void abort(const std::string& reason, const std::string& details); + }; + +} //namespace SuperTux #endif /*SUPERTUX_SETUP_H*/