super-tux-commit Mailing List for Super Tux (Page 46)
Brought to you by:
wkendrick
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(94) |
Apr
(500) |
May
(531) |
Jun
(196) |
Jul
(224) |
Aug
(193) |
Sep
(117) |
Oct
(115) |
Nov
(319) |
Dec
(97) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(19) |
Feb
|
Mar
(105) |
Apr
(41) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
2007 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
(7) |
Oct
(12) |
Nov
(26) |
Dec
(39) |
2009 |
Jan
(6) |
Feb
(15) |
Mar
(10) |
Apr
(25) |
May
(29) |
Jun
(21) |
Jul
(26) |
Aug
(8) |
Sep
(3) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(5) |
Feb
(5) |
Mar
(2) |
Apr
|
May
(5) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
(2) |
Nov
|
Dec
|
From: Tobias G. <to...@us...> - 2004-07-25 19:04:21
|
Update of /cvsroot/super-tux/supertux/lib/audio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31225/lib/audio Modified Files: sound_manager.cpp sound_manager.h Removed Files: sound.cpp sound.h Log Message: - Major changes in Setup-API. - Moved all sound handling into SoundManager, which became a singleton. Index: sound_manager.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/sound_manager.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sound_manager.cpp 22 Jul 2004 19:07:50 -0000 1.3 +++ sound_manager.cpp 25 Jul 2004 19:03:34 -0000 1.4 @@ -22,15 +22,16 @@ #include "../audio/sound_manager.h" #include "../audio/musicref.h" -#include "../audio/sound.h" #include "../app/globals.h" #include "../app/setup.h" #include "../special/moving_object.h" using namespace SuperTux; +SoundManager* SoundManager::instance_ = 0; + SoundManager::SoundManager() - : current_music(0), music_enabled(true) + : current_music(0), m_music_enabled(true) , m_sound_enabled(true) , audio_device(true) { } @@ -38,12 +39,15 @@ { if(audio_device) Mix_HaltMusic(); + +sounds.clear(); +destroy_instance(); } void SoundManager::play_sound(Mix_Chunk* sound) { - if(!audio_device || !use_sound) + if(!audio_device || !m_sound_enabled) return; Mix_PlayChannel(-1, sound, 0); @@ -60,7 +64,7 @@ void SoundManager::play_sound(Mix_Chunk* sound, const Vector& pos, const Vector& pos2) { - if(!audio_device || !use_sound) + if(!audio_device || !m_sound_enabled) return; // TODO make sure this formula is good @@ -89,7 +93,7 @@ return MusicRef(0); if(!exists_music(file)) - st_abort("Couldn't load musicfile ", file.c_str()); + Termination::abort("Couldn't load musicfile ", file.c_str()); std::map<std::string, MusicResource>::iterator i = musics.find(file); assert(i != musics.end()); @@ -145,7 +149,7 @@ current_music = musicref.music; current_music->refcount++; - if(music_enabled) + if(m_music_enabled) Mix_PlayMusic(current_music->music, loops); } @@ -171,20 +175,79 @@ if(!audio_device) return; - if(enable == music_enabled) + if(enable == m_music_enabled) return; - music_enabled = enable; - if(music_enabled == false) { + m_music_enabled = enable; + if(m_music_enabled == false) { Mix_HaltMusic(); } else { Mix_PlayMusic(current_music->music, -1); } } +void +SoundManager::enable_sound(bool enable) +{ + if(!audio_device) + return; + + m_sound_enabled = enable; +} + SoundManager::MusicResource::~MusicResource() { // don't free music buggy SDL_Mixer crashs for some mod files // Mix_FreeMusic(music); } +/* --- LOAD A SOUND --- */ + +Mix_Chunk* SoundManager::load_sound(const std::string& file) +{ + if(!audio_device) + return 0; + + Mix_Chunk* snd = Mix_LoadWAV(file.c_str()); + + /*if (snd == 0) + Termination::abort("Can't load", file);*/ + + return(snd); +} + +void SoundManager::free_chunk(Mix_Chunk *chunk) +{ + Mix_FreeChunk( chunk ); +} + + +/* --- OPEN THE AUDIO DEVICE --- */ + +int SoundManager::open_audio (int frequency, Uint16 format, int channels, int chunksize) +{ + if (Mix_OpenAudio( frequency, format, channels, chunksize ) < 0) + return -1; + + // allocate 16 channels for mixing + if (Mix_AllocateChannels(8) != 8) + return -2; + + return 0; +} + + +/* --- CLOSE THE AUDIO DEVICE --- */ + +void SoundManager::close_audio( void ) +{ + if (audio_device) { + Mix_CloseAudio(); + } +} + +Mix_Chunk* SuperTux::IDToSound(int id) +{ + return SoundManager::get()->sounds[id]; +} + --- sound.h DELETED --- Index: sound_manager.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/sound_manager.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- sound_manager.h 22 Jul 2004 19:07:50 -0000 1.5 +++ sound_manager.h 25 Jul 2004 19:03:34 -0000 1.6 @@ -21,6 +21,7 @@ #define SUPERTUX_SOUND_MANAGER_H #include <string> +#include <vector> #include <map> #include "SDL_mixer.h" @@ -32,14 +33,20 @@ class MusicRef; class MovingObject; + /// enum of different internal music types + enum Music_Type { + NO_MUSIC, + LEVEL_MUSIC, + HURRYUP_MUSIC, + HERRING_MUSIC + }; + /// Sound manager /** This class handles all sounds that are played */ class SoundManager { public: - SoundManager(); - ~SoundManager(); /// Play sound. void play_sound(Mix_Chunk* sound); @@ -47,10 +54,14 @@ void play_sound(Mix_Chunk* sound, const Vector& pos, const Vector& pos2); /// Play sound relative to a MovingObject and a Vector. void play_sound(Mix_Chunk* sound, const MovingObject* object, const Vector& pos); - + /// Load music. /** Is used to load the music for a MusicRef. */ MusicRef load_music(const std::string& file); + + /// Load sound. + Mix_Chunk * load_sound(const std::string& file); + /// Test if a certain music file exists. bool exists_music(const std::string& filename); @@ -64,9 +75,68 @@ /// Enable/Disable music. void enable_music(bool enable); + /// Is music enabled? + bool music_enabled() + { + return m_music_enabled; + } + + /// Enable/Disable sound. + void enable_sound(bool enable); + + /// Is sound enabled? + bool sound_enabled() + { + return m_sound_enabled; + } + + /* functions handling the sound and music */ + int open_audio(int frequency, Uint16 format, int channels, int chunksize); + void close_audio( void ); + + /// Is audio available? + bool audio_device_available() + { + return audio_device; + } + + void set_audio_device_available(bool available) + { + audio_device = available; + } + + static SoundManager* get() + { + return instance_ ? instance_ : instance_ = new SoundManager(); + } + static void destroy_instance() + { + delete instance_; + instance_ = 0; + } + + void add_sound(Mix_Chunk* sound, int id) + { + sounds[id] = sound; + } + + Mix_Chunk* get_sound(int id) + { + return sounds[id]; + } + private: + SoundManager(); + ~SoundManager(); + // music part friend class MusicRef; + friend class Setup; + friend Mix_Chunk* IDToSound(int id); + + static SoundManager* instance_ ; + + void free_chunk(Mix_Chunk* chunk); /// Resource for music. /** Contains the raw music data and @@ -84,12 +154,18 @@ void free_music(MusicResource* music); + /*variables for stocking the sound and music*/ + std::map<int, Mix_Chunk*> sounds; std::map<std::string, MusicResource> musics; MusicResource* current_music; - bool music_enabled; + bool m_music_enabled; + bool m_sound_enabled; + bool audio_device; /* != 0: available and initialized */ + }; + Mix_Chunk* IDToSound(int id); + } // namespace SuperTux - #endif /*SUPERTUX_SOUND_MANAGER_H*/ --- sound.cpp DELETED --- |
From: Tobias G. <to...@us...> - 2004-07-25 19:04:21
|
Update of /cvsroot/super-tux/supertux/lib/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31225/lib/app Modified Files: setup.cpp setup.h Log Message: - Major changes in Setup-API. - Moved all sound handling into SoundManager, which became a singleton. Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- setup.cpp 24 Jul 2004 11:50:09 -0000 1.4 +++ setup.cpp 25 Jul 2004 19:03:34 -0000 1.5 @@ -66,7 +66,7 @@ void usage(char * prog, int ret); /* Does the given file exist and is it accessible? */ -int SuperTux::faccessible(const char *filename) +int FileSystem::faccessible(const char *filename) { struct stat filestat; if (stat(filename, &filestat) == -1) @@ -83,7 +83,7 @@ } /* Can we write to this location? */ -int SuperTux::fwriteable(const char *filename) +int FileSystem::fwriteable(const char *filename) { FILE* fi; fi = fopen(filename, "wa"); @@ -95,7 +95,7 @@ } /* Makes sure a directory is created in either the SuperTux home directory or the SuperTux base directory.*/ -int SuperTux::fcreatedir(const char* relative_dir) +int FileSystem::fcreatedir(const char* relative_dir) { char path[1024]; snprintf(path, 1024, "%s/%s/", st_dir, relative_dir); @@ -117,40 +117,10 @@ } } -FILE * SuperTux::opendata(const char * rel_filename, const char * mode) -{ - char * filename = NULL; - FILE * fi; - - filename = (char *) malloc(sizeof(char) * (strlen(st_dir) + - strlen(rel_filename) + 1)); - - strcpy(filename, st_dir); - /* Open the high score file: */ - - strcat(filename, rel_filename); - - /* Try opening the file: */ - fi = fopen(filename, mode); - - if (fi == NULL) - { - fprintf(stderr, "Warning: Unable to open the file \"%s\" ", filename); - - if (strcmp(mode, "r") == 0) - fprintf(stderr, "for read!!!\n"); - else if (strcmp(mode, "w") == 0) - fprintf(stderr, "for write!!!\n"); - } - free( filename ); - - return(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 SuperTux::dsubdirs(const char *rel_path,const char* expected_file) +string_list_type FileSystem::dsubdirs(const char *rel_path,const char* expected_file) { DIR *dirStructP; struct dirent *direntp; @@ -220,7 +190,7 @@ return sdirs; } -string_list_type SuperTux::dfiles(const char *rel_path, const char* glob, const char* exception_str) +string_list_type FileSystem::dfiles(const char *rel_path, const char* glob, const char* exception_str) { DIR *dirStructP; struct dirent *direntp; @@ -285,14 +255,7 @@ return sdirs; } -void SuperTux::free_strings(char **strings, int num) -{ - int i; - for(i=0; i < num; ++i) - free(strings[i]); -} - -void SuperTux::st_info_setup(const std::string& _package_name, const std::string& _package_symbol_name, const std::string& _package_version) +void Setup::info(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; @@ -301,7 +264,7 @@ /* --- SETUP --- */ /* Set SuperTux configuration and save directories */ -void SuperTux::st_directory_setup(void) +void Setup::directories(void) { char *home; char str[1024]; @@ -319,7 +282,7 @@ strcat(st_dir,st_dir_tmp.c_str()); /* Remove .supertux config-file from old SuperTux versions */ - if(faccessible(st_dir)) + if(FileSystem::faccessible(st_dir)) { remove (st_dir); @@ -369,7 +332,7 @@ printf("Datadir: %s\n", datadir.c_str()); } -void SuperTux::st_general_setup(void) +void Setup::general(void) { /* Seed random number generator: */ @@ -410,7 +373,7 @@ } -void SuperTux::st_general_free(void) +void Setup::general_free(void) { /* Free global images: */ @@ -434,7 +397,7 @@ } -void SuperTux::st_video_setup(unsigned int screen_w, unsigned int screen_h) +void Setup::video(unsigned int screen_w, unsigned int screen_h) { /* Init SDL Video: */ if (SDL_Init(SDL_INIT_VIDEO) < 0) @@ -448,9 +411,9 @@ /* Open display: */ if(use_gl) - st_video_setup_gl(screen_w, screen_h); + video_gl(screen_w, screen_h); else - st_video_setup_sdl(screen_w, screen_h); + video_sdl(screen_w, screen_h); Surface::reload_all(); @@ -458,7 +421,7 @@ SDL_WM_SetCaption((package_name + " " + package_version).c_str(), package_name.c_str()); } -void SuperTux::st_video_setup_sdl(unsigned int screen_w, unsigned int screen_h) +void Setup::video_sdl(unsigned int screen_w, unsigned int screen_h) { if (use_fullscreen) { @@ -488,7 +451,7 @@ } } -void SuperTux::st_video_setup_gl(unsigned int screen_w, unsigned int screen_h) +void Setup::video_gl(unsigned int screen_w, unsigned int screen_h) { #ifndef NOOPENGL @@ -544,7 +507,7 @@ } -void SuperTux::st_joystick_setup(void) +void Setup::joystick(void) { /* Init Joystick: */ @@ -605,19 +568,19 @@ } } -void SuperTux::st_audio_setup(void) +void Setup::audio(void) { /* Init SDL Audio silently even if --disable-sound : */ - if (audio_device) + if (SoundManager::get()->audio_device_available()) { if (SDL_Init(SDL_INIT_AUDIO) < 0) { /* only print out message if sound or music was not disabled at command-line */ - if (use_sound || use_music) + if (SoundManager::get()->sound_enabled() || SoundManager::get()->music_enabled()) { fprintf(stderr, "\nWarning: I could not initialize audio!\n" @@ -628,23 +591,23 @@ because in this case, use_sound & use_music' values are ignored when there's no available audio device */ - use_sound = false; - use_music = false; - audio_device = false; + SoundManager::get()->enable_sound(false); + SoundManager::get()->enable_music(false); + SoundManager::get()->set_audio_device_available(false); } } /* Open sound silently regarless the value of "use_sound": */ - if (audio_device) + if (SoundManager::get()->audio_device_available()) { - if (open_audio(44100, AUDIO_S16, 2, 2048) < 0) + if (SoundManager::get()->open_audio(44100, AUDIO_S16, 2, 2048) < 0) { /* only print out message if sound or music was not disabled at command-line */ - if (use_sound || use_music) + if (SoundManager::get()->sound_enabled() || SoundManager::get()->music_enabled()) { fprintf(stderr, "\nWarning: I could not set up audio for 44100 Hz " @@ -652,9 +615,9 @@ "The Simple DirectMedia error that occured was:\n" "%s\n\n", SDL_GetError()); } - use_sound = false; - use_music = false; - audio_device = false; + SoundManager::get()->enable_sound(false); + SoundManager::get()->enable_music(false); + SoundManager::get()->set_audio_device_available(false); } } @@ -663,20 +626,20 @@ /* --- SHUTDOWN --- */ -void SuperTux::st_shutdown(void) +void Termination::shutdown(void) { - close_audio(); + SoundManager::get()->close_audio(); SDL_Quit(); config->save(); } /* --- ABORT! --- */ -void SuperTux::st_abort(const std::string& reason, const std::string& details) +void Termination::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(); - abort(); + shutdown(); + ::abort(); } /* Set Icon (private) */ @@ -722,7 +685,7 @@ /* Parse command-line arguments: */ -void SuperTux::parseargs(int argc, char * argv[]) +void Setup::parseargs(int argc, char * argv[]) { int i; @@ -819,14 +782,13 @@ { /* Disable the compiled in sound feature */ printf("Sounds disabled \n"); - use_sound = false; - audio_device = false; + SoundManager::get()->enable_sound(false); } else if (strcmp(argv[i], "--disable-music") == 0) { /* Disable the compiled in sound feature */ printf("Music disabled \n"); - use_music = false; + SoundManager::get()->enable_music(false); } else if (strcmp(argv[i], "--debug") == 0) { @@ -906,7 +868,7 @@ exit(ret); } -std::vector<std::string> SuperTux::read_directory(const std::string& pathname) +std::vector<std::string> FileSystem::read_directory(const std::string& pathname) { std::vector<std::string> dirnames; Index: setup.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- setup.h 24 Jul 2004 11:50:09 -0000 1.4 +++ setup.h 25 Jul 2004 19:03:34 -0000 1.5 @@ -23,35 +23,44 @@ #include <vector> #include <string> #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<std::string> 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_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(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); -void st_abort(const std::string& reason, const std::string& details); +/// File system utility functions +struct FileSystem + { + static int faccessible(const char *filename); + static int fcreatedir(const char* relative_dir); + static int fwriteable(const char *filename); + static std::vector<std::string> read_directory(const std::string& pathname); + static string_list_type dsubdirs(const char *rel_path, const char* expected_file); + static string_list_type dfiles(const char *rel_path, const char* glob, const char* exception_str); + }; -void parseargs(int argc, char * argv[]); +/// All you need to get an application up and running +struct Setup + { + static void info(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_sdl(unsigned int screen_w, unsigned int screen_h); + static void video_gl(unsigned int screen_w, unsigned int screen_h); + 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[]); + }; -} +/// 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*/ |
From: Tobias G. <to...@us...> - 2004-07-25 19:04:20
|
Update of /cvsroot/super-tux/supertux/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31225/lib Modified Files: Makefile.am Log Message: - Major changes in Setup-API. - Moved all sound handling into SoundManager, which became a singleton. Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 22 Jul 2004 19:04:45 -0000 1.2 +++ Makefile.am 25 Jul 2004 19:03:33 -0000 1.3 @@ -4,7 +4,6 @@ libsupertux_la_SOURCES =app/globals.cpp \ app/setup.cpp \ audio/musicref.cpp \ - audio/sound.cpp \ audio/sound_manager.cpp \ gui/button.cpp \ gui/menu.cpp \ @@ -37,7 +36,6 @@ app/gettext.h \ app/globals.h libsupertuxaudio_HEADERS =audio/musicref.h \ - audio/sound.h \ audio/sound_manager.h libsupertuxgui_HEADERS =gui/button.h \ gui/menu.h \ @@ -61,3 +59,4 @@ video/surface.h libsupertux_la_LDFLAGS = -module + |
From: Tobias G. <to...@us...> - 2004-07-25 19:03:47
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31225/src Modified Files: badguy.cpp gameloop.cpp gameloop.h high_scores.cpp level_subset.cpp leveleditor.cpp misc.cpp player.cpp player.h resources.cpp sector.cpp special.cpp supertux.cpp tile_manager.cpp title.cpp worldmap.cpp Log Message: - Major changes in Setup-API. - Moved all sound handling into SoundManager, which became a singleton. Index: tile_manager.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile_manager.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tile_manager.cpp 20 Jul 2004 18:04:48 -0000 1.2 +++ tile_manager.cpp 25 Jul 2004 19:03:36 -0000 1.3 @@ -59,7 +59,7 @@ lisp_object_t* root_obj = lisp_read_from_file(filename); if (!root_obj) - st_abort("Couldn't load file", filename); + Termination::abort("Couldn't load file", filename); if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-tiles") == 0) { Index: level_subset.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level_subset.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- level_subset.cpp 21 Jul 2004 16:51:53 -0000 1.5 +++ level_subset.cpp 25 Jul 2004 19:03:36 -0000 1.6 @@ -106,12 +106,12 @@ snprintf(filename, 1024, "%s/levels/%s/", st_dir, subset); if(access(filename, R_OK) == 0) { - files = read_directory(filename); + files = FileSystem::read_directory(filename); } else { snprintf(filename, 1024, "%s/levels/%s/", datadir.c_str(), subset); - files = read_directory(filename); + files = FileSystem::read_directory(filename); } for(std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) @@ -131,11 +131,11 @@ /* Save data file: */ filename = "/levels/" + name + "/"; - fcreatedir(filename.c_str()); + FileSystem::fcreatedir(filename.c_str()); filename = std::string(st_dir) + "/levels/" + name + "/info"; - if(!fwriteable(filename.c_str())) + if(!FileSystem::fwriteable(filename.c_str())) filename = datadir + "/levels/" + name + "/info"; - if(fwriteable(filename.c_str())) + if(FileSystem::fwriteable(filename.c_str())) { fi = fopen(filename.c_str(), "w"); if (fi == NULL) Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.99 retrieving revision 1.100 diff -u -d -r1.99 -r1.100 --- worldmap.cpp 20 Jul 2004 18:04:49 -0000 1.99 +++ worldmap.cpp 25 Jul 2004 19:03:36 -0000 1.100 @@ -98,7 +98,7 @@ lisp_object_t* root_obj = lisp_read_from_file(stwt_filename); if (!root_obj) - st_abort("Couldn't load file", stwt_filename); + Termination::abort("Couldn't load file", stwt_filename); if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap-tiles") == 0) { @@ -386,7 +386,7 @@ { lisp_object_t* root_obj = lisp_read_from_file(datadir + "/levels/worldmap/" + map_filename); if (!root_obj) - st_abort("Couldn't load file", datadir + "/levels/worldmap/" + map_filename); + Termination::abort("Couldn't load file", datadir + "/levels/worldmap/" + map_filename); if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap") == 0) { @@ -531,7 +531,7 @@ switch(event.type) { case SDL_QUIT: - st_abort("Received window close", ""); + Termination::abort("Received window close", ""); break; case SDL_KEYDOWN: @@ -771,7 +771,7 @@ break; } - sound_manager->play_music(song); + SoundManager::get()->play_music(song); Menu::set_current(0); if (!savegame_file.empty()) savegame(savegame_file); @@ -954,8 +954,8 @@ quit = false; - song = sound_manager->load_music(datadir + "/music/" + music); - sound_manager->play_music(song); + song = SoundManager::get()->load_music(datadir + "/music/" + music); + SoundManager::get()->play_music(song); unsigned int last_update_time; unsigned int update_time; Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- sector.cpp 20 Jul 2004 18:04:48 -0000 1.17 +++ sector.cpp 25 Jul 2004 19:03:36 -0000 1.18 @@ -669,7 +669,7 @@ throw std::runtime_error("wrong bullet type."); add_object(new_bullet); - sound_manager->play_sound(sounds[SND_SHOOT]); + SoundManager::get()->play_sound(IDToSound(SND_SHOOT)); return true; } @@ -711,7 +711,7 @@ solids->change_at(pos, tile->next_tile); } - sound_manager->play_sound(sounds[SND_DISTRO]); + SoundManager::get()->play_sound(IDToSound(SND_DISTRO)); player_status.score = player_status.score + SCORE_DISTRO; player_status.distros++; return true; @@ -727,7 +727,7 @@ (int)(pos.y / 32) * 32), tile); /* Get some score: */ - sound_manager->play_sound(sounds[SND_BRICK]); + SoundManager::get()->play_sound(IDToSound(SND_BRICK)); player_status.score = player_status.score + SCORE_BRICK; return true; @@ -765,7 +765,7 @@ { case 1: // Box with a distro! add_bouncy_distro(Vector(posx, posy)); - sound_manager->play_sound(sounds[SND_DISTRO]); + SoundManager::get()->play_sound(IDToSound(SND_DISTRO)); player_status.score = player_status.score + SCORE_DISTRO; player_status.distros++; break; @@ -775,7 +775,7 @@ add_upgrade(Vector(posx, posy), col_side, UPGRADE_GROWUP); else /* Tux is big, add a fireflower: */ add_upgrade(Vector(posx, posy), col_side, UPGRADE_FIREFLOWER); - sound_manager->play_sound(sounds[SND_UPGRADE]); + SoundManager::get()->play_sound(IDToSound(SND_UPGRADE)); break; case 5: // Add an ice flower upgrade! @@ -783,7 +783,7 @@ add_upgrade(Vector(posx, posy), col_side, UPGRADE_GROWUP); else /* Tux is big, add an iceflower: */ add_upgrade(Vector(posx, posy), col_side, UPGRADE_ICEFLOWER); - sound_manager->play_sound(sounds[SND_UPGRADE]); + SoundManager::get()->play_sound(IDToSound(SND_UPGRADE)); break; case 3: // Add a golden herring @@ -823,7 +823,7 @@ return; solids->change_at(pos, tile->next_tile); - sound_manager->play_sound(sounds[SND_DISTRO]); + SoundManager::get()->play_sound(IDToSound(SND_DISTRO)); if (bounciness == BOUNCE) { @@ -868,7 +868,7 @@ char* song_path; char* song_subtitle; - level_song = sound_manager->load_music(datadir + "/music/" + song_title); + level_song = SoundManager::get()->load_music(datadir + "/music/" + song_title); song_path = (char *) malloc(sizeof(char) * datadir.length() + strlen(song_title.c_str()) + 8 + 5); @@ -876,10 +876,10 @@ strcpy(strstr(song_subtitle, "."), "\0"); sprintf(song_path, "%s/music/%s-fast%s", datadir.c_str(), song_subtitle, strstr(song_title.c_str(), ".")); - if(!sound_manager->exists_music(song_path)) { + if(!SoundManager::get()->exists_music(song_path)) { level_song_fast = level_song; } else { - level_song_fast = sound_manager->load_music(song_path); + level_song_fast = SoundManager::get()->load_music(song_path); } free(song_subtitle); free(song_path); @@ -891,16 +891,16 @@ currentmusic = type; switch(currentmusic) { case HURRYUP_MUSIC: - sound_manager->play_music(level_song_fast); + SoundManager::get()->play_music(level_song_fast); break; case LEVEL_MUSIC: - sound_manager->play_music(level_song); + SoundManager::get()->play_music(level_song); break; case HERRING_MUSIC: - sound_manager->play_music(herring_song); + SoundManager::get()->play_music(herring_song); break; default: - sound_manager->halt_music(); + SoundManager::get()->halt_music(); break; } } Index: misc.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/misc.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- misc.cpp 24 Jul 2004 11:50:09 -0000 1.3 +++ misc.cpp 25 Jul 2004 19:03:36 -0000 1.4 @@ -46,7 +46,7 @@ if(use_gl != options_menu->isToggled(MNID_OPENGL)) { use_gl = !use_gl; - st_video_setup(screen->w,screen->h); + Setup::video(screen->w,screen->h); } #else options_menu->get_item_by_id(MNID_OPENGL).toggled = false; @@ -56,18 +56,17 @@ if(use_fullscreen != options_menu->isToggled(MNID_FULLSCREEN)) { use_fullscreen = !use_fullscreen; - st_video_setup(screen->w,screen->h); + Setup::video(screen->w,screen->h); } break; case MNID_SOUND: - if(use_sound != options_menu->isToggled(MNID_SOUND)) - use_sound = !use_sound; + if(SoundManager::get()->sound_enabled() != options_menu->isToggled(MNID_SOUND)) + SoundManager::get()->enable_sound(!SoundManager::get()->sound_enabled()); break; case MNID_MUSIC: - if(use_music != options_menu->isToggled(MNID_MUSIC)) + if(SoundManager::get()->music_enabled() != options_menu->isToggled(MNID_MUSIC)) { - use_music = !use_music; - sound_manager->enable_music(use_music); + SoundManager::get()->enable_music(!SoundManager::get()->music_enabled()); } break; case MNID_SHOWFPS: @@ -107,10 +106,10 @@ options_menu->additem(MN_DEACTIVE,_("OpenGL (not supported)"),use_gl, 0, MNID_OPENGL); #endif options_menu->additem(MN_TOGGLE,_("Fullscreen"),use_fullscreen,0, MNID_FULLSCREEN); - if(audio_device) + if(SoundManager::get()->audio_device_available()) { - options_menu->additem(MN_TOGGLE,_("Sound "), use_sound,0, MNID_SOUND); - options_menu->additem(MN_TOGGLE,_("Music "), use_music,0, MNID_MUSIC); + options_menu->additem(MN_TOGGLE,_("Sound "), SoundManager::get()->sound_enabled(),0, MNID_SOUND); + options_menu->additem(MN_TOGGLE,_("Music "), SoundManager::get()->music_enabled(),0, MNID_MUSIC); } else { Index: special.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/special.cpp,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- special.cpp 20 Jul 2004 18:06:14 -0000 1.63 +++ special.cpp 25 Jul 2004 19:03:36 -0000 1.64 @@ -27,7 +27,6 @@ #include "camera.h" #include "gameloop.h" #include "video/screen.h" -#include "audio/sound.h" #include "scene.h" #include "app/globals.h" #include "player.h" @@ -280,7 +279,7 @@ if(kind != UPGRADE_GROWUP) return; - sound_manager->play_sound(sounds[SND_BUMP_UPGRADE], Vector(base.x, base.y), Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_BUMP_UPGRADE), Vector(base.x, base.y), Sector::current()->player->get_pos()); // determine new direction Direction old_dir = dir; @@ -328,30 +327,30 @@ if (kind == UPGRADE_GROWUP) { - sound_manager->play_sound(sounds[SND_EXCELLENT]); + SoundManager::get()->play_sound(IDToSound(SND_EXCELLENT)); pplayer->grow(true); } else if (kind == UPGRADE_FIREFLOWER) { - sound_manager->play_sound(sounds[SND_COFFEE]); + SoundManager::get()->play_sound(IDToSound(SND_COFFEE)); pplayer->grow(true); pplayer->got_power = pplayer->FIRE_POWER; } else if (kind == UPGRADE_ICEFLOWER) { - sound_manager->play_sound(sounds[SND_COFFEE]); + SoundManager::get()->play_sound(IDToSound(SND_COFFEE)); pplayer->grow(true); pplayer->got_power = pplayer->ICE_POWER; } else if (kind == UPGRADE_FIREFLOWER) { - sound_manager->play_sound(sounds[SND_COFFEE]); + SoundManager::get()->play_sound(IDToSound(SND_COFFEE)); pplayer->grow(true); pplayer->got_power = pplayer->FIRE_POWER; } else if (kind == UPGRADE_HERRING) { - sound_manager->play_sound(sounds[SND_HERRING]); + SoundManager::get()->play_sound(IDToSound(SND_HERRING)); pplayer->invincible_timer.start(TUX_INVINCIBLE_TIME); Sector::current()->play_music(HERRING_MUSIC); } @@ -359,7 +358,7 @@ { if(player_status.lives < MAX_LIVES) { player_status.lives++; - sound_manager->play_sound(sounds[SND_LIFEUP]); + SoundManager::get()->play_sound(IDToSound(SND_LIFEUP)); } } Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.156 retrieving revision 1.157 diff -u -d -r1.156 -r1.157 --- gameloop.cpp 20 Jul 2004 18:04:47 -0000 1.156 +++ gameloop.cpp 25 Jul 2004 19:03:36 -0000 1.157 @@ -110,7 +110,7 @@ level->do_vertical_flip(); currentsector = level->get_sector("main"); if(!currentsector) - st_abort("Level has no main sector.", ""); + Termination::abort("Level has no main sector.", ""); currentsector->activate("main"); #if 0 // TODO @@ -153,7 +153,7 @@ void GameSession::levelintro(void) { - sound_manager->halt_music(); + SoundManager::get()->halt_music(); char str[60]; @@ -256,7 +256,7 @@ switch(event.type) { case SDL_QUIT: /* Quit event - quit: */ - st_abort("Received window close", ""); + Termination::abort("Received window close", ""); break; case SDL_KEYDOWN: /* A keypress! */ @@ -302,7 +302,7 @@ switch(event.type) { case SDL_QUIT: /* Quit event - quit: */ - st_abort("Received window close", ""); + Termination::abort("Received window close", ""); break; case SDL_KEYDOWN: /* A keypress! */ @@ -474,7 +474,7 @@ { end_sequence = ENDSEQUENCE_RUNNING; last_x_pos = -1; - sound_manager->play_music(level_end_song, 0); + SoundManager::get()->play_music(level_end_song, 0); endsequence_timer.start(7000); // 5 seconds until we finish the map tux->invincible_timer.start(7000); //FIXME: Implement a winning timer for the end sequence (with special winning animation etc.) } @@ -716,7 +716,7 @@ Sector::current()->add_bouncy_brick(Vector(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32)); - sound_manager->play_sound(sounds[SND_BRICK], Vector(x, y), Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_BRICK), Vector(x, y), Sector::current()->player->get_pos()); } /* (Status): */ Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.110 retrieving revision 1.111 diff -u -d -r1.110 -r1.111 --- badguy.cpp 20 Jul 2004 18:04:47 -0000 1.110 +++ badguy.cpp 25 Jul 2004 19:03:36 -0000 1.111 @@ -357,7 +357,7 @@ tux.kick_timer.start(KICKING_TIME); set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5); - sound_manager->play_sound(sounds[SND_KICK], this, Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_KICK), this, Sector::current()->player->get_pos()); } } @@ -367,7 +367,7 @@ check_horizontal_bump(); if(mode == KICK && changed != dir) { - sound_manager->play_sound(sounds[SND_RICOCHET], get_pos(), Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_RICOCHET), get_pos(), Sector::current()->player->get_pos()); } } @@ -561,7 +561,7 @@ dying = DYING_NOT; // now the bomb hurts timer.start(EXPLODETIME); - sound_manager->play_sound(sounds[SND_EXPLODE], this, Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_EXPLODE), this, Sector::current()->player->get_pos()); } else if(mode == BOMB_EXPLODE) { remove_me(); return; @@ -1034,7 +1034,7 @@ Sector::current()->add_score(Vector(base.x, base.y), 50 * player_status.score_multiplier); - sound_manager->play_sound(sounds[SND_SQUISH], get_pos(), Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_SQUISH), get_pos(), Sector::current()->player->get_pos()); player_status.score_multiplier++; dying = DYING_SQUISHED; @@ -1054,7 +1054,7 @@ player->bounce(this); Sector::current()->add_score(Vector(base.x, base.y), 50 * player_status.score_multiplier); - sound_manager->play_sound(sounds[SND_SQUISH], get_pos(), Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_SQUISH), get_pos(), Sector::current()->player->get_pos()); player_status.score_multiplier++; return; @@ -1062,7 +1062,7 @@ if (mode == NORMAL || mode == KICK) { /* Flatten! */ - sound_manager->play_sound(sounds[SND_STOMP], get_pos(), Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_STOMP), get_pos(), Sector::current()->player->get_pos()); mode = FLAT; set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); physic.set_velocity_x(0); @@ -1070,7 +1070,7 @@ timer.start(4000); } else if (mode == FLAT) { /* Kick! */ - sound_manager->play_sound(sounds[SND_KICK], this, Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_KICK), this, Sector::current()->player->get_pos()); if (player->base.x < base.x + (base.width/2)) { physic.set_velocity_x(5); @@ -1171,7 +1171,7 @@ score * player_status.score_multiplier); /* Play death sound: */ - sound_manager->play_sound(sounds[SND_FALL], this, Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_FALL), this, Sector::current()->player->get_pos()); } void @@ -1334,7 +1334,7 @@ /* Get kicked if were flat */ if (mode == FLAT && !dying) { - sound_manager->play_sound(sounds[SND_KICK], this, Sector::current()->player->get_pos()); + SoundManager::get()->play_sound(IDToSound(SND_KICK), this, Sector::current()->player->get_pos()); // Hit from left side if (player->base.x < base.x) { Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- gameloop.h 21 Jul 2004 16:51:53 -0000 1.55 +++ gameloop.h 25 Jul 2004 19:03:36 -0000 1.56 @@ -23,7 +23,6 @@ #define SUPERTUX_GAMELOOP_H #include "special/timer.h" -#include "audio/sound.h" #include "special/base.h" using namespace SuperTux; Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.142 retrieving revision 1.143 diff -u -d -r1.142 -r1.143 --- leveleditor.cpp 20 Jul 2004 18:04:47 -0000 1.142 +++ leveleditor.cpp 25 Jul 2004 19:03:36 -0000 1.143 @@ -77,7 +77,7 @@ LevelEditor::LevelEditor() { - level_subsets = dsubdirs("/levels", "level1.stl"); + level_subsets = FileSystem::dsubdirs("/levels", "level1.stl"); le_level_subset = new LevelSubset; le_level = NULL; @@ -201,7 +201,7 @@ le_level = NULL; le_levelnb = 1; - sound_manager->halt_music(); + SoundManager::get()->halt_music(); while (SDL_PollEvent(&event)) {} @@ -544,8 +544,8 @@ level_settings_menu->get_item_by_id(MNID_NAME).change_input(le_level->name.c_str()); level_settings_menu->get_item_by_id(MNID_AUTHOR).change_input(le_level->author.c_str()); - string_list_copy(level_settings_menu->get_item_by_id(MNID_SONG).list, dfiles("music/",NULL, "-fast")); - string_list_copy(level_settings_menu->get_item_by_id(MNID_BGIMG).list, dfiles("images/background",NULL, NULL)); + string_list_copy(level_settings_menu->get_item_by_id(MNID_SONG).list, FileSystem::dfiles("music/",NULL, "-fast")); + string_list_copy(level_settings_menu->get_item_by_id(MNID_BGIMG).list, FileSystem::dfiles("images/background",NULL, NULL)); string_list_add_item(level_settings_menu->get_item_by_id(MNID_BGIMG).list,""); string_list_add_item(level_settings_menu->get_item_by_id(MNID_PARTICLE).list,""); string_list_add_item(level_settings_menu->get_item_by_id(MNID_PARTICLE).list,"snow"); @@ -1687,7 +1687,7 @@ session.run(); player_status.reset(); - sound_manager->halt_music(); + SoundManager::get()->halt_music(); Menu::set_current(NULL); } Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.146 retrieving revision 1.147 diff -u -d -r1.146 -r1.147 --- player.cpp 20 Jul 2004 18:04:48 -0000 1.146 +++ player.cpp 25 Jul 2004 19:03:36 -0000 1.147 @@ -419,7 +419,7 @@ if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) { if(fabs(vx)>SKID_XM && !skidding_timer.check()) { skidding_timer.start(SKID_TIME); - sound_manager->play_sound(sounds[SND_SKID]); + SoundManager::get()->play_sound(IDToSound(SND_SKID)); ax *= 2.5; } else { ax *= 2; @@ -486,9 +486,9 @@ jumping = true; can_jump = false; if (size == SMALL) - sound_manager->play_sound(sounds[SND_JUMP]); + SoundManager::get()->play_sound(IDToSound(SND_JUMP)); else - sound_manager->play_sound(sounds[SND_BIGJUMP]); + SoundManager::get()->play_sound(IDToSound(SND_BIGJUMP)); } // Let go of jump key else if(input.up == UP && jumping && physic.get_velocity_y() > 0) @@ -681,7 +681,7 @@ if(player_status.lives < MAX_LIVES) ++player_status.lives; /*We want to hear the sound even, if MAX_LIVES is reached*/ - sound_manager->play_sound(sounds[SND_LIFEUP]); + SoundManager::get()->play_sound(IDToSound(SND_LIFEUP)); } } @@ -923,7 +923,7 @@ if(dying) return; - sound_manager->play_sound(sounds[SND_HURT]); + SoundManager::get()->play_sound(IDToSound(SND_HURT)); physic.set_velocity_x(0); Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.h,v retrieving revision 1.76 retrieving revision 1.77 diff -u -d -r1.76 -r1.77 --- player.h 21 Jul 2004 16:51:53 -0000 1.76 +++ player.h 25 Jul 2004 19:03:36 -0000 1.77 @@ -27,7 +27,6 @@ #include "special/base.h" #include "video/surface.h" #include "collision.h" -#include "audio/sound.h" #include "special/moving_object.h" #include "math/physic.h" #include "app/defines.h" Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.109 retrieving revision 1.110 diff -u -d -r1.109 -r1.110 --- title.cpp 20 Jul 2004 18:04:48 -0000 1.109 +++ title.cpp 25 Jul 2004 19:03:36 -0000 1.110 @@ -103,7 +103,7 @@ void generate_contrib_menu() { /** Generating contrib levels list by making use of Level Subset */ - string_list_type level_subsets = dsubdirs("/levels", "info"); + string_list_type level_subsets = FileSystem::dsubdirs("/levels", "info"); free_contrib_menu(); @@ -272,7 +272,7 @@ img_choose_subset = new Surface(datadir + "/images/status/choose-level-subset.png", true); /* Generating contrib maps by only using a string_list */ - worldmap_list = dfiles("levels/worldmap", NULL, "icyisland.stwm"); + worldmap_list = FileSystem::dfiles("levels/worldmap", NULL, "icyisland.stwm"); titlesession->get_current_sector()->activate(); titlesession->set_current(); Index: high_scores.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/high_scores.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- high_scores.cpp 21 Jul 2004 16:51:53 -0000 1.24 +++ high_scores.cpp 25 Jul 2004 19:03:36 -0000 1.25 @@ -141,8 +141,8 @@ /* Save data file: */ filename = highscore_filename; - fcreatedir(filename.c_str()); - if(fwriteable(filename.c_str())) + FileSystem::fcreatedir(filename.c_str()); + if(FileSystem::fwriteable(filename.c_str())) { fi = fopen(filename.c_str(), "w"); if (fi == NULL) Index: supertux.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/supertux.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- supertux.cpp 24 Jul 2004 11:50:09 -0000 1.27 +++ supertux.cpp 25 Jul 2004 19:03:36 -0000 1.28 @@ -52,15 +52,15 @@ textdomain(PACKAGE); bind_textdomain_codeset(PACKAGE, "ISO-8859-1"); - st_info_setup(PACKAGE_NAME,PACKAGE,PACKAGE_VERSION); + Setup::info(PACKAGE_NAME,PACKAGE,PACKAGE_VERSION); - st_directory_setup(); - parseargs(argc, argv); + Setup::directories(); + Setup::parseargs(argc, argv); - st_audio_setup(); - st_video_setup(SCREEN_W,SCREEN_H); - st_joystick_setup(); - st_general_setup(); + Setup::audio(); + Setup::video(SCREEN_W,SCREEN_H); + Setup::joystick(); + Setup::general(); st_menu(); loadshared(); @@ -99,13 +99,13 @@ //SDL_Flip(screen); unloadshared(); - st_general_free(); + Setup::general_free(); st_menu_free(); TileManager::destroy_instance(); #ifdef DEBUG Surface::debug_check(); #endif - st_shutdown(); + Termination::shutdown(); #ifndef DEBUG // we want to see the backtrace in gdb when in debug mode } catch (SuperTuxException &e) Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- resources.cpp 21 Jul 2004 16:51:53 -0000 1.43 +++ resources.cpp 25 Jul 2004 19:03:36 -0000 1.44 @@ -82,8 +82,6 @@ int i; sprite_manager = new SpriteManager(datadir + "/supertux.strf"); - sound_manager = new SoundManager(); - sound_manager->enable_music(use_music); /* Tuxes: */ smalltux_star = sprite_manager->load("smalltux-star"); @@ -265,11 +263,11 @@ Send a mail to me: neo...@us..., if you have another opinion. :) */ for (i = 0; i < NUM_SOUNDS; i++) - sounds.push_back(load_sound(datadir + soundfilenames[i])); + SoundManager::get()->add_sound(SoundManager::get()->load_sound(datadir + soundfilenames[i]),i); /* Herring song */ - herring_song = sound_manager->load_music(datadir + "/music/SALCON.MOD"); - level_end_song = sound_manager->load_music(datadir + "/music/leveldone.mod"); + herring_song = SoundManager::get()->load_music(datadir + "/music/SALCON.MOD"); + level_end_song = SoundManager::get()->load_music(datadir + "/music/leveldone.mod"); } @@ -311,12 +309,8 @@ for (int i = 0; i < DOOR_OPENING_FRAMES; i++) delete door_opening[i]; - for (i = 0; i < NUM_SOUNDS; i++) - free_chunk(sounds[i]); - delete sprite_manager; sprite_manager = 0; - delete sound_manager; sound_manager = 0; } |
From: Tobias G. <to...@us...> - 2004-07-25 19:03:47
|
Update of /cvsroot/super-tux/supertux/lib/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31225/lib/video Modified Files: drawing_context.h font.h surface.cpp Log Message: - Major changes in Setup-API. - Moved all sound handling into SoundManager, which became a singleton. Index: font.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- font.h 22 Jul 2004 19:07:51 -0000 1.3 +++ font.h 25 Jul 2004 19:03:35 -0000 1.4 @@ -33,11 +33,11 @@ and displays it in a StarTrek fashion */ void display_text_file(const std::string& file, float scroll_speed); - /* Text type */ + /// Font class Font { public: - /* Kinds of texts. */ + /// Kinds of texts. enum FontType { TEXT, // images for all characters NUM // only images for numbers @@ -46,7 +46,7 @@ Font(const std::string& file, FontType type, int w, int h, int shadowsize=2); ~Font(); - /** returns the height of the font */ + /// returns the height of the font. float get_height() const; /** returns the width of a given text. (Note that I won't add a normal * get_width function here, as we might switch to variable width fonts in the Index: drawing_context.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- drawing_context.h 22 Jul 2004 19:07:51 -0000 1.3 +++ drawing_context.h 25 Jul 2004 19:03:35 -0000 1.4 @@ -47,6 +47,7 @@ LAYER_GUI = 500 }; + /// Handles drawing of things. /** * This class provides functions for drawing things on screen. It also * maintains a stack of transforms that are applied to graphics. @@ -57,26 +58,26 @@ DrawingContext(); ~DrawingContext(); - /** Adds a drawing request for a surface into the request list */ + /// Adds a drawing request for a surface into the request list. void draw_surface(const Surface* surface, const Vector& position, int layer, Uint32 drawing_effect = NONE_EFFECT); - /** Adds a drawing request for part of a surface */ + /// Adds a drawing request for part of a surface. void draw_surface_part(const Surface* surface, const Vector& source, const Vector& size, const Vector& dest, int layer, Uint32 drawing_effect = NONE_EFFECT); - /** draws a text */ + /// Draws a text. void draw_text(Font* font, const std::string& text, const Vector& position, int layer, Uint32 drawing_effect = NONE_EFFECT); - /** draws aligned text */ + /// Draws aligned text. void draw_text_center(Font* font, const std::string& text, const Vector& position, int layer, Uint32 drawing_effect = NONE_EFFECT); - /** draws a color gradient onto the whole screen */ + /// Draws a color gradient onto the whole screen */ void draw_gradient(Color from, Color to, int layer); - /** fills a rectangle */ + /// Fills a rectangle. void draw_filled_rect(const Vector& topleft, const Vector& size, Color color, int layer); - /** Processes all pending drawing requests and flushes the list */ + /// Processes all pending drawing requests and flushes the list. void do_drawing(); const Vector& get_translation() const @@ -91,7 +92,7 @@ void push_transform(); void pop_transform(); - /** apply that effect in the next draws (effects are listed on surface.h) */ + /// Apply that effect in the next draws (effects are listed on surface.h). void set_drawing_effect(int effect); private: Index: surface.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/surface.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- surface.cpp 22 Jul 2004 19:07:51 -0000 1.3 +++ surface.cpp 25 Jul 2004 19:03:35 -0000 1.4 @@ -46,7 +46,7 @@ temp->format->Bmask, temp->format->Amask); if(!surface) - st_abort("No memory left.", ""); + Termination::abort("No memory left.", ""); SDL_SetAlpha(temp,0,0); SDL_BlitSurface(temp, NULL, surface, NULL); } @@ -260,7 +260,7 @@ temp = IMG_Load(file.c_str()); if (temp == NULL) - st_abort("Can't load", file); + Termination::abort("Can't load", file); /* Set source rectangle for conv: */ @@ -291,7 +291,7 @@ sdl_surface = SDL_DisplayFormatAlpha(conv); if (sdl_surface == NULL) - st_abort("Can't covert to display format", file); + Termination::abort("Can't covert to display format", file); if (use_alpha == false && !use_gl) SDL_SetAlpha(sdl_surface, 0, 0); @@ -311,7 +311,7 @@ temp = IMG_Load(file.c_str()); if (temp == NULL) - st_abort("Can't load", file); + Termination::abort("Can't load", file); if(use_alpha == false && !use_gl) sdl_surface = SDL_DisplayFormat(temp); @@ -319,7 +319,7 @@ sdl_surface = SDL_DisplayFormatAlpha(temp); if (sdl_surface == NULL) - st_abort("Can't covert to display format", file); + Termination::abort("Can't covert to display format", file); if (use_alpha == false && !use_gl) SDL_SetAlpha(sdl_surface, 0, 0); @@ -358,7 +358,7 @@ } if (sdl_surface == NULL) - st_abort("Can't covert to display format", "SURFACE"); + Termination::abort("Can't covert to display format", "SURFACE"); if (use_alpha == false && !use_gl) SDL_SetAlpha(sdl_surface, 0, 0); @@ -376,7 +376,7 @@ screen->format->Gmask, screen->format->Bmask, screen->format->Amask); if(sdl_surface == NULL) - st_abort("Cannot create surface for the gradient", "SURFACE"); + Termination::abort("Cannot create surface for the gradient", "SURFACE"); if(top == bottom) { |
From: Tobias G. <to...@us...> - 2004-07-25 19:03:43
|
Update of /cvsroot/super-tux/supertux/lib/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31225/lib/utils Modified Files: configfile.cpp configfile.h lispreader.cpp Log Message: - Major changes in Setup-API. - Moved all sound handling into SoundManager, which became a singleton. Index: configfile.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/utils/configfile.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- configfile.h 22 Jul 2004 19:07:51 -0000 1.3 +++ configfile.h 25 Jul 2004 19:03:35 -0000 1.4 @@ -24,6 +24,8 @@ namespace SuperTux { +FILE * opendata(const char * filename, const char * mode); + class Config { public: void load (); Index: lispreader.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/utils/lispreader.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- lispreader.cpp 22 Jul 2004 19:07:51 -0000 1.3 +++ lispreader.cpp 25 Jul 2004 19:03:35 -0000 1.4 @@ -1132,7 +1132,7 @@ return false; if (!lisp_real_p(lisp_car(obj)) && !lisp_integer_p(lisp_car(obj))) - st_abort("LispReader expected type real at token: ", name); + Termination::abort("LispReader expected type real at token: ", name); f = lisp_real(lisp_car(obj)); return true; @@ -1149,7 +1149,7 @@ while(!lisp_nil_p(obj)) { if (!lisp_string_p(lisp_car(obj))) - st_abort("LispReader expected type string at token: ", name); + Termination::abort("LispReader expected type string at token: ", name); vec.push_back(lisp_string(lisp_car(obj))); obj = lisp_cdr(obj); } @@ -1167,7 +1167,7 @@ while(!lisp_nil_p(obj)) { if (!lisp_integer_p(lisp_car(obj))) - st_abort("LispReader expected type integer at token: ", name); + Termination::abort("LispReader expected type integer at token: ", name); vec.push_back(lisp_integer(lisp_car(obj))); obj = lisp_cdr(obj); } @@ -1185,7 +1185,7 @@ while(!lisp_nil_p(obj)) { if (!lisp_integer_p(lisp_car(obj))) - st_abort("LispReader expected type integer at token: ", name); + Termination::abort("LispReader expected type integer at token: ", name); vec.push_back(lisp_integer(lisp_car(obj))); obj = lisp_cdr(obj); } @@ -1253,7 +1253,7 @@ return false; if (!lisp_string_p(lisp_car(obj))) - st_abort("LispReader expected type string at token: ", name); + Termination::abort("LispReader expected type string at token: ", name); str = lisp_string(lisp_car(obj)); return true; } @@ -1266,7 +1266,7 @@ return false; if (!lisp_boolean_p(lisp_car(obj))) - st_abort("LispReader expected type bool at token: ", name); + Termination::abort("LispReader expected type bool at token: ", name); b = lisp_boolean(lisp_car(obj)); return true; } Index: configfile.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/utils/configfile.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- configfile.cpp 22 Jul 2004 19:07:51 -0000 1.3 +++ configfile.cpp 25 Jul 2004 19:03:35 -0000 1.4 @@ -23,6 +23,7 @@ #include "../utils/configfile.h" #include "../app/setup.h" #include "../app/globals.h" +#include "../audio/sound_manager.h" using namespace SuperTux; @@ -38,14 +39,44 @@ { /* Set defaults: */ debug_mode = false; - audio_device = true; + SoundManager::get()->set_audio_device_available(true); use_fullscreen = false; show_fps = false; use_gl = false; - use_sound = true; - use_music = true; + SoundManager::get()->enable_sound(true); + SoundManager::get()->enable_music(true); +} + +FILE * SuperTux::opendata(const char * rel_filename, const char * mode) +{ + char * filename = NULL; + FILE * fi; + + filename = (char *) malloc(sizeof(char) * (strlen(st_dir) + + strlen(rel_filename) + 1)); + + strcpy(filename, st_dir); + /* Open the high score file: */ + + strcat(filename, rel_filename); + + /* Try opening the file: */ + fi = fopen(filename, mode); + + if (fi == NULL) + { + fprintf(stderr, "Warning: Unable to open the file \"%s\" ", filename); + + if (strcmp(mode, "r") == 0) + fprintf(stderr, "for read!!!\n"); + else if (strcmp(mode, "w") == 0) + fprintf(stderr, "for write!!!\n"); + } + free( filename ); + + return(fi); } void Config::load() @@ -78,8 +109,11 @@ LispReader reader(lisp_cdr(root_obj)); reader.read_bool("fullscreen", use_fullscreen); - reader.read_bool("sound", use_sound); - reader.read_bool("music", use_music); + bool temp; + reader.read_bool("sound", temp); + SoundManager::get()->enable_sound(temp); + reader.read_bool("music", temp); + SoundManager::get()->enable_music(temp); reader.read_bool("show_fps", show_fps); std::string video; @@ -116,8 +150,8 @@ fprintf(config, "(supertux-config\n"); fprintf(config, "\t;; the following options can be set to #t or #f:\n"); fprintf(config, "\t(fullscreen %s)\n", use_fullscreen ? "#t" : "#f"); - fprintf(config, "\t(sound %s)\n", use_sound ? "#t" : "#f"); - fprintf(config, "\t(music %s)\n", use_music ? "#t" : "#f"); + fprintf(config, "\t(sound %s)\n", SoundManager::get()->sound_enabled() ? "#t" : "#f"); + fprintf(config, "\t(music %s)\n", SoundManager::get()->music_enabled() ? "#t" : "#f"); fprintf(config, "\t(show_fps %s)\n", show_fps ? "#t" : "#f"); fprintf(config, "\n\t;; either \"opengl\" or \"sdl\"\n"); |
From: Tobias G. <to...@us...> - 2004-07-25 19:03:43
|
Update of /cvsroot/super-tux/supertux/lib/special In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31225/lib/special Modified Files: sprite.cpp sprite.h Log Message: - Major changes in Setup-API. - Moved all sound handling into SoundManager, which became a singleton. Index: sprite.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/sprite.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sprite.cpp 22 Jul 2004 19:07:50 -0000 1.3 +++ sprite.cpp 25 Jul 2004 19:03:34 -0000 1.4 @@ -34,14 +34,14 @@ LispReader reader(cur); if(!reader.read_string("name", name)) - st_abort("Sprite wihtout name", ""); + Termination::abort("Sprite wihtout name", ""); reader.read_int("x-hotspot", x_hotspot); reader.read_int("y-hotspot", y_hotspot); reader.read_float("fps", fps); std::vector<std::string> images; if(!reader.read_string_vector("images", images)) - st_abort("Sprite contains no images: ", name.c_str()); + Termination::abort("Sprite contains no images: ", name.c_str()); for(std::vector<std::string>::size_type i = 0; i < images.size(); ++i) { Index: sprite.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/sprite.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sprite.h 22 Jul 2004 19:07:50 -0000 1.3 +++ sprite.h 25 Jul 2004 19:03:34 -0000 1.4 @@ -32,24 +32,6 @@ class Sprite { - private: - std::string name; - - int x_hotspot; - int y_hotspot; - - /** Frames per second */ - float fps; - - /** Number of seconds that a frame is displayed until it is switched - to the next frame */ - float frame_delay; - - float time; - - std::vector<Surface*> surfaces; - - void init_defaults(); public: /** cur has to be a pointer to data in the form of ((x-hotspot 5) (y-hotspot 10) ...) */ @@ -86,7 +68,25 @@ return surfaces[frame]; else return surfaces[0]; - } + } + private: + std::string name; + + int x_hotspot; + int y_hotspot; + + /** Frames per second */ + float fps; + + /** Number of seconds that a frame is displayed until it is switched + to the next frame */ + float frame_delay; + + float time; + + std::vector<Surface*> surfaces; + + void init_defaults(); }; } //namespace SuperTux |
From: Tobias G. <to...@us...> - 2004-07-25 19:03:43
|
Update of /cvsroot/super-tux/supertux/lib/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31225/lib/gui Modified Files: button.cpp menu.cpp Log Message: - Major changes in Setup-API. - Moved all sound handling into SoundManager, which became a singleton. Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/menu.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- menu.cpp 22 Jul 2004 19:07:50 -0000 1.3 +++ menu.cpp 25 Jul 2004 19:03:34 -0000 1.4 @@ -34,7 +34,6 @@ #include "../video/screen.h" #include "../video/drawing_context.h" #include "../app/setup.h" -#include "../audio/sound.h" #include "../special/timer.h" #include "../app/gettext.h" #include "../math/vector.h" Index: button.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/button.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- button.cpp 22 Jul 2004 19:07:50 -0000 1.3 +++ button.cpp 25 Jul 2004 19:03:34 -0000 1.4 @@ -79,7 +79,7 @@ if(!icon_file.empty()) { snprintf(filename, 1024, "%s/%s", datadir.c_str(), icon_file.c_str()); - if(!faccessible(filename)) + if(!FileSystem::faccessible(filename)) snprintf(filename, 1024, "%s/images/icons/default-icon.png", datadir.c_str()); } else |
From: Tobias G. <to...@us...> - 2004-07-24 11:50:21
|
Update of /cvsroot/super-tux/supertux/lib/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15197/lib/app Modified Files: globals.cpp globals.h setup.cpp setup.h Log Message: SuperTux lib became a bit more independend of SupeTux. Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- setup.cpp 22 Jul 2004 19:07:49 -0000 1.3 +++ setup.cpp 24 Jul 2004 11:50:09 -0000 1.4 @@ -60,11 +60,6 @@ #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); @@ -297,6 +292,13 @@ 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) @@ -310,10 +312,11 @@ 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)) @@ -352,7 +355,7 @@ 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; @@ -431,7 +434,7 @@ } -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) @@ -445,21 +448,21 @@ /* 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, @@ -472,7 +475,7 @@ } 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) { @@ -485,7 +488,7 @@ } } -void SuperTux::st_video_setup_gl(void) +void SuperTux::st_video_setup_gl(unsigned int screen_w, unsigned int screen_h) { #ifndef NOOPENGL @@ -497,7 +500,7 @@ 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, @@ -510,7 +513,7 @@ } else { - screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_OPENGL); + screen = SDL_SetVideoMode(screen_w, screen_h, 0, SDL_OPENGL); if (screen == NULL) { @@ -687,13 +690,13 @@ /* 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); } @@ -809,7 +812,7 @@ 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) Index: globals.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/globals.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- globals.cpp 22 Jul 2004 19:07:49 -0000 1.3 +++ globals.cpp 24 Jul 2004 11:50:09 -0000 1.4 @@ -24,7 +24,10 @@ /** The datadir prefix prepended when loading game data file */ std::string datadir; - +std::string package_symbol_name; +std::string package_name; +std::string package_version; + JoystickKeymap::JoystickKeymap() { a_button = 0; Index: setup.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- setup.h 22 Jul 2004 19:07:49 -0000 1.3 +++ setup.h 24 Jul 2004 11:50:09 -0000 1.4 @@ -37,12 +37,13 @@ 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); Index: globals.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/globals.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- globals.h 22 Jul 2004 19:07:49 -0000 1.3 +++ globals.h 24 Jul 2004 11:50:09 -0000 1.4 @@ -34,6 +34,9 @@ { extern std::string datadir; + extern std::string package_symbol_name; + extern std::string package_name; + extern std::string package_version; struct JoystickKeymap { @@ -77,7 +80,7 @@ /* SuperTux directory ($HOME/.supertux) and save directory($HOME/.supertux/save) */ extern char* st_dir; extern char* st_save_dir; - + extern float game_speed; extern SDL_Joystick * js; |
From: Tobias G. <to...@us...> - 2004-07-24 11:50:21
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15197/src Modified Files: misc.cpp misc.h supertux.cpp Log Message: SuperTux lib became a bit more independend of SupeTux. Index: misc.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/misc.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- misc.cpp 21 Jul 2004 16:51:53 -0000 1.2 +++ misc.cpp 24 Jul 2004 11:50:09 -0000 1.3 @@ -46,7 +46,7 @@ if(use_gl != options_menu->isToggled(MNID_OPENGL)) { use_gl = !use_gl; - st_video_setup(); + st_video_setup(screen->w,screen->h); } #else options_menu->get_item_by_id(MNID_OPENGL).toggled = false; @@ -56,7 +56,7 @@ if(use_fullscreen != options_menu->isToggled(MNID_FULLSCREEN)) { use_fullscreen = !use_fullscreen; - st_video_setup(); + st_video_setup(screen->w,screen->h); } break; case MNID_SOUND: Index: misc.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/misc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- misc.h 20 Jul 2004 17:59:37 -0000 1.1 +++ misc.h 24 Jul 2004 11:50:09 -0000 1.2 @@ -43,7 +43,12 @@ MNID_MUSIC, MNID_SHOWFPS }; - + +/* 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 + /* Handle changes made to global settings in the options menu. */ void process_options_menu(void); Index: supertux.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/supertux.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- supertux.cpp 20 Jul 2004 18:04:48 -0000 1.26 +++ supertux.cpp 24 Jul 2004 11:50:09 -0000 1.27 @@ -51,12 +51,14 @@ bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); bind_textdomain_codeset(PACKAGE, "ISO-8859-1"); - + + st_info_setup(PACKAGE_NAME,PACKAGE,PACKAGE_VERSION); + st_directory_setup(); parseargs(argc, argv); st_audio_setup(); - st_video_setup(); + st_video_setup(SCREEN_W,SCREEN_H); st_joystick_setup(); st_general_setup(); st_menu(); |
From: Tobias G. <to...@us...> - 2004-07-22 19:08:04
|
Update of /cvsroot/super-tux/supertux/lib/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9064/lib/utils Modified Files: configfile.cpp configfile.h lispreader.cpp lispreader.h lispwriter.cpp Log Message: Had to change the #includes of dependend headers from "dir/header.h" to "../dir/header.h", so those 'dependencies' work correctly, if you want to use those headers from $(includedir) so to speak in a 3rd party projects. Index: lispwriter.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/utils/lispwriter.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- lispwriter.cpp 21 Jul 2004 16:51:53 -0000 1.2 +++ lispwriter.cpp 22 Jul 2004 19:07:51 -0000 1.3 @@ -19,7 +19,7 @@ #include <iostream> -#include "utils/lispwriter.h" +#include "../utils/lispwriter.h" using namespace SuperTux; Index: configfile.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/utils/configfile.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- configfile.cpp 21 Jul 2004 16:51:52 -0000 1.2 +++ configfile.cpp 22 Jul 2004 19:07:51 -0000 1.3 @@ -20,9 +20,9 @@ #include <cstdlib> #include <string> -#include "utils/configfile.h" -#include "app/setup.h" -#include "app/globals.h" +#include "../utils/configfile.h" +#include "../app/setup.h" +#include "../app/globals.h" using namespace SuperTux; Index: configfile.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/utils/configfile.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- configfile.h 21 Jul 2004 16:51:52 -0000 1.2 +++ configfile.h 22 Jul 2004 19:07:51 -0000 1.3 @@ -20,7 +20,7 @@ #ifndef SUPERTUX_CONFIGFILE_H #define SUPERTUX_CONFIGFILE_H -#include "utils/lispreader.h" +#include "../utils/lispreader.h" namespace SuperTux { Index: lispreader.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/utils/lispreader.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- lispreader.cpp 21 Jul 2004 16:51:53 -0000 1.2 +++ lispreader.cpp 22 Jul 2004 19:07:51 -0000 1.3 @@ -27,9 +27,9 @@ #include <cstdlib> #include <cstring> -#include "app/globals.h" -#include "app/setup.h" -#include "utils/lispreader.h" +#include "../app/globals.h" +#include "../app/setup.h" +#include "../utils/lispreader.h" using namespace SuperTux; Index: lispreader.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/utils/lispreader.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- lispreader.h 21 Jul 2004 16:51:53 -0000 1.2 +++ lispreader.h 22 Jul 2004 19:07:51 -0000 1.3 @@ -31,7 +31,7 @@ #include <zlib.h> -#include "utils/exceptions.h" +#include "../utils/exceptions.h" namespace SuperTux { |
From: Tobias G. <to...@us...> - 2004-07-22 19:08:04
|
Update of /cvsroot/super-tux/supertux/lib/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9064/lib/video Modified Files: drawing_context.cpp drawing_context.h font.cpp font.h screen.cpp surface.cpp surface.h Log Message: Had to change the #includes of dependend headers from "dir/header.h" to "../dir/header.h", so those 'dependencies' work correctly, if you want to use those headers from $(includedir) so to speak in a 3rd party projects. Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- font.cpp 21 Jul 2004 16:51:53 -0000 1.2 +++ font.cpp 22 Jul 2004 19:07:51 -0000 1.3 @@ -21,11 +21,11 @@ #include <cstdlib> #include <cstring> -#include "app/globals.h" -#include "video/screen.h" -#include "video/font.h" -#include "video/drawing_context.h" -#include "utils/lispreader.h" +#include "../app/globals.h" +#include "../video/screen.h" +#include "../video/font.h" +#include "../video/drawing_context.h" +#include "../utils/lispreader.h" using namespace SuperTux; Index: drawing_context.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- drawing_context.cpp 21 Jul 2004 16:51:53 -0000 1.2 +++ drawing_context.cpp 22 Jul 2004 19:07:51 -0000 1.3 @@ -20,10 +20,10 @@ #include <cassert> #include <iostream> -#include "video/drawing_context.h" -#include "video/surface.h" -#include "app/globals.h" -#include "video/font.h" +#include "../video/drawing_context.h" +#include "../video/surface.h" +#include "../app/globals.h" +#include "../video/font.h" using namespace SuperTux; Index: drawing_context.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- drawing_context.h 21 Jul 2004 16:51:53 -0000 1.2 +++ drawing_context.h 22 Jul 2004 19:07:51 -0000 1.3 @@ -24,9 +24,9 @@ #include "SDL.h" -#include "math/vector.h" -#include "video/screen.h" -#include "video/surface.h" +#include "../math/vector.h" +#include "../video/screen.h" +#include "../video/surface.h" namespace SuperTux { Index: font.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- font.h 21 Jul 2004 16:51:53 -0000 1.2 +++ font.h 22 Jul 2004 19:07:51 -0000 1.3 @@ -23,8 +23,8 @@ #include <string> -#include "video/surface.h" -#include "math/vector.h" +#include "../video/surface.h" +#include "../math/vector.h" namespace SuperTux { Index: surface.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/surface.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- surface.cpp 21 Jul 2004 16:51:53 -0000 1.2 +++ surface.cpp 22 Jul 2004 19:07:51 -0000 1.3 @@ -25,9 +25,9 @@ #include "SDL.h" #include "SDL_image.h" -#include "video/surface.h" -#include "app/globals.h" -#include "app/setup.h" +#include "../video/surface.h" +#include "../app/globals.h" +#include "../app/setup.h" using namespace SuperTux; Index: surface.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/surface.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- surface.h 21 Jul 2004 16:51:53 -0000 1.2 +++ surface.h 22 Jul 2004 19:07:51 -0000 1.3 @@ -30,8 +30,8 @@ #include "SDL.h" -#include "math/vector.h" -#include "video/screen.h" +#include "../math/vector.h" +#include "../video/screen.h" namespace SuperTux { Index: screen.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/screen.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- screen.cpp 21 Jul 2004 16:51:53 -0000 1.2 +++ screen.cpp 22 Jul 2004 19:07:51 -0000 1.3 @@ -33,11 +33,11 @@ #include <ctype.h> #endif -#include "video/screen.h" -#include "app/globals.h" -#include "video/drawing_context.h" -#include "special/base.h" -#include "math/vector.h" +#include "../video/screen.h" +#include "../app/globals.h" +#include "../video/drawing_context.h" +#include "../special/base.h" +#include "../math/vector.h" using namespace SuperTux; |
Update of /cvsroot/super-tux/supertux/lib/special In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9064/lib/special Modified Files: game_object.cpp moving_object.cpp moving_object.h sprite.cpp sprite.h sprite_manager.cpp sprite_manager.h stringlist.cpp timer.cpp Log Message: Had to change the #includes of dependend headers from "dir/header.h" to "../dir/header.h", so those 'dependencies' work correctly, if you want to use those headers from $(includedir) so to speak in a 3rd party projects. Index: moving_object.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/moving_object.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- moving_object.cpp 21 Jul 2004 16:51:52 -0000 1.2 +++ moving_object.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -17,7 +17,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "special/moving_object.h" +#include "../special/moving_object.h" using namespace SuperTux; Index: sprite_manager.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/sprite_manager.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sprite_manager.cpp 21 Jul 2004 16:51:52 -0000 1.2 +++ sprite_manager.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -19,8 +19,8 @@ #include <iostream> -#include "utils/lispreader.h" -#include "special/sprite_manager.h" +#include "../utils/lispreader.h" +#include "../special/sprite_manager.h" using namespace SuperTux; Index: sprite.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/sprite.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sprite.h 21 Jul 2004 16:51:52 -0000 1.2 +++ sprite.h 22 Jul 2004 19:07:50 -0000 1.3 @@ -23,9 +23,9 @@ #include <string> #include <vector> -#include "utils/lispreader.h" -#include "video/surface.h" -#include "math/vector.h" +#include "../utils/lispreader.h" +#include "../video/surface.h" +#include "../math/vector.h" namespace SuperTux { Index: timer.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/timer.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- timer.cpp 21 Jul 2004 16:51:52 -0000 1.2 +++ timer.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -19,7 +19,7 @@ // 02111-1307, USA. #include "SDL.h" -#include "special/timer.h" +#include "../special/timer.h" using namespace SuperTux; Index: stringlist.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/stringlist.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- stringlist.cpp 21 Jul 2004 16:51:52 -0000 1.2 +++ stringlist.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -20,7 +20,7 @@ #include "string.h" #include "stdlib.h" -#include "special/stringlist.h" +#include "../special/stringlist.h" using namespace SuperTux; Index: game_object.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/game_object.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- game_object.cpp 21 Jul 2004 16:51:52 -0000 1.2 +++ game_object.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -17,7 +17,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "special/game_object.h" +#include "../special/game_object.h" using namespace SuperTux; Index: sprite.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/sprite.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sprite.cpp 21 Jul 2004 16:51:52 -0000 1.2 +++ sprite.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -20,10 +20,10 @@ #include <iostream> #include <cmath> -#include "app/globals.h" -#include "app/setup.h" -#include "special/sprite.h" -#include "video/drawing_context.h" +#include "../app/globals.h" +#include "../app/setup.h" +#include "../special/sprite.h" +#include "../video/drawing_context.h" using namespace SuperTux; Index: sprite_manager.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/sprite_manager.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sprite_manager.h 21 Jul 2004 16:51:52 -0000 1.2 +++ sprite_manager.h 22 Jul 2004 19:07:50 -0000 1.3 @@ -22,7 +22,7 @@ #include <map> -#include "special/sprite.h" +#include "../special/sprite.h" namespace SuperTux { Index: moving_object.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/moving_object.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- moving_object.h 21 Jul 2004 16:51:52 -0000 1.2 +++ moving_object.h 22 Jul 2004 19:07:50 -0000 1.3 @@ -20,9 +20,9 @@ #ifndef SUPERTUX_MOVING_OBJECT_H #define SUPERTUX_MOVING_OBJECT_H -#include "special/base.h" -#include "special/game_object.h" -#include "math/vector.h" +#include "../special/base.h" +#include "../special/game_object.h" +#include "../math/vector.h" //#include "rectangle.h" namespace SuperTux |
From: Tobias G. <to...@us...> - 2004-07-22 19:08:01
|
Update of /cvsroot/super-tux/supertux/lib/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9064/lib/gui Modified Files: button.cpp button.h menu.cpp menu.h mousecursor.cpp mousecursor.h Log Message: Had to change the #includes of dependend headers from "dir/header.h" to "../dir/header.h", so those 'dependencies' work correctly, if you want to use those headers from $(includedir) so to speak in a 3rd party projects. Index: mousecursor.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/mousecursor.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- mousecursor.h 21 Jul 2004 16:51:51 -0000 1.3 +++ mousecursor.h 22 Jul 2004 19:07:50 -0000 1.4 @@ -22,8 +22,8 @@ #include <string> -#include "special/timer.h" -#include "video/surface.h" +#include "../special/timer.h" +#include "../video/surface.h" namespace SuperTux { Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/menu.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- menu.cpp 21 Jul 2004 16:51:51 -0000 1.2 +++ menu.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -29,15 +29,15 @@ #include <string> #include <cassert> -#include "app/globals.h" -#include "gui/menu.h" -#include "video/screen.h" -#include "video/drawing_context.h" -#include "app/setup.h" -#include "audio/sound.h" -#include "special/timer.h" -#include "app/gettext.h" -#include "math/vector.h" +#include "../app/globals.h" +#include "../gui/menu.h" +#include "../video/screen.h" +#include "../video/drawing_context.h" +#include "../app/setup.h" +#include "../audio/sound.h" +#include "../special/timer.h" +#include "../app/gettext.h" +#include "../math/vector.h" using namespace SuperTux; Index: menu.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/menu.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- menu.h 21 Jul 2004 16:51:51 -0000 1.2 +++ menu.h 22 Jul 2004 19:07:50 -0000 1.3 @@ -24,11 +24,11 @@ #include "SDL.h" -#include "video/surface.h" -#include "special/timer.h" -#include "special/base.h" -#include "special/stringlist.h" -#include "gui/mousecursor.h" +#include "../video/surface.h" +#include "../special/timer.h" +#include "../special/base.h" +#include "../special/stringlist.h" +#include "../gui/mousecursor.h" namespace SuperTux { Index: mousecursor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/mousecursor.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- mousecursor.cpp 21 Jul 2004 16:51:51 -0000 1.2 +++ mousecursor.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -17,8 +17,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "video/drawing_context.h" -#include "gui/mousecursor.h" +#include "../video/drawing_context.h" +#include "../gui/mousecursor.h" using namespace SuperTux; Index: button.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/button.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- button.h 21 Jul 2004 16:51:51 -0000 1.3 +++ button.h 22 Jul 2004 19:07:50 -0000 1.4 @@ -23,8 +23,8 @@ #include <vector> -#include "video/surface.h" -#include "special/timer.h" +#include "../video/surface.h" +#include "../special/timer.h" namespace SuperTux { Index: button.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/button.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- button.cpp 21 Jul 2004 11:56:48 -0000 1.2 +++ button.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -21,11 +21,11 @@ #include <cstring> #include <cstdlib> -#include "app/setup.h" -#include "video/screen.h" -#include "video/drawing_context.h" -#include "app/globals.h" -#include "gui/button.h" +#include "../app/setup.h" +#include "../video/screen.h" +#include "../video/drawing_context.h" +#include "../app/globals.h" +#include "../gui/button.h" using namespace SuperTux; |
From: Tobias G. <to...@us...> - 2004-07-22 19:08:00
|
Update of /cvsroot/super-tux/supertux/lib/math In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9064/lib/math Modified Files: physic.cpp physic.h vector.cpp Log Message: Had to change the #includes of dependend headers from "dir/header.h" to "../dir/header.h", so those 'dependencies' work correctly, if you want to use those headers from $(includedir) so to speak in a 3rd party projects. Index: vector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/math/vector.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- vector.cpp 21 Jul 2004 16:51:52 -0000 1.2 +++ vector.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -19,7 +19,7 @@ #include <cmath> -#include "math/vector.h" +#include "../math/vector.h" using namespace SuperTux; Index: physic.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/math/physic.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- physic.cpp 21 Jul 2004 16:51:51 -0000 1.3 +++ physic.cpp 22 Jul 2004 19:07:50 -0000 1.4 @@ -20,8 +20,8 @@ #include <cstdio> -#include "math/physic.h" -#include "special/timer.h" +#include "../math/physic.h" +#include "../special/timer.h" using namespace SuperTux; Index: physic.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/math/physic.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- physic.h 21 Jul 2004 16:51:52 -0000 1.4 +++ physic.h 22 Jul 2004 19:07:50 -0000 1.5 @@ -21,7 +21,7 @@ #ifndef SUPERTUX_PHYSIC_H #define SUPERTUX_PHYSIC_H -#include "math/vector.h" +#include "../math/vector.h" namespace SuperTux { |
From: Tobias G. <to...@us...> - 2004-07-22 19:07:59
|
Update of /cvsroot/super-tux/supertux/lib/audio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9064/lib/audio Modified Files: musicref.cpp musicref.h sound.cpp sound_manager.cpp sound_manager.h Log Message: Had to change the #includes of dependend headers from "dir/header.h" to "../dir/header.h", so those 'dependencies' work correctly, if you want to use those headers from $(includedir) so to speak in a 3rd party projects. Index: sound_manager.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/sound_manager.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sound_manager.cpp 21 Jul 2004 16:51:50 -0000 1.2 +++ sound_manager.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -20,12 +20,12 @@ #include <cmath> #include <cassert> -#include "audio/sound_manager.h" -#include "audio/musicref.h" -#include "audio/sound.h" -#include "app/globals.h" -#include "app/setup.h" -#include "special/moving_object.h" +#include "../audio/sound_manager.h" +#include "../audio/musicref.h" +#include "../audio/sound.h" +#include "../app/globals.h" +#include "../app/setup.h" +#include "../special/moving_object.h" using namespace SuperTux; Index: musicref.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/musicref.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- musicref.cpp 21 Jul 2004 16:51:50 -0000 1.2 +++ musicref.cpp 22 Jul 2004 19:07:49 -0000 1.3 @@ -18,7 +18,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "audio/musicref.h" +#include "../audio/musicref.h" using namespace SuperTux; Index: sound_manager.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/sound_manager.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- sound_manager.h 21 Jul 2004 16:51:50 -0000 1.4 +++ sound_manager.h 22 Jul 2004 19:07:50 -0000 1.5 @@ -24,7 +24,7 @@ #include <map> #include "SDL_mixer.h" -#include "math/vector.h" +#include "../math/vector.h" namespace SuperTux { Index: musicref.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/musicref.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- musicref.h 21 Jul 2004 16:51:50 -0000 1.2 +++ musicref.h 22 Jul 2004 19:07:50 -0000 1.3 @@ -20,7 +20,7 @@ #ifndef SUPERTUX_MUSICREF_H #define SUPERTUX_MUSICREF_H -#include "audio/sound_manager.h" +#include "../audio/sound_manager.h" namespace SuperTux { Index: sound.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/sound.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sound.cpp 21 Jul 2004 16:51:50 -0000 1.2 +++ sound.cpp 22 Jul 2004 19:07:50 -0000 1.3 @@ -19,7 +19,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <string> -#include "audio/sound.h" +#include "../audio/sound.h" /*global variable*/ bool use_sound = true; /* handle sound on/off menu and command-line option */ |
From: Tobias G. <to...@us...> - 2004-07-22 19:07:58
|
Update of /cvsroot/super-tux/supertux/lib/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9064/lib/app Modified Files: globals.cpp globals.h setup.cpp setup.h Log Message: Had to change the #includes of dependend headers from "dir/header.h" to "../dir/header.h", so those 'dependencies' work correctly, if you want to use those headers from $(includedir) so to speak in a 3rd party projects. Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- setup.cpp 21 Jul 2004 16:51:50 -0000 1.2 +++ setup.cpp 22 Jul 2004 19:07:49 -0000 1.3 @@ -41,15 +41,15 @@ #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; Index: globals.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/globals.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- globals.cpp 21 Jul 2004 16:51:50 -0000 1.2 +++ globals.cpp 22 Jul 2004 19:07:49 -0000 1.3 @@ -18,7 +18,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. -#include "app/globals.h" +#include "../app/globals.h" namespace SuperTux { Index: setup.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- setup.h 21 Jul 2004 16:51:50 -0000 1.2 +++ setup.h 22 Jul 2004 19:07:49 -0000 1.3 @@ -22,9 +22,9 @@ #include <vector> #include <string> -#include "gui/menu.h" -#include "audio/sound.h" -#include "special/base.h" +#include "../gui/menu.h" +#include "../audio/sound.h" +#include "../special/base.h" namespace SuperTux { Index: globals.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/globals.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- globals.h 21 Jul 2004 16:51:50 -0000 1.2 +++ globals.h 22 Jul 2004 19:07:49 -0000 1.3 @@ -26,9 +26,9 @@ #include "SDL.h" -#include "video/font.h" -#include "gui/menu.h" -#include "gui/mousecursor.h" +#include "../video/font.h" +#include "../gui/menu.h" +#include "../gui/mousecursor.h" namespace SuperTux { |
From: Tobias G. <to...@us...> - 2004-07-22 19:04:54
|
Update of /cvsroot/super-tux/supertux/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8497/lib Modified Files: Makefile.am Log Message: Headers should now be correctly handled and get installed in $(includedir)/supertux/ . Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 20 Jul 2004 17:51:17 -0000 1.1 +++ Makefile.am 22 Jul 2004 19:04:45 -0000 1.2 @@ -1,32 +1,63 @@ INCLUDES = METASOURCES = AUTO lib_LTLIBRARIES = libsupertux.la -libsupertux_la_SOURCES =app/defines.h \ +libsupertux_la_SOURCES =app/globals.cpp \ + app/setup.cpp \ + audio/musicref.cpp \ + audio/sound.cpp \ + audio/sound_manager.cpp \ + gui/button.cpp \ + gui/menu.cpp \ + gui/mousecursor.cpp \ + math/physic.cpp \ + math/vector.cpp \ + special/game_object.cpp \ + special/moving_object.cpp \ + special/sprite.cpp \ + special/sprite_manager.cpp \ + special/stringlist.cpp \ + special/timer.cpp \ + utils/configfile.cpp \ + utils/lispreader.cpp \ + utils/lispwriter.cpp \ + video/drawing_context.cpp \ + video/font.cpp \ + video/screen.cpp \ + video/surface.cpp +libsupertuxdir = $(includedir)/supertux +libsupertuxappdir = $(libsupertuxdir)/app +libsupertuxaudiodir = $(libsupertuxdir)/audio +libsupertuxguidir = $(libsupertuxdir)/gui +libsupertuxmathdir = $(libsupertuxdir)/math +libsupertuxspecialdir = $(libsupertuxdir)/special +libsupertuxutilsdir = $(libsupertuxdir)/utils +libsupertuxvideodir = $(libsupertuxdir)/video +libsupertuxapp_HEADERS =app/defines.h \ + app/setup.h \ app/gettext.h \ - app/globals.h app/globals.cpp \ - app/setup.h app/setup.cpp \ - audio/musicref.h audio/musicref.cpp \ - audio/sound.h audio/sound.cpp \ - audio/sound_manager.h audio/sound_manager.cpp \ - gui/button.h gui/button.cpp \ - gui/menu.h gui/menu.cpp \ - gui/mousecursor.cpp gui/mousecursor.h \ - math/physic.h math/physic.cpp \ - math/vector.h math/vector.cpp \ - special/base.h \ - special/game_object.h special/game_object.cpp \ - special/moving_object.h special/moving_object.cpp \ - special/sprite.h special/sprite.cpp \ - special/sprite_manager.h special/sprite_manager.cpp \ - special/stringlist.h special/stringlist.cpp \ - special/timer.h special/timer.cpp \ - utils/configfile.h utils/configfile.cpp \ + app/globals.h +libsupertuxaudio_HEADERS =audio/musicref.h \ + audio/sound.h \ + audio/sound_manager.h +libsupertuxgui_HEADERS =gui/button.h \ + gui/menu.h \ + gui/mousecursor.h +libsupertuxmath_HEADERS =math/physic.h \ + math/vector.h +libsupertuxspecial_HEADERS =special/base.h \ + special/game_object.h \ + special/moving_object.h \ + special/sprite.h \ + special/sprite_manager.h \ + special/stringlist.h \ + special/timer.h +libsupertuxutils_HEADERS =utils/configfile.h \ utils/exceptions.h \ - utils/lispreader.h utils/lispreader.cpp \ - utils/lispwriter.h utils/lispwriter.cpp \ - video/drawing_context.h video/drawing_context.cpp \ - video/font.h video/font.cpp \ - video/screen.h video/screen.cpp \ - video/surface.h video/surface.cpp + utils/lispreader.h \ + utils/lispwriter.h +libsupertuxvideo_HEADERS =video/drawing_context.h \ + video/font.h \ + video/screen.h \ + video/surface.h libsupertux_la_LDFLAGS = -module |
From: Ricardo C. <rm...@us...> - 2004-07-22 13:52:54
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/src Modified Files: Tag: supertux_0_1_1_branch gameloop.cpp Log Message: Fixed the reset point bug in auto-scrolling that changed Tux position, but not camera's. (Not tested.) Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.124.2.1 retrieving revision 1.124.2.2 diff -u -d -r1.124.2.1 -r1.124.2.2 --- gameloop.cpp 15 May 2004 22:22:54 -0000 1.124.2.1 +++ gameloop.cpp 22 Jul 2004 13:52:44 -0000 1.124.2.2 @@ -119,6 +119,9 @@ { world->get_tux()->base.x = best_reset_point.x; world->get_tux()->base.y = best_reset_point.y; + + if((bool)world->get_level()->hor_autoscroll_speed) + scroll_x = best_reset_point.x; } } |
From: Ricardo C. <rm...@us...> - 2004-07-22 09:41:28
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10673/src Modified Files: Tag: supertux_0_1_1_branch title.cpp Log Message: Just added fadeout. Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.81.2.3 retrieving revision 1.81.2.4 diff -u -d -r1.81.2.3 -r1.81.2.4 --- title.cpp 19 Jul 2004 11:41:54 -0000 1.81.2.3 +++ title.cpp 22 Jul 2004 09:41:19 -0000 1.81.2.4 @@ -140,6 +140,9 @@ } else if(index < worldmap_list.num_items + (int)contrib_subsets.size()) { + // Loading fade + fadeout(); + WorldMapNS::WorldMap worldmap; worldmap.loadmap(worldmap_list.item[index - contrib_subsets.size()]); // worldmap.set_levels_as_solved(); |
From: Tobias G. <to...@us...> - 2004-07-21 19:40:18
|
Update of /cvsroot/super-tux/supertux/lib/special In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10355/lib/special Modified Files: base.h Log Message: Fixed typo. Index: base.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/base.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- base.h 21 Jul 2004 16:51:52 -0000 1.3 +++ base.h 21 Jul 2004 19:40:09 -0000 1.4 @@ -30,7 +30,7 @@ /// 'Base' type for game objects. /** Mainly for layered use in game objects. - Containts upper left X and Y coordinates of an + Contains upper left X and Y coordinates of an object along with its width and height. */ struct base_type { |
From: Tobias G. <to...@us...> - 2004-07-21 16:52:39
|
Update of /cvsroot/super-tux/supertux/lib/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32238/lib/app Modified Files: globals.cpp globals.h setup.cpp setup.h Log Message: The SuperTux library features a SuperTux namespace now. + minor Bugfixes and cleanups Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- setup.cpp 20 Jul 2004 17:51:34 -0000 1.1 +++ setup.cpp 21 Jul 2004 16:51:50 -0000 1.2 @@ -51,6 +51,7 @@ #include "audio/sound_manager.h" #include "app/gettext.h" +using namespace SuperTux; #ifdef WIN32 #define mkdir(dir, mode) mkdir(dir) @@ -70,7 +71,7 @@ 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) @@ -87,7 +88,7 @@ } /* Can we write to this location? */ -int fwriteable(const char *filename) +int SuperTux::fwriteable(const char *filename) { FILE* fi; fi = fopen(filename, "wa"); @@ -99,7 +100,7 @@ } /* 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); @@ -121,7 +122,7 @@ } } -FILE * opendata(const char * rel_filename, const char * mode) +FILE * SuperTux::opendata(const char * rel_filename, const char * mode) { char * filename = NULL; FILE * fi; @@ -154,7 +155,7 @@ /* 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; @@ -224,7 +225,7 @@ 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; @@ -289,7 +290,7 @@ 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) @@ -298,7 +299,7 @@ /* --- SETUP --- */ /* Set SuperTux configuration and save directories */ -void st_directory_setup(void) +void SuperTux::st_directory_setup(void) { char *home; char str[1024]; @@ -365,7 +366,7 @@ printf("Datadir: %s\n", datadir.c_str()); } -void st_general_setup(void) +void SuperTux::st_general_setup(void) { /* Seed random number generator: */ @@ -406,7 +407,7 @@ } -void st_general_free(void) +void SuperTux::st_general_free(void) { /* Free global images: */ @@ -428,20 +429,9 @@ /* 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) @@ -465,7 +455,7 @@ SDL_WM_SetCaption("SuperTux " VERSION, "SuperTux"); } -void st_video_setup_sdl(void) +void SuperTux::st_video_setup_sdl(void) { if (use_fullscreen) { @@ -495,7 +485,7 @@ } } -void st_video_setup_gl(void) +void SuperTux::st_video_setup_gl(void) { #ifndef NOOPENGL @@ -551,7 +541,7 @@ } -void st_joystick_setup(void) +void SuperTux::st_joystick_setup(void) { /* Init Joystick: */ @@ -612,7 +602,7 @@ } } -void st_audio_setup(void) +void SuperTux::st_audio_setup(void) { /* Init SDL Audio silently even if --disable-sound : */ @@ -670,7 +660,7 @@ /* --- SHUTDOWN --- */ -void st_shutdown(void) +void SuperTux::st_shutdown(void) { close_audio(); SDL_Quit(); @@ -679,7 +669,7 @@ /* --- 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(); @@ -729,7 +719,7 @@ /* Parse command-line arguments: */ -void parseargs(int argc, char * argv[]) +void SuperTux::parseargs(int argc, char * argv[]) { int i; @@ -913,7 +903,7 @@ 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; Index: globals.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/globals.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- globals.cpp 20 Jul 2004 17:51:34 -0000 1.1 +++ globals.cpp 21 Jul 2004 16:51:50 -0000 1.2 @@ -20,6 +20,8 @@ #include "app/globals.h" +namespace SuperTux { + /** The datadir prefix prepended when loading game data file */ std::string datadir; @@ -122,3 +124,5 @@ return 0; } + +} //namespace SuperTux Index: setup.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- setup.h 20 Jul 2004 17:51:34 -0000 1.1 +++ setup.h 21 Jul 2004 16:51:50 -0000 1.2 @@ -26,6 +26,8 @@ #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); @@ -48,5 +50,7 @@ void parseargs(int argc, char * argv[]); +} + #endif /*SUPERTUX_SETUP_H*/ Index: globals.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/globals.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- globals.h 20 Jul 2004 17:51:34 -0000 1.1 +++ globals.h 21 Jul 2004 16:51:50 -0000 1.2 @@ -30,54 +30,59 @@ #include "gui/menu.h" #include "gui/mousecursor.h" -extern std::string datadir; +namespace SuperTux + { -struct JoystickKeymap -{ - int a_button; - int b_button; - int start_button; + extern std::string datadir; - int x_axis; - int y_axis; - - int dead_zone; + struct JoystickKeymap + { + int a_button; + int b_button; + int start_button; - JoystickKeymap(); -}; + int x_axis; + int y_axis; -extern JoystickKeymap joystick_keymap; + int dead_zone; -extern SDL_Surface* screen; -extern Font* gold_text; -extern Font* white_text; -extern Font* blue_text; -extern Font* gray_text; -extern Font* white_small_text; -extern Font* white_big_text; -extern Font* yellow_nums; + JoystickKeymap(); + }; -extern MouseCursor * mouse_cursor; + extern JoystickKeymap joystick_keymap; -extern bool use_gl; -extern bool use_joystick; -extern bool use_fullscreen; -extern bool debug_mode; -extern bool show_fps; + extern SDL_Surface* screen; + extern Font* gold_text; + extern Font* white_text; + extern Font* blue_text; + extern Font* gray_text; + extern Font* white_small_text; + extern Font* white_big_text; + extern Font* yellow_nums; -/** The number of the joystick that will be use in the game */ -extern int joystick_num; -extern char* level_startup_file; -extern bool launch_leveleditor_mode; -extern bool launch_worldmap_mode; + extern MouseCursor * mouse_cursor; -/* SuperTux directory ($HOME/.supertux) and save directory($HOME/.supertux/save) */ -extern char* st_dir; -extern char* st_save_dir; + extern bool use_gl; + extern bool use_joystick; + extern bool use_fullscreen; + extern bool debug_mode; + extern bool show_fps; -extern float game_speed; -extern SDL_Joystick * js; + /** The number of the joystick that will be use in the game */ + extern int joystick_num; + extern char* level_startup_file; + extern bool launch_leveleditor_mode; + extern bool launch_worldmap_mode; -int wait_for_event(SDL_Event& event,unsigned int min_delay = 0, unsigned int max_delay = 0, bool empty_events = false); + /* SuperTux directory ($HOME/.supertux) and save directory($HOME/.supertux/save) */ + extern char* st_dir; + extern char* st_save_dir; + + extern float game_speed; + extern SDL_Joystick * js; + + int wait_for_event(SDL_Event& event,unsigned int min_delay = 0, unsigned int max_delay = 0, bool empty_events = false); + +} //namespace SuperTux #endif /* SUPERTUX_GLOBALS_H */ |
From: Tobias G. <to...@us...> - 2004-07-21 16:52:31
|
Update of /cvsroot/super-tux/supertux/lib/audio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32238/lib/audio Modified Files: musicref.cpp musicref.h sound.cpp sound_manager.cpp sound_manager.h Log Message: The SuperTux library features a SuperTux namespace now. + minor Bugfixes and cleanups Index: sound_manager.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/sound_manager.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- sound_manager.cpp 20 Jul 2004 17:51:35 -0000 1.1 +++ sound_manager.cpp 21 Jul 2004 16:51:50 -0000 1.2 @@ -27,6 +27,8 @@ #include "app/setup.h" #include "special/moving_object.h" +using namespace SuperTux; + SoundManager::SoundManager() : current_music(0), music_enabled(true) { Index: musicref.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/musicref.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- musicref.cpp 20 Jul 2004 17:51:34 -0000 1.1 +++ musicref.cpp 21 Jul 2004 16:51:50 -0000 1.2 @@ -20,6 +20,8 @@ #include "audio/musicref.h" +using namespace SuperTux; + MusicRef::MusicRef() : music(0) { Index: sound_manager.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/sound_manager.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sound_manager.h 20 Jul 2004 20:33:14 -0000 1.3 +++ sound_manager.h 21 Jul 2004 16:51:50 -0000 1.4 @@ -26,65 +26,70 @@ #include "SDL_mixer.h" #include "math/vector.h" -class MusicRef; -class MovingObject; +namespace SuperTux + { -/// Sound manager -/** This class handles all sounds that are played - */ -class SoundManager -{ -public: - SoundManager(); - ~SoundManager(); + class MusicRef; + class MovingObject; - /// Play sound. - void play_sound(Mix_Chunk* sound); - /// Play sound relative to two Vectors. - void play_sound(Mix_Chunk* sound, const Vector& pos, const Vector& pos2); - /// Play sound relative to a MovingObject and a Vector. - void play_sound(Mix_Chunk* sound, const MovingObject* object, const Vector& pos); + /// Sound manager + /** This class handles all sounds that are played + */ + class SoundManager + { + public: + SoundManager(); + ~SoundManager(); - /// Load music. - /** Is used to load the music for a MusicRef. */ - MusicRef load_music(const std::string& file); - /// Test if a certain music file exists. - bool exists_music(const std::string& filename); - - /// Play music. - /** @Param loops: Defaults to -1, which means endless loops. */ - void play_music(const MusicRef& music, int loops = -1); - - /// Halt music. - void halt_music(); + /// Play sound. + void play_sound(Mix_Chunk* sound); + /// Play sound relative to two Vectors. + void play_sound(Mix_Chunk* sound, const Vector& pos, const Vector& pos2); + /// Play sound relative to a MovingObject and a Vector. + void play_sound(Mix_Chunk* sound, const MovingObject* object, const Vector& pos); - /// Enable/Disable music. - void enable_music(bool enable); + /// Load music. + /** Is used to load the music for a MusicRef. */ + MusicRef load_music(const std::string& file); + /// Test if a certain music file exists. + bool exists_music(const std::string& filename); -private: - // music part - friend class MusicRef; - - /// Resource for music. - /** Contains the raw music data and - information for music reference - counting. */ - class MusicResource - { - public: - ~MusicResource(); + /// Play music. + /** @param loops: Defaults to -1, which means endless loops. */ + void play_music(const MusicRef& music, int loops = -1); - SoundManager* manager; - Mix_Music* music; - int refcount; - }; + /// Halt music. + void halt_music(); - void free_music(MusicResource* music); + /// Enable/Disable music. + void enable_music(bool enable); - std::map<std::string, MusicResource> musics; - MusicResource* current_music; - bool music_enabled; -}; + private: + // music part + friend class MusicRef; + + /// Resource for music. + /** Contains the raw music data and + information for music reference + counting. */ + class MusicResource + { + public: + ~MusicResource(); + + SoundManager* manager; + Mix_Music* music; + int refcount; + }; + + void free_music(MusicResource* music); + + std::map<std::string, MusicResource> musics; + MusicResource* current_music; + bool music_enabled; + }; + +} // namespace SuperTux #endif /*SUPERTUX_SOUND_MANAGER_H*/ Index: musicref.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/musicref.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- musicref.h 20 Jul 2004 17:51:34 -0000 1.1 +++ musicref.h 21 Jul 2004 16:51:50 -0000 1.2 @@ -22,24 +22,29 @@ #include "audio/sound_manager.h" -/** This class holds a reference to a music file and maintains a correct - * refcount for that file. - */ -class MusicRef -{ -public: - MusicRef(); - MusicRef(const MusicRef& other); - ~MusicRef(); +namespace SuperTux + { - MusicRef& operator= (const MusicRef& other); + /** This class holds a reference to a music file and maintains a correct + * refcount for that file. + */ + class MusicRef + { + public: + MusicRef(); + MusicRef(const MusicRef& other); + ~MusicRef(); -private: - friend class SoundManager; - MusicRef(SoundManager::MusicResource* music); - - SoundManager::MusicResource* music; -}; + MusicRef& operator= (const MusicRef& other); + + private: + friend class SoundManager; + MusicRef(SoundManager::MusicResource* music); + + SoundManager::MusicResource* music; + }; + +} //namespace SuperTux #endif /*SUPERTUX_MUSICREF_H*/ |
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32238/src Modified Files: badguy.h camera.cpp camera.h collision.h door.cpp door.h gameloop.h gameobjs.h high_scores.cpp interactive_object.h intro.cpp level.h level_subset.cpp level_subset.h misc.cpp particlesystem.h player.h resources.cpp resources.h sector.h serializable.h tile.h tilemap.h Log Message: The SuperTux library features a SuperTux namespace now. + minor Bugfixes and cleanups Index: resources.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- resources.h 20 Jul 2004 18:04:48 -0000 1.12 +++ resources.h 21 Jul 2004 16:51:53 -0000 1.13 @@ -21,9 +21,14 @@ #define SUPERTUX_RESOURCES_H #include "audio/musicref.h" +#include "gui/menu.h" + +using namespace SuperTux; +namespace SuperTux { class SpriteManager; class SoundManager; +} /* Sound files: */ enum { @@ -66,6 +71,17 @@ extern SpriteManager* sprite_manager; extern SoundManager* sound_manager; +extern Menu* contrib_menu; +extern Menu* contrib_subset_menu; +extern Menu* main_menu; +extern Menu* game_menu; +extern Menu* options_menu; +extern Menu* options_keys_menu; +extern Menu* options_joystick_menu; +extern Menu* highscore_menu; +extern Menu* load_game_menu; +extern Menu* save_game_menu; + void loadshared(); void unloadshared(); Index: misc.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/misc.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- misc.cpp 20 Jul 2004 17:59:37 -0000 1.1 +++ misc.cpp 21 Jul 2004 16:51:53 -0000 1.2 @@ -189,7 +189,18 @@ highscore_menu->additem(MN_TEXTFIELD,_("Enter your name:"),0,0); } +/* Free menus */ void st_menu_free() { delete worldmap_menu; + 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; } Index: level_subset.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level_subset.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- level_subset.cpp 20 Jul 2004 18:04:48 -0000 1.4 +++ level_subset.cpp 21 Jul 2004 16:51:53 -0000 1.5 @@ -25,6 +25,8 @@ #include "video/surface.h" #include "level_subset.h" +using namespace SuperTux; + static bool has_suffix(const std::string& data, const std::string& suffix) { if (data.length() >= suffix.length()) Index: collision.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/collision.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- collision.h 20 Jul 2004 18:04:47 -0000 1.18 +++ collision.h 21 Jul 2004 16:51:53 -0000 1.19 @@ -23,6 +23,8 @@ #include "special/base.h" +using namespace SuperTux; + class Tile; /* Collision objects */ Index: sector.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- sector.h 20 Jul 2004 18:04:48 -0000 1.8 +++ sector.h 21 Jul 2004 16:51:53 -0000 1.9 @@ -29,7 +29,13 @@ #include "audio/musicref.h" #include "video/drawing_context.h" +using namespace SuperTux; + +namespace SuperTux { class GameObject; +class LispReader; +} + class InteractiveObject; class Background; class Player; @@ -40,8 +46,6 @@ class Upgrade; class Bullet; class BadGuy; -class Vector; -class LispReader; class Tile; struct SpawnPoint Index: badguy.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.h,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- badguy.h 20 Jul 2004 18:04:47 -0000 1.59 +++ badguy.h 21 Jul 2004 16:51:53 -0000 1.60 @@ -35,6 +35,8 @@ #include "serializable.h" #include "scene.h" +using namespace SuperTux; + /* Timing constants (in ms): */ #define KICKING_TIME 200 Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- gameloop.h 20 Jul 2004 18:04:47 -0000 1.54 +++ gameloop.h 21 Jul 2004 16:51:53 -0000 1.55 @@ -26,6 +26,8 @@ #include "audio/sound.h" #include "special/base.h" +using namespace SuperTux; + /* GameLoop modes */ #define ST_GL_PLAY 0 @@ -34,7 +36,6 @@ #define ST_GL_LOAD_LEVEL_FILE 3 #define ST_GL_DEMO_GAME 4 - enum GameMenuIDs { MNID_CONTINUE, MNID_ABORTLEVEL @@ -44,7 +45,10 @@ class Level; class Sector; + +namespace SuperTux { class DrawingContext; +} /** The GameSession class controlls the controll flow of a World, ie. present the menu on specifc keypresses, render and update it while Index: door.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/door.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- door.cpp 20 Jul 2004 18:04:47 -0000 1.6 +++ door.cpp 21 Jul 2004 16:51:53 -0000 1.7 @@ -27,6 +27,8 @@ #include "video/drawing_context.h" #include "app/globals.h" +using namespace SuperTux; + /** data images */ Sprite* door; Surface* door_opening[DOOR_OPENING_FRAMES]; Index: camera.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/camera.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- camera.cpp 20 Jul 2004 18:04:47 -0000 1.13 +++ camera.cpp 21 Jul 2004 16:51:53 -0000 1.14 @@ -29,6 +29,8 @@ #include "app/globals.h" #include "sector.h" +using namespace SuperTux; + Camera::Camera(Sector* newsector) : sector(newsector), do_backscrolling(true), scrollchange(NONE), auto_idx(0), auto_t(0) Index: high_scores.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/high_scores.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- high_scores.cpp 20 Jul 2004 18:04:47 -0000 1.23 +++ high_scores.cpp 21 Jul 2004 16:51:53 -0000 1.24 @@ -31,6 +31,9 @@ #include "video/surface.h" #include "app/setup.h" #include "utils/lispreader.h" +#include "resources.h" + +using namespace SuperTux; #ifdef WIN32 const char * highscore_filename = "/st_highscore.dat"; Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- resources.cpp 20 Jul 2004 18:04:48 -0000 1.42 +++ resources.cpp 21 Jul 2004 16:51:53 -0000 1.43 @@ -37,6 +37,17 @@ Surface* img_cloud[2][4]; Surface* img_distro[4]; +Menu* main_menu = 0; +Menu* game_menu = 0; +Menu* options_menu = 0; +Menu* options_keys_menu = 0; +Menu* options_joystick_menu = 0; +Menu* highscore_menu = 0; +Menu* load_game_menu = 0; +Menu* save_game_menu = 0; +Menu* contrib_menu = 0; +Menu* contrib_subset_menu = 0; + MusicRef herring_song; MusicRef level_end_song; Index: tile.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- tile.h 20 Jul 2004 18:04:48 -0000 1.31 +++ tile.h 21 Jul 2004 16:51:53 -0000 1.32 @@ -25,8 +25,11 @@ #include "SDL.h" #include "video/surface.h" -class Vector; +using namespace SuperTux; + +namespace SuperTux { class LispReader; +} /** Tile Class Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.h,v retrieving revision 1.75 retrieving revision 1.76 diff -u -d -r1.75 -r1.76 --- player.h 20 Jul 2004 18:04:48 -0000 1.75 +++ player.h 21 Jul 2004 16:51:53 -0000 1.76 @@ -32,6 +32,8 @@ #include "math/physic.h" #include "app/defines.h" +using namespace SuperTux; + class BadGuy; /* Times: */ @@ -86,7 +88,9 @@ void player_input_init(player_input_type* pplayer_input); +namespace SuperTux { class Sprite; +} class Camera; extern Surface* tux_life; Index: door.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/door.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- door.h 20 Jul 2004 18:04:47 -0000 1.6 +++ door.h 21 Jul 2004 16:51:53 -0000 1.7 @@ -27,9 +27,10 @@ #include "serializable.h" #include "special/timer.h" +namespace SuperTux { class Sprite; - class LispReader; +} /** data images */ #define DOOR_OPENING_TIME 1500 Index: level_subset.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level_subset.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- level_subset.h 20 Jul 2004 18:04:48 -0000 1.3 +++ level_subset.h 21 Jul 2004 16:51:53 -0000 1.4 @@ -25,7 +25,11 @@ #include <string> #include "utils/lispreader.h" +using namespace SuperTux; + +namespace SuperTux { class Surface; +}; /** This type holds meta-information about a level-subset. It could be extended to handle manipulation of subsets. */ Index: gameobjs.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- gameobjs.h 20 Jul 2004 18:04:47 -0000 1.30 +++ gameobjs.h 21 Jul 2004 16:51:53 -0000 1.31 @@ -37,7 +37,9 @@ #define NO_BOUNCE 0 #define BOUNCE 1 +namespace SuperTux { class Sprite; +} struct TileId; Index: tilemap.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tilemap.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- tilemap.h 20 Jul 2004 18:04:48 -0000 1.12 +++ tilemap.h 21 Jul 2004 16:51:53 -0000 1.13 @@ -26,9 +26,14 @@ #include "serializable.h" #include "math/vector.h" +using namespace SuperTux; + +namespace SuperTux { +class LispReader; +} + class Level; class TileManager; -class LispReader; class Tile; struct TileId Index: particlesystem.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/particlesystem.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- particlesystem.h 20 Jul 2004 18:04:48 -0000 1.11 +++ particlesystem.h 21 Jul 2004 16:51:53 -0000 1.12 @@ -26,7 +26,12 @@ #include "special/game_object.h" #include "serializable.h" +using namespace SuperTux; + +namespace SuperTux { class LispReader; +} + class DisplayManager; /** Index: serializable.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/serializable.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- serializable.h 9 Jun 2004 05:23:20 -0000 1.3 +++ serializable.h 21 Jul 2004 16:51:53 -0000 1.4 @@ -20,7 +20,11 @@ #ifndef SUPERTUX_SERIALIZABLE_H #define SUPERTUX_SERIALIZABLE_H +using namespace SuperTux; + +namespace SuperTux { class LispWriter; +} class Serializable { Index: camera.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/camera.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- camera.h 20 Jul 2004 18:04:47 -0000 1.10 +++ camera.h 21 Jul 2004 16:51:53 -0000 1.11 @@ -26,9 +26,15 @@ #include "app/defines.h" #include "math/vector.h" #include "special/game_object.h" +#include "video/drawing_context.h" #include "serializable.h" +using namespace SuperTux; + +namespace SuperTux { class LispReader; +} + class Sector; class Camera : public GameObject, public Serializable Index: interactive_object.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/interactive_object.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- interactive_object.h 20 Jul 2004 18:04:47 -0000 1.4 +++ interactive_object.h 21 Jul 2004 16:51:53 -0000 1.5 @@ -23,6 +23,8 @@ #include "special/game_object.h" #include "special/base.h" +using namespace SuperTux; + enum InteractionType { INTERACTION_TOUCH, INTERACTION_ACTIVATE // more to come Index: intro.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/intro.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- intro.cpp 20 Jul 2004 18:04:47 -0000 1.28 +++ intro.cpp 21 Jul 2004 16:51:53 -0000 1.29 @@ -23,6 +23,8 @@ #include "video/font.h" #include "video/screen.h" +using namespace SuperTux; + void draw_intro() { display_text_file("intro.txt", 1); Index: level.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.h,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- level.h 7 Jul 2004 17:56:01 -0000 1.61 +++ level.h 21 Jul 2004 16:51:53 -0000 1.62 @@ -24,8 +24,13 @@ #include <map> #include <string> +using namespace SuperTux; + class Sector; + +namespace SuperTux { class LispReader; +} class Level { |
From: Tobias G. <to...@us...> - 2004-07-21 16:52:05
|
Update of /cvsroot/super-tux/supertux/lib/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32238/lib/video Modified Files: drawing_context.cpp drawing_context.h font.cpp font.h screen.cpp screen.h surface.cpp surface.h Log Message: The SuperTux library features a SuperTux namespace now. + minor Bugfixes and cleanups Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- font.cpp 20 Jul 2004 17:51:39 -0000 1.1 +++ font.cpp 21 Jul 2004 16:51:53 -0000 1.2 @@ -27,6 +27,8 @@ #include "video/drawing_context.h" #include "utils/lispreader.h" +using namespace SuperTux; + Font::Font(const std::string& file, FontType ntype, int nw, int nh, int nshadowsize) : chars(0), shadow_chars(0), type(ntype), w(nw), h(nh), @@ -129,7 +131,7 @@ #define SCROLL 60 #define ITEMS_SPACE 4 -void display_text_file(const std::string& file, float scroll_speed) +void SuperTux::display_text_file(const std::string& file, float scroll_speed) { std::string text; std::vector<std::string> names; Index: drawing_context.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- drawing_context.cpp 20 Jul 2004 17:51:39 -0000 1.1 +++ drawing_context.cpp 21 Jul 2004 16:51:53 -0000 1.2 @@ -25,6 +25,8 @@ #include "app/globals.h" #include "video/font.h" +using namespace SuperTux; + DrawingContext::DrawingContext() { transform.draw_effect = NONE_EFFECT; Index: surface.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/surface.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- surface.h 20 Jul 2004 17:51:39 -0000 1.1 +++ surface.h 21 Jul 2004 16:51:53 -0000 1.2 @@ -30,148 +30,159 @@ #include "SDL.h" -#include "video/screen.h" #include "math/vector.h" +#include "video/screen.h" -SDL_Surface* sdl_surface_from_sdl_surface(SDL_Surface* sdl_surf, bool use_alpha); -SDL_Surface* sdl_surface_from_nothing(); - -class SurfaceImpl; -class SurfaceSDL; -class SurfaceOpenGL; -class DrawingContext; +namespace SuperTux + { + + SDL_Surface* sdl_surface_from_sdl_surface(SDL_Surface* sdl_surf, bool use_alpha); + SDL_Surface* sdl_surface_from_nothing(); -/// bitset for drawing effects -enum { - /** Don't apply anything */ - NONE_EFFECT = 0x0000, - /** Draw the Surface upside down */ - VERTICAL_FLIP = 0x0001, - /** Draw the Surface with alpha equal to 128 */ - SEMI_TRANSPARENT = 0x0002 + class SurfaceImpl; + class SurfaceSDL; + class SurfaceOpenGL; + class DrawingContext; + + /// bitset for drawing effects + enum { + /** Don't apply anything */ + NONE_EFFECT = 0x0000, + /** Draw the Surface upside down */ + VERTICAL_FLIP = 0x0001, + /** Draw the Surface with alpha equal to 128 */ + SEMI_TRANSPARENT = 0x0002 }; -/** This class holds all the data necessary to construct a surface */ -class SurfaceData -{ -public: - enum ConstructorType { LOAD, LOAD_PART, SURFACE, GRADIENT }; - ConstructorType type; - SDL_Surface* surface; - std::string file; - bool use_alpha; - int x; - int y; - int w; - int h; - Color top_gradient; - Color bottom_gradient; + /** This class holds all the data necessary to construct a surface */ + class SurfaceData + { + public: + enum ConstructorType { LOAD, LOAD_PART, SURFACE, GRADIENT }; + ConstructorType type; + SDL_Surface* surface; + std::string file; + bool use_alpha; + int x; + int y; + int w; + int h; + Color top_gradient; + Color bottom_gradient; - SurfaceData(SDL_Surface* surf, bool use_alpha_); - SurfaceData(const std::string& file_, bool use_alpha_); - SurfaceData(const std::string& file_, int x_, int y_, int w_, int h_, bool use_alpha_); - SurfaceData(Color top_gradient_, Color bottom_gradient_, int w_, int h_); - ~SurfaceData(); + SurfaceData(SDL_Surface* surf, bool use_alpha_); + SurfaceData(const std::string& file_, bool use_alpha_); + SurfaceData(const std::string& file_, int x_, int y_, int w_, int h_, bool use_alpha_); + SurfaceData(Color top_gradient_, Color bottom_gradient_, int w_, int h_); + ~SurfaceData(); - SurfaceSDL* create_SurfaceSDL(); - SurfaceOpenGL* create_SurfaceOpenGL(); - SurfaceImpl* create(); -}; + SurfaceSDL* create_SurfaceSDL(); + SurfaceOpenGL* create_SurfaceOpenGL(); + SurfaceImpl* create(); + }; -/** Container class that holds a surface, necessary so that we can - switch Surface implementations (OpenGL, SDL) on the fly */ -class Surface -{ -public: - SurfaceData data; - SurfaceImpl* impl; - int w; - int h; - - typedef std::list<Surface*> Surfaces; - static Surfaces surfaces; -public: - static void reload_all(); - static void debug_check(); - Surface(SDL_Surface* surf, bool use_alpha); - Surface(const std::string& file, bool use_alpha); - Surface(const std::string& file, int x, int y, int w, int h, bool use_alpha); - Surface(Color top_gradient, Color bottom_gradient, int w_, int h_); - ~Surface(); - - /** Reload the surface, which is necesarry in case of a mode swich */ - void reload(); + /// Surface + /** Container class that holds a surface, necessary so that we can + switch Surface implementations (OpenGL, SDL) on the fly */ + class Surface + { + public: + SurfaceData data; + SurfaceImpl* impl; + int w; + int h; - void resize(int widht, int height); -}; + typedef std::list<Surface*> Surfaces; + static Surfaces surfaces; + public: + static void reload_all(); + static void debug_check(); -/** Surface implementation, all implementation have to inherit from - this class */ -class SurfaceImpl -{ -protected: - SDL_Surface* sdl_surface; + Surface(SDL_Surface* surf, bool use_alpha); + Surface(const std::string& file, bool use_alpha); + Surface(const std::string& file, int x, int y, int w, int h, bool use_alpha); + Surface(Color top_gradient, Color bottom_gradient, int w_, int h_); + ~Surface(); -public: - int w; - int h; + /** Reload the surface, which is necesarry in case of a mode swich */ + void reload(); -public: - SurfaceImpl(); - virtual ~SurfaceImpl(); - - /** Return 0 on success, -2 if surface needs to be reloaded */ - virtual int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0; - virtual int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0; + void resize(int widht, int height); + }; + + /** Surface implementation, all implementation have to inherit from + this class */ + class SurfaceImpl + { + protected: + SDL_Surface* sdl_surface; + + public: + int w; + int h; + + public: + SurfaceImpl(); + virtual ~SurfaceImpl(); + + /** Return 0 on success, -2 if surface needs to be reloaded */ + virtual int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0; + virtual int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0; #if 0 - virtual int draw_stretched(float x, float y, int w, int h, Uint8 alpha, bool update) = 0; + + virtual int draw_stretched(float x, float y, int w, int h, Uint8 alpha, bool update) = 0; #endif - int resize(int w_, int h_); - SDL_Surface* get_sdl_surface() const; // @evil@ try to avoid this function -}; + int resize(int w_, int h_); -class SurfaceSDL : public SurfaceImpl -{ -public: - SurfaceSDL(SDL_Surface* surf, bool use_alpha); - SurfaceSDL(const std::string& file, bool use_alpha); - SurfaceSDL(const std::string& file, int x, int y, int w, int h, bool use_alpha); - SurfaceSDL(Color top_gradient, Color bottom_gradient, int w, int h); - virtual ~SurfaceSDL(); + SDL_Surface* get_sdl_surface() const; // @evil@ try to avoid this function + }; - int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT); - int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT); + class SurfaceSDL : public SurfaceImpl + { + public: + SurfaceSDL(SDL_Surface* surf, bool use_alpha); + SurfaceSDL(const std::string& file, bool use_alpha); + SurfaceSDL(const std::string& file, int x, int y, int w, int h, bool use_alpha); + SurfaceSDL(Color top_gradient, Color bottom_gradient, int w, int h); + virtual ~SurfaceSDL(); + + int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT); + int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT); #if 0 - int draw_stretched(float x, float y, int w, int h, Uint8 alpha); + + int draw_stretched(float x, float y, int w, int h, Uint8 alpha); #endif -}; + }; #ifndef NOOPENGL -class SurfaceOpenGL : public SurfaceImpl -{ -public: - GLuint gl_texture; + class SurfaceOpenGL : public SurfaceImpl + { + public: + GLuint gl_texture; -public: - SurfaceOpenGL(SDL_Surface* surf, bool use_alpha); - SurfaceOpenGL(const std::string& file, bool use_alpha); - SurfaceOpenGL(const std::string& file, int x, int y, int w, int h, bool use_alpha); - SurfaceOpenGL(Color top_gradient, Color bottom_gradient, int w, int h); + public: + SurfaceOpenGL(SDL_Surface* surf, bool use_alpha); + SurfaceOpenGL(const std::string& file, bool use_alpha); + SurfaceOpenGL(const std::string& file, int x, int y, int w, int h, bool use_alpha); + SurfaceOpenGL(Color top_gradient, Color bottom_gradient, int w, int h); - virtual ~SurfaceOpenGL(); + virtual ~SurfaceOpenGL(); - int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT); - int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT); + int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT); + int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT); #if 0 - int draw_stretched(float x, float y, int w, int h, Uint8 alpha); + + int draw_stretched(float x, float y, int w, int h, Uint8 alpha); #endif -private: - void create_gl(SDL_Surface * surf, GLuint * tex); -}; -#endif + private: + void create_gl(SDL_Surface * surf, GLuint * tex); + }; +#endif + +} //namespace SuperTux #endif /*SUPERTUX_TEXTURE_H*/ Index: font.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- font.h 20 Jul 2004 17:51:39 -0000 1.1 +++ font.h 21 Jul 2004 16:51:53 -0000 1.2 @@ -26,51 +26,56 @@ #include "video/surface.h" #include "math/vector.h" -/** Reads a text file (using LispReader, so it as to be in its formatting) - and displays it in a StarTrek fashion */ -void display_text_file(const std::string& file, float scroll_speed); +namespace SuperTux + { -/* Text type */ -class Font -{ -public: - /* Kinds of texts. */ - enum FontType { - TEXT, // images for all characters - NUM // only images for numbers - }; - - Font(const std::string& file, FontType type, int w, int h, int shadowsize=2); - ~Font(); + /** Reads a text file (using LispReader, so it as to be in its formatting) + and displays it in a StarTrek fashion */ + void display_text_file(const std::string& file, float scroll_speed); - /** returns the height of the font */ - float get_height() const; - /** returns the width of a given text. (Note that I won't add a normal - * get_width function here, as we might switch to variable width fonts in the - * future. - */ - float get_text_width(const std::string& text) const; + /* Text type */ + class Font + { + public: + /* Kinds of texts. */ + enum FontType { + TEXT, // images for all characters + NUM // only images for numbers + }; -private: - friend class DrawingContext; - - void draw(const std::string& text, const Vector& pos, - Uint32 drawing_effect = NONE_EFFECT); - void draw_chars(Surface* pchars, const std::string& text, - const Vector& position, Uint32 drawing_effect); + Font(const std::string& file, FontType type, int w, int h, int shadowsize=2); + ~Font(); - Surface* chars; - Surface* shadow_chars; - FontType type; - int w; - int h; - int shadowsize; + /** returns the height of the font */ + float get_height() const; + /** returns the width of a given text. (Note that I won't add a normal + * get_width function here, as we might switch to variable width fonts in the + * future. + */ + float get_text_width(const std::string& text) const; - /// the number of the first character that is represented in the font - int first_char; - /// the number of the last character that is represented in the font - int last_char; -}; + private: + friend class DrawingContext; + + void draw(const std::string& text, const Vector& pos, + Uint32 drawing_effect = NONE_EFFECT); + void draw_chars(Surface* pchars, const std::string& text, + const Vector& position, Uint32 drawing_effect); + + Surface* chars; + Surface* shadow_chars; + FontType type; + int w; + int h; + int shadowsize; + + /// the number of the first character that is represented in the font + int first_char; + /// the number of the last character that is represented in the font + int last_char; + }; + +} //namespace SuperTux #endif /*SUPERTUX_FONT_H*/ Index: surface.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/surface.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- surface.cpp 20 Jul 2004 17:51:39 -0000 1.1 +++ surface.cpp 21 Jul 2004 16:51:53 -0000 1.2 @@ -29,6 +29,8 @@ #include "app/globals.h" #include "app/setup.h" +using namespace SuperTux; + Surface::Surfaces Surface::surfaces; SurfaceData::SurfaceData(SDL_Surface* temp, bool use_alpha_) @@ -328,7 +330,7 @@ } SDL_Surface* -sdl_surface_from_sdl_surface(SDL_Surface* sdl_surf, bool use_alpha) +SuperTux::sdl_surface_from_sdl_surface(SDL_Surface* sdl_surf, bool use_alpha) { SDL_Surface* sdl_surface; Uint32 saved_flags; Index: drawing_context.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/drawing_context.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- drawing_context.h 20 Jul 2004 17:51:39 -0000 1.1 +++ drawing_context.h 21 Jul 2004 16:51:53 -0000 1.2 @@ -26,138 +26,148 @@ #include "math/vector.h" #include "video/screen.h" +#include "video/surface.h" -class Surface; -class Font; +namespace SuperTux + { -// some constants for predefined layer values -enum { - LAYER_BACKGROUND0 = -300, - LAYER_BACKGROUND1 = -200, - LAYER_BACKGROUNDTILES = -100, - LAYER_TILES = 0, - LAYER_OBJECTS = 100, - LAYER_FOREGROUNDTILES = 200, - LAYER_FOREGROUND0 = 300, - LAYER_FOREGROUND1 = 400, - LAYER_GUI = 500 -}; + class Surface; + class Font; -/** - * This class provides functions for drawing things on screen. It also - * maintains a stack of transforms that are applied to graphics. - */ -class DrawingContext -{ -public: - DrawingContext(); - ~DrawingContext(); + // some constants for predefined layer values + enum { + LAYER_BACKGROUND0 = -300, + LAYER_BACKGROUND1 = -200, + LAYER_BACKGROUNDTILES = -100, + LAYER_TILES = 0, + LAYER_OBJECTS = 100, + LAYER_FOREGROUNDTILES = 200, + LAYER_FOREGROUND0 = 300, + LAYER_FOREGROUND1 = 400, + LAYER_GUI = 500 + }; - /** Adds a drawing request for a surface into the request list */ - void draw_surface(const Surface* surface, const Vector& position, int layer, - Uint32 drawing_effect = NONE_EFFECT); - /** Adds a drawing request for part of a surface */ - void draw_surface_part(const Surface* surface, const Vector& source, - const Vector& size, const Vector& dest, int layer, - Uint32 drawing_effect = NONE_EFFECT); - /** draws a text */ - void draw_text(Font* font, const std::string& text, const Vector& position, - int layer, Uint32 drawing_effect = NONE_EFFECT); - /** draws aligned text */ - void draw_text_center(Font* font, const std::string& text, - const Vector& position, int layer, Uint32 drawing_effect = NONE_EFFECT); - /** draws a color gradient onto the whole screen */ - void draw_gradient(Color from, Color to, int layer); - /** fills a rectangle */ - void draw_filled_rect(const Vector& topleft, const Vector& size, - Color color, int layer); - - /** Processes all pending drawing requests and flushes the list */ - void do_drawing(); + /** + * This class provides functions for drawing things on screen. It also + * maintains a stack of transforms that are applied to graphics. + */ + class DrawingContext + { + public: + DrawingContext(); + ~DrawingContext(); - const Vector& get_translation() const - { return transform.translation; } - void set_translation(const Vector& newtranslation) - { transform.translation = newtranslation; } + /** Adds a drawing request for a surface into the request list */ + void draw_surface(const Surface* surface, const Vector& position, int layer, + Uint32 drawing_effect = NONE_EFFECT); + /** Adds a drawing request for part of a surface */ + void draw_surface_part(const Surface* surface, const Vector& source, + const Vector& size, const Vector& dest, int layer, + Uint32 drawing_effect = NONE_EFFECT); + /** draws a text */ + void draw_text(Font* font, const std::string& text, const Vector& position, + int layer, Uint32 drawing_effect = NONE_EFFECT); + /** draws aligned text */ + void draw_text_center(Font* font, const std::string& text, + const Vector& position, int layer, Uint32 drawing_effect = NONE_EFFECT); + /** draws a color gradient onto the whole screen */ + void draw_gradient(Color from, Color to, int layer); + /** fills a rectangle */ + void draw_filled_rect(const Vector& topleft, const Vector& size, + Color color, int layer); - void push_transform(); - void pop_transform(); + /** Processes all pending drawing requests and flushes the list */ + void do_drawing(); - /** apply that effect in the next draws (effects are listed on surface.h) */ - void set_drawing_effect(int effect); + const Vector& get_translation() const + { + return transform.translation; + } + void set_translation(const Vector& newtranslation) + { + transform.translation = newtranslation; + } -private: - class Transform - { - public: - Vector translation; // only translation for now... + void push_transform(); + void pop_transform(); - Vector apply(const Vector& v) const - { - return v - translation; - } + /** apply that effect in the next draws (effects are listed on surface.h) */ + void set_drawing_effect(int effect); - int draw_effect; - }; + private: + class Transform + { + public: + Vector translation; // only translation for now... - /// the transform stack - std::vector<Transform> transformstack; - /// the currently active transform - Transform transform; + Vector apply(const Vector& v) const + { + return v - translation; + } - enum RequestType - { - SURFACE, SURFACE_PART, TEXT, GRADIENT, FILLRECT - }; + int draw_effect; + }; - struct SurfacePartRequest - { - const Surface* surface; - Vector source, size; - }; + /// the transform stack + std::vector<Transform> transformstack; + /// the currently active transform + Transform transform; - struct TextRequest - { - Font* font; - std::string text; - }; + enum RequestType + { + SURFACE, SURFACE_PART, TEXT, GRADIENT, FILLRECT + }; - struct GradientRequest - { - Color top, bottom; - Vector size; - }; + struct SurfacePartRequest + { + const Surface* surface; + Vector source, size; + }; - struct FillRectRequest - { - Color color; - Vector size; - }; + struct TextRequest + { + Font* font; + std::string text; + }; - struct DrawingRequest - { - int layer; - Uint32 drawing_effect; + struct GradientRequest + { + Color top, bottom; + Vector size; + }; - RequestType type; - Vector pos; + struct FillRectRequest + { + Color color; + Vector size; + }; - void* request_data; + struct DrawingRequest + { + int layer; + Uint32 drawing_effect; - bool operator<(const DrawingRequest& other) const - { - return layer < other.layer; - } - }; + RequestType type; + Vector pos; - void draw_surface_part(DrawingRequest& request); - void draw_text(DrawingRequest& request); - void draw_gradient(DrawingRequest& request); - void draw_filled_rect(DrawingRequest& request); - - typedef std::vector<DrawingRequest> DrawingRequests; - DrawingRequests drawingrequests; -}; + void* request_data; + + bool operator<(const DrawingRequest& other) const + { + return layer < other.layer; + } + }; + + void draw_surface_part(DrawingRequest& request); + void draw_text(DrawingRequest& request); + void draw_gradient(DrawingRequest& request); + void draw_filled_rect(DrawingRequest& request); + + typedef std::vector<DrawingRequest> DrawingRequests; + DrawingRequests drawingrequests; + }; + +} //namespace SuperTux #endif /*SUPERTUX_DRAWINGCONTEXT_H*/ Index: screen.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/screen.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- screen.h 20 Jul 2004 17:51:39 -0000 1.1 +++ screen.h 21 Jul 2004 16:51:53 -0000 1.2 @@ -25,40 +25,49 @@ #include <SDL_opengl.h> #endif #include <iostream> -class Color -{ -public: - Color() - : red(0), green(0), blue(0), alpha(255) - {} - - Color(Uint8 red_, Uint8 green_, Uint8 blue_, Uint8 alpha_ = 255) - : red(red_), green(green_), blue(blue_), alpha(alpha_) - {} - Color(const Color& o) - : red(o.red), green(o.green), blue(o.blue), alpha(o.alpha) - { } +namespace SuperTux + { + + /// Color RGBA + /** Stores 8bit RGBA values. */ + class Color + { + public: + Color() + : red(0), green(0), blue(0), alpha(255) + {} - bool operator==(const Color& o) - { if(red == o.red && green == o.green && - blue == o.blue && alpha == o.alpha) - return true; - return false; } + Color(Uint8 red_, Uint8 green_, Uint8 blue_, Uint8 alpha_ = 255) + : red(red_), green(green_), blue(blue_), alpha(alpha_) + {} - Uint8 red, green, blue, alpha; -}; + Color(const Color& o) + : red(o.red), green(o.green), blue(o.blue), alpha(o.alpha) + { } -#include "video/surface.h" + bool operator==(const Color& o) + { + if(red == o.red && green == o.green && + blue == o.blue && alpha == o.alpha) + return true; + return false; + } -class Vector; + Uint8 red, green, blue, alpha; + }; -void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel); -void drawpixel(int x, int y, Uint32 pixel); -void fillrect(float x, float y, float w, float h, int r, int g, int b, int a = 255); -void draw_line(float x1, float y1, float x2, int r, int g, int b, int a = 255); -void fadeout(int fade_time); -void shrink_fade(const Vector& point, int fade_time); + class Vector; + + void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel); + void drawpixel(int x, int y, Uint32 pixel); + void fillrect(float x, float y, float w, float h, int r, int g, int b, int a = 255); + void draw_line(float x1, float y1, float x2, float y2, int r, int g, int b, int a = 255); + + void fadeout(int fade_time); + void shrink_fade(const Vector& point, int fade_time); + +} //namespace SuperTux #endif /*SUPERTUX_SCREEN_H*/ Index: screen.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/screen.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- screen.cpp 20 Jul 2004 17:51:39 -0000 1.1 +++ screen.cpp 21 Jul 2004 16:51:53 -0000 1.2 @@ -33,16 +33,19 @@ #include <ctype.h> #endif -#include "app/globals.h" #include "video/screen.h" +#include "app/globals.h" #include "video/drawing_context.h" #include "special/base.h" +#include "math/vector.h" + +using namespace SuperTux; /* 'Stolen' from the SDL documentation. * Set the pixel at (x, y) to the given value * NOTE: The surface must be locked before calling this! */ -void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel) +void SuperTux::putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel) { int bpp = surface->format->BytesPerPixel; /* Here p is the address to the pixel we want to set */ @@ -80,7 +83,7 @@ } /* Draw a single pixel on the screen. */ -void drawpixel(int x, int y, Uint32 pixel) +void SuperTux::drawpixel(int x, int y, Uint32 pixel) { /* Lock the screen for direct access to the pixels */ if ( SDL_MUSTLOCK(screen) ) @@ -105,7 +108,7 @@ /* --- FILL A RECT --- */ -void fillrect(float x, float y, float w, float h, int r, int g, int b, int a) +void SuperTux::fillrect(float x, float y, float w, float h, int r, int g, int b, int a) { if(w < 0) { @@ -179,8 +182,7 @@ #define SGN(x) ((x)>0 ? 1 : ((x)==0 ? 0:(-1))) #define ABS(x) ((x)>0 ? (x) : (-x)) -void -draw_line(float x1, float y1, float x2, float y2, int r, int g, int b, int a) +void SuperTux::draw_line(float x1, float y1, float x2, float y2, int r, int g, int b, int a) { #ifndef NOOPENGL if(use_gl) @@ -245,7 +247,7 @@ #define LOOP_DELAY 20.0 -void fadeout(int fade_time) +void SuperTux::fadeout(int fade_time) { float alpha_inc = 256 / (fade_time / LOOP_DELAY); float alpha = 256; @@ -269,7 +271,7 @@ context.do_drawing(); } -void shrink_fade(const Vector& point, int fade_time) +void SuperTux::shrink_fade(const Vector& point, int fade_time) { float left_inc = point.x / ((float)fade_time / LOOP_DELAY); float right_inc = (screen->w - point.x) / ((float)fade_time / LOOP_DELAY); |