#include <sdlcontext.h>
Public Member Functions | |
~SDLContext () | |
Destructor. | |
int | getWidth () const |
Get the context's drawing area width. | |
int | getHeight () const |
Get the context's drawing area height. | |
bool | init () |
Initialize basic functionality. | |
bool | initVideo (int width, int height, bool fullscreen) |
Initialize video output. | |
bool | initAudio () |
Initialize audio output. | |
bool | initGame (const ustring &pathToCase) |
Initialize the game. | |
void | render () |
Render the scene. | |
void | onKeyboardEvent (SDL_KeyboardEvent *e) |
Handle keyboard events. | |
void | onMouseEvent (SDL_MouseButtonEvent *e) |
Handle mouse click events. | |
Static Public Member Functions | |
static std::auto_ptr < SDLContext > | create () |
Create a rendering context. | |
Private Member Functions | |
SDLContext () | |
Constructor. | |
Private Attributes | |
int | m_VFlags |
Flags passed to set the video mode. | |
Game * | m_Game |
The Game engine. | |
SDL_Surface * | m_Screen |
Screen surface. | |
Static Private Attributes | |
static int | m_Width = 640 |
Dimensions of context. | |
static int | m_Height = 480 |
Dimensions of context. |
Since the game engine is backed by SDL, a context needs to first be allocated before any drawing can take place. This context then handles swapping drawing buffers, and sets up all of SDL's subsystems. It also makes sure the window is correctly set up and updated.
int SDLContext::getWidth | ( | ) | const [inline] |
Get the context's drawing area width.
int SDLContext::getHeight | ( | ) | const [inline] |
Get the context's drawing area height.
bool SDLContext::init | ( | ) |
Initialize basic functionality.
bool SDLContext::initVideo | ( | int | width, | |
int | height, | |||
bool | fullscreen | |||
) |
Initialize video output.
width | The width of the video context | |
height | The height of the video context | |
fullscreen | Whether or not to enable fullscreen by default |
bool SDLContext::initAudio | ( | ) |
Initialize audio output.
bool SDLContext::initGame | ( | const ustring & | pathToCase | ) |
Initialize the game.
pathToCase | Path to the case file |
void SDLContext::onKeyboardEvent | ( | SDL_KeyboardEvent * | e | ) |
Handle keyboard events.
e | SDL struct representing the keyboard event |
void SDLContext::onMouseEvent | ( | SDL_MouseButtonEvent * | e | ) |
Handle mouse click events.
e | SDL struct representing the mouse event |