00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SDLAPPLICATION_H
00030 #define SDLAPPLICATION_H
00031
00032 #ifdef SWIG
00033 %include "swigcommon.h"
00034 %module sdlapplication
00035 %{
00036 #include "sdlapplication.h"
00037 %}
00038 #endif
00039
00040 #include "sdlmessageobject.h"
00041 #include <vector>
00042
00043 #define NO_EVENTTHREAD 1
00044
00090 class DECLSPEC SDLApplication : public SDLMessageObject {
00091 public:
00092
00094 SDLApplication();
00095
00097 ~SDLApplication();
00098
00107 #ifdef SWIG
00108
00109 bool InitScreen(int w, int h, int depth, unsigned int flags);
00110 #else
00111 bool InitScreen(int w, int h, int depth=DISPLAY_DEPTH, Uint32 flags = SDL_SWSURFACE | SDL_HWPALETTE);
00112 #endif
00113
00121 SDLTheme* LoadTheme(const char* xmltheme, bool asDefault = true, const char* searchpath = NULL);
00122
00126 SDL_Thread* Run();
00127
00131 void Quit();
00132
00136 void Shutdown();
00137
00139 SDL_Surface* SetScreen(SDL_Surface* screen);
00140
00142 static SDL_Surface* GetScreen();
00143
00145 static TTF_Font* GetDefaultFont();
00146
00148 static bool UnlockScreen();
00149
00151 static bool LockScreen();
00152
00154 bool SetBackground(const char* filename, int mode=BKMODE_TILE);
00155
00157 #ifdef SWIG
00158 %name(SetBackground2) bool SetBackground(SDL_Surface* surface, int mode=BKMODE_TILE);
00159 #else
00160 bool SetBackground(SDL_Surface* surface, int mode=BKMODE_TILE);
00161 #endif
00162
00164 void RedrawBackground();
00165
00167 static void SetApplicationPath(char* path);
00168
00170 static char* GetApplicationPath();
00171
00173 static char* GetRelativePath(char* file);
00174
00176 static int GetScreenHeight();
00177
00179 static int GetScreenWidth();
00180
00182 static void FlipPage();
00183
00185 static TTF_Font* LoadFont(char* filename, int size);
00186
00188 #ifndef SWIG
00189 void PrintVideoTest();
00190 #endif
00191
00193 static SDLTheme* GetTheme();
00194
00196 static bool GetBulkMode();
00197
00198 protected:
00199
00201 bool eventKeyUp(const SDL_KeyboardEvent* key);
00202
00204 bool eventQuit(int id, SDLWidget* widget, unsigned long data);
00205
00207 virtual void eventInit();
00208
00209 private:
00210
00211
00212 SDLApplication(const SDLApplication&);
00213 SDLApplication& operator=(const SDLApplication&);
00214
00215 bool my_freeBackground;
00216 SDL_Surface* my_background;
00217 int my_backmode;
00218
00219 static bool FileExists(const char* filename);
00220
00221 static SDLTheme* my_Theme;
00222
00223 #ifndef SWIG
00224 static char app_path[300];
00225 #endif
00226
00227 static SDLApplication* pGlobalApp;
00228 static SDL_Surface* screen;
00229 static TTF_Font* font;
00230 static SDL_mutex* mutexScreen;
00231 static bool bulkMode;
00232 };
00233
00234 #endif // SDLAPPLICATION_H