#include <sdlmanager.h>
Collaboration diagram for SdlManager:
Public Member Functions | |
DECLSPEC bool | init () |
DECLSPEC bool | init (TiXmlElement *el) |
DECLSPEC bool | init (Uint32 width, Uint32 height, Uint32 &depth, bool fullscreen=true) |
DECLSPEC void | destroy () |
bool | isAudioInited () |
| |
bool | isVideoInited () |
| |
DECLSPEC void | refreshSoundVolumes () |
DECLSPEC SdlAudio * | getAudioByName (const char *name) |
DECLSPEC SdlSurface * | getSurfaceByName (const char *name) |
DECLSPEC SdlSurfaceContainer * | getSurfacesByName (const char *name) |
DECLSPEC SdlMusicList * | getMusicsByName (const char *name) |
SdlSurface * | getDisplay () |
DECLSPEC bool | getScreenSize (int &w, int &h) |
DECLSPEC SDL_Rect | getScreenRect () |
DECLSPEC bool | screenShot (const char *fn=0, bool nooverwrite=true) |
Static Public Member Functions | |
static void | grabInput (void) |
Grabs the mouse+keyboard input, so that only this apps recieves events. | |
static void | ungrabInput (void) |
Ungrabs the mouse+keyboard input, so that other apps can recieve input events. | |
static DECLSPEC SdlManager * | getThe () |
Static Public Attributes | |
static SdlManager * | the |
static bool | bGrabInputEnabled |
indicates, whether or not, input grabbing is enabled | |
Friends | |
class | SdlAudio |
class | SdlSurface |
class | SdlSurfaceContainer |
class | SdlMusicList |
This class provides functions to initialize and access audio and graphic resources. It also contains methods to get video and audio settings and a function to make screenshots.
This class can only be used in one variable at a time. So do not initialize it more than once, but it is required once, if you need a user interface.
bool SdlManager::init | ( | ) |
Initializes video and audio, using a screen resolution of 1024*768*32Bit.
bool SdlManager::init | ( | TiXmlElement * | el | ) |
Initializes video and audio, using a XML node to set the screen resolution.
el | a XML element, that contains attributes, telling the resolution:
|
bool SdlManager::init | ( | Uint32 | width, | |
Uint32 | height, | |||
Uint32 & | depth, | |||
bool | fullscreen = true | |||
) |
Initializes video and audio, using the params to set the screen resolution.
width | of the resolution (in pixels, x direction) | |
height | of the resolution (in pixels, y direction) | |
depth | color depth of the resolution in bits | |
fullscreen | whether to use fullscreen-mode or not; true by default; if true, input is grabbed, otherwise not |
void SdlManager::destroy | ( | ) |
Uninitializes the manager. All resources will be freed and the audio mixer will be closed.
void SdlManager::refreshSoundVolumes | ( | ) |
Refreshes the sound volumes of all sound resources. This is necessary, when changing sound-volume globally.
SdlAudio * SdlManager::getAudioByName | ( | const char * | name | ) |
Use this function, if you have only the name and no resource of the sound you need.
name | the name of the audio resource to return |
SdlSurface * SdlManager::getSurfaceByName | ( | const char * | name | ) |
Use this function, if you have only the name and no resource of the surface you need.
name | the name of the surface resource to return |
SdlSurfaceContainer * SdlManager::getSurfacesByName | ( | const char * | name | ) |
Use this function, if you have only the name and no resource of the list of surfaces you need.
name | the name of the surface list resource to return |
SdlMusicList * SdlManager::getMusicsByName | ( | const char * | name | ) |
Use this function, if you have only the name and no resource of the list of songs/audios you need.
name | the name of the audio list resource to return |
SdlSurface* SdlManager::getDisplay | ( | ) | [inline] |
bool SdlManager::getScreenSize | ( | int & | w, | |
int & | h | |||
) |
Use this to get the resolution of the screen and to ask, whether fullscreen-mode is active or not.
w | reference, where the width will be stored | |
h | reference, where the height will be stored |
SDL_Rect SdlManager::getScreenRect | ( | ) |
bool SdlManager::screenShot | ( | const char * | fn = 0 , |
|
bool | nooverwrite = true | |||
) |
Makes a screenshot of the currently visible screen and saves the picture to a file with the bitmap format.
fn | the filename, where the bitmap will be saved. Use "%d" in it to set the number of the photo there (if nooverwrite is false) or to place a number there in order not to overwrite another photo (if nooverwrite true) if NULL, "./screens/photo%d.bmp" will be used | |
nooverwrite | if false and the given filename exists, the file will be overwritten; if true, no file will be overwritten, but if "%d" does not occur in fn, and fn exists, the photo will not be saved |
SdlManager * SdlManager::getThe | ( | ) | [static] |
SdlManager * SdlManager::the [static] |
only accessible in Linux, and equals the result of getThe()