#include <ZE_ZEngine.h>
Public Methods | |
void | SetupDisplay (int width, int height, int bpp, bool fullscreen) |
Setup Display for SDL. | |
void | SetupSound (int rate, bool stereo) |
Initialize Sound for SDL. | |
void | CreateDisplay (string title, string icon="") |
Create Display with predefined settings. | |
void | CloseDisplay () |
Quit SDL and any Subsystems. | |
SDL_Surface * | Display () |
Allow access to Screen Surface. | |
void | Update () |
Update display contents. | |
void | Clear (float red=0.0f, float green=0.0f, float blue=0.0f, float alpha=1.0f) |
Clear screen to a certain color (Black by default). | |
void | SetGL2D () |
Setup OpenGL ortho mode. | |
void | Delay (Uint32 milliseconds) |
Sleep for a certain amount of time. | |
Uint32 | GetTime () |
Get Global ZEngine time. | |
void | PauseTimer () |
Pause ZEngine. | |
void | UnpauseTimer () |
Unpause ZEngine. | |
double | GetFrameTime () |
Get Seconds Per Frame. | |
bool | IsPaused () |
Check Engine Paused State. | |
bool | IsActive () |
Find out if application is active. | |
void | RequestQuit () |
Request A Quit. | |
bool | QuitRequested () |
Find out if user has requested to quit. | |
void | SetReloadNeed (bool state) |
Set State of ImagesNeedReload. | |
bool | ImagesNeedReload () |
Find out if images should be reloaded. | |
void | SetKeyRepeatRate (int rate) |
Set Key repeat rate. | |
bool | KeyIsPressed (SDLKey key) |
Find the state of a key. | |
bool | KeyPress (SDLKey key) |
Find if key has been pressed since last check. | |
void | HideCursor () |
Hide mouse cursor. | |
void | ShowCursor () |
Show mouse cursor. | |
int | MouseX () |
Get X Position of Mouse. | |
int | MouseY () |
Get Y Position of Mouse. | |
bool | LButtonPressed () |
Get Status of Left Button. | |
bool | RButtonPressed () |
Get Status of Right Button. | |
bool | MouseInRect (SDL_Rect *rect) |
Check if mouse is in given rectangle. | |
void | CheckEvents () |
Check for Activation, Window Manager, and Quit Events. | |
SDL_Surface * | LoadImage (string filename) |
Load an Image. | |
Mix_Chunk * | LoadSound (string filename) |
Load a Sound. | |
Mix_Music * | LoadMusic (string filename) |
Load a Music File. | |
TTF_Font * | LoadFont (string filename, int size) |
Load a Font. | |
int | Width () |
Get Current Display Width. | |
int | Height () |
Get Current Display Height. | |
int | BPP () |
Get Current Display BPP. | |
bool | IsFullscreen () |
Get Fullscreen setting. | |
Static Public Methods | |
ZEngine * | GetInstance () |
Get Instance. | |
void | ReleaseInstance () |
Release Instance. | |
string | GetVersion () |
Get Current Version. | |
Private Methods | |
ZEngine () | |
Constructor for ZEngine. | |
Private Attributes | |
int | mWidth |
Width of Display. | |
int | mHeight |
Height of Display. | |
int | mBPP |
BPP Setting of Display. | |
bool | mFullscreen |
Fullscreen setting of Display. | |
int | mRate |
Sound Bitrate. | |
bool | mStereo |
Stereo setting of Sound Subsystem. | |
SDL_Surface * | mScreen |
Pointer to Display. | |
bool | mPaused |
Keep track of paused state of game. | |
bool | mUnpauseOnActive |
Keep track of if ZEngine should unpause on active event. | |
Uint32 | mLastPause |
Keep track of time game was last paused. | |
Uint32 | mPausedTime |
Keep track of total globally paused time. | |
Uint32 | mLastTime |
Keep track of last screen update time. | |
double | mSecPerFrame |
Seconds per frame. | |
bool | mNeedReload |
bool which is only set to true if the engine thinks the images need to be reloaded (loss of focus in fullscreen). | |
bool | mActive |
bool describing Active or Inactive State of Game | |
bool | mQuit |
bool for checking if a Quit event has been detected | |
Uint8 * | mKeyIsPressed |
Pointer to array of Keys. | |
bool | mKeyPress [SDLK_LAST] |
Array of keys, used by KeyPress. | |
int | mMouseX |
X Position of Mouse. | |
int | mMouseY |
Y Position of Mouse. | |
Uint8 | mMouseB |
Mouse Button Information. | |
Static Private Attributes | |
ZEngine * | sInstance = NULL |
Static Pointer to Instance of ZEngine for Singleton. |
|
Initialize ZEngine values to defaults. (Private so that only one instance may be created.) |
|
Static function, returns pointer to instance of ZEngine, creating an instance if none exist.
|
|
Release memory held by instance of engine and closes window. |
|
Get Version Number of ZEngine. (Major.Minor.Extension#)
|
|
Sets display parameters to specified parameters. (called before CreateDisplay)
|
|
Set sound settings to specified parameters. (called before CreateDisplay)
|
|
SetupDisplay and SetupSound should be called prior to this to change settings, settings from those do not go into effect until this function is called. Specify no icon file to use default OS icon.
|
|
Shut down SDL (and SDL_ttf,SDL_mixer if necessary). |
|
Get pointer to screen SDL_Surface, allowing direct screen manipulation using SDL.
|
|
Swap OpenGL buffers, and update screen. Must be called every frame. |
|
Clears a rectangle on screen to a color, defaults to solid black.
|
|
Sets the OpenGL scaled orthographic mode, called once at beginning, no need to call unless you change the OpenGL mode manually. |
|
Freeze everything for given number of milliseconds.
|
|
Get active time since ZEngine initialization in milliseconds, paused time doesn't count.
|
|
Pause ZEngine timer and all ZTimer objects that rely on ZEngine. |
|
Unpause ZEngine timer and all ZTimer objects that rely on ZEngine. |
|
Get double that describes the time passed between screen updates. (used for Framerate Independant Movement)
|
|
Find out if engine timer is paused.
|
|
Function to find out if application currently has focus.
|
|
Tell the engine that it should behave as if a Quit was requested, does not call any shutdown functions. |
|
Function to find out if user or operating system has requested program cease execution, can be set by Alt-F4, SDL_Quit event or ZEngine::RequestQuit().
|
|
|
|
Function that is good to call every frame to check if images should be reloaded, usually only caused by loss of focus in fullscreen.
|
|
Calls SDL_EnableKeyRepeat(rate,rate) because usually this is the desired movement style for games. The rate is set to 30 upon the creation of the display, pass zero to disable this. SDL_EnableKeyRepeat can be called separately: http://sdldoc.csn.ul.ie/sdlenablekeyrepeat.php.
|
|
Function returns true/false based on if key is currently pressed or not.
|
|
Function returns true/false based on if key has been pressed since last check.
|
|
Hide the system mouse cursor. |
|
Show the system mouse cursor. |
|
Find X Position of Mouse on screen.
|
|
Find Y Position of Mouse on screen.
|
|
Get pressed status of left button of mouse.
|
|
Get pressed status of right button of mouse.
|
|
Return status of mouse in current rectangle (used for buttons)
|
|
Cycle through event queue, processing events, updating all Event Related variables, should be called once per frame. |
|
Loads an Image to an ImageData class which keeps vital information on the Image.
|
|
Loads a Sound to a SoundData class which keeps vital information on the Sound
|
|
Loads a Music Clip to a MusicData class which keeps vital information on the Music Data
|
|
Loads a Font to a FontData class which keeps vital information on the Font
|
|
Get Width of Window or Fullscreen mode.
|
|
Get Height of Window or Fullscreen mode.
|
|
Get BPP of Window or Fullscreen mode.
|
|
Get Fullscreen setting of Display.
|