00001 #ifndef __SFCAVE_H
00002 #define __SFCAVE_H
00003
00004 #include <SDL/SDL.h>
00005
00006 #include "terrain.h"
00007
00008 class Game;
00009 class Menu;
00010 class Help;
00011
00012 class SFCave
00013 {
00014 public:
00015 SFCave( int argc, char *argv[] );
00016 ~SFCave();
00017
00018 void initSDL( int argc, char *argv[] );
00019 void mainEventLoop();
00020
00021 void setCrashed( bool val );
00022 void changeState( int s );
00023 int getState() { return state; }
00024 Game *getCurrentGame() { return currentGame; }
00025 int getFPS() { return actualFPS; }
00026 bool showFPS() { return showFps; }
00027
00028 void setMenuStatusText( string statusText );
00029
00030 void saveSetting( string key, string val );
00031 void saveSetting( string key, int val );
00032 void saveSetting( string key, long val );
00033 void saveSetting( string key, double val );
00034 string loadSetting( string key, string defaultVal = "" );
00035 bool loadBoolSetting( string key, bool defaultVal);
00036 int loadIntSetting( string key, int defaultVal );
00037 double loadDoubleSetting( string key, double defaultVal );
00038
00039 private:
00040 SDL_Surface *screen;
00041 bool setupOK;
00042
00043 Game *currentGame;
00044 Menu *menu;
00045 Help *help;
00046 int state;
00047 bool showFps;
00048 string musicPath;
00049 string musicType;
00050 bool finish;
00051
00052 bool limitFPS;
00053 int maxFPS;
00054 int actualFPS;
00055 int FPS;
00056 long time1;
00057 long start;
00058 long end;
00059
00060
00061
00062 int customPlayerMenuVal;
00063 double origValue;
00064
00065 void handleMenuSelect( int menuId );
00066 void handleGameState();
00067 void handleEvents();
00068 void calcFPS();
00069 void FPSDelay();
00070 };
00071
00072 #endif