Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

/include/ZE_ZEngine.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002          This file is Part of the ZEngine Library for SDL Game Development.
00003                       Copyright (C) 2002 ConceptOfZero.net
00004 
00005              Licensed under the BSD License, see licensing.txt.
00006 
00007     The maintainer of this library is James Turk (jturk@conceptofzero.net) 
00008          and the home of this Library is http://www.conceptofzero.net/
00009 *******************************************************************************/
00010 
00024 #ifndef __ze_zengine_h__
00025 #define __ze_zengine_h__
00026 
00027 #include "ZE_Error.h"
00028 #include "ZE_Defines.h"
00029 #include "ZE_Macros.h"
00030 #include "ZE_Includes.h"
00031 
00037 namespace ZE
00038 {
00039 
00046 class ZEngine
00047 {
00049     //Singleton + Memory Management//
00051 
00052     private:
00054         static ZEngine *sInstance;
00055 
00061         ZEngine();
00062 
00063     public:
00064 
00071         static ZEngine* GetInstance();
00072 
00078         static void ReleaseInstance();
00079 
00086         static string GetVersion();
00087 
00089     //Initialization//
00091 
00092     private:
00094         int mWidth;
00096         int mHeight;
00098         int mBPP;
00100         bool mFullscreen;
00101 
00102 #ifdef USE_SDL_MIXER 
00103 
00104         int mRate;
00106         bool mStereo;
00107 #endif 
00108 
00109 
00110     public:
00111         //add initialization
00112 
00123         void SetupDisplay(int width, int height, int bpp, bool fullscreen);
00124 
00125 #ifdef USE_SDL_MIXER
00126 
00134         void SetupSound(int rate, bool stereo);
00135 #endif 
00136 
00146         void CreateDisplay(string title, string icon="");
00147 
00153         void CloseDisplay();
00154 
00156     //Screen Access//
00158 
00159     private:
00161         SDL_Surface *mScreen;
00162 
00163     public:
00170         SDL_Surface *Display();
00171 
00177         void UpdateScreen();
00178 
00188         void Clear(float red=0.0f, float green=0.0f, float blue=0.0f, float alpha=1.0f);
00189 
00191     //OpenGL Specific Functions//
00193     public:
00194 
00201         void SetGL2D();
00202 
00204     //Timer and Framerate Independent Movement//
00206     
00207     private:
00209         bool mPaused;
00211         bool mUnpauseOnActive;
00213         Uint32 mLastPause;
00215         Uint32 mPausedTime;
00217         Uint32 mLastTime;
00219         double mSecPerFrame;
00220 
00221     public:
00228         void Delay(Uint32 milliseconds);
00229 
00236         Uint32 GetTime();
00237 
00243         void PauseTimer();
00244 
00250         void UnpauseTimer();
00251 
00258         double GetFrameTime();
00259 
00266         bool IsPaused();
00267 
00269     //Event and Input Handling//
00271 
00272     private:
00274         bool mActive;
00276         bool mQuit;
00278         Uint8 *mKeyPressed;
00280         int mMouseX;
00282         int mMouseY;
00284         Uint8 mMouseB;
00285 
00286     public:
00293         bool IsActive();
00294 
00301         void RequestQuit();
00302 
00310         bool QuitRequested();
00311         
00319         bool KeyIsPressed(SDLKey key);
00320 
00326         void HideCursor();
00327 
00333         void ShowCursor();
00334 
00341         int MouseX();
00342 
00349         int MouseY();
00350 
00357         bool LButtonPressed();
00358 
00365         bool RButtonPressed();
00366 
00374         bool MouseInRect(SDL_Rect *rect);
00375 
00381         void CheckEvents();
00382 
00383 #ifdef USE_PHYSFS
00384 
00385     //Physfs Utilities//
00387     public:
00394         void InitPhysFS(string argv);
00395 
00402         void AddPhysFSDir(string dir);
00403 
00404 #endif    //USE_PHYSFS
00405 
00406 
00408     //Data Loading + Unloading//
00410     public:
00418         SDL_Surface* LoadImage(string filename);
00419 
00420 #ifdef USE_SDL_MIXER
00421 
00428         Mix_Chunk* LoadSound(string filename);
00429 
00437         Mix_Music* LoadMusic(string filename);
00438 #endif
00439 
00440 #ifdef USE_SDL_TTF
00441 
00449         TTF_Font* LoadFont(string filename, int size);
00450 #endif 
00451 
00453     //Accessors//
00455 
00456     public:    
00463         int Width();
00464 
00471         int Height();
00472 
00479         int BPP();
00480 
00487         bool IsFullscreen();
00488 };
00489 
00490 }
00491 
00492 #endif //__ze_zengine_h__

Generated on Sun Dec 1 02:44:14 2002 for ZEngine by doxygen1.2.18