SDLContext Class Reference

Context used for rendering using SDL. More...

#include <sdlcontext.h>

List of all members.

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.
Gamem_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.


Detailed Description

Context used for rendering using SDL.

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.


Member Function Documentation

int SDLContext::getWidth (  )  const [inline]

Get the context's drawing area width.

Returns:
The width of the context

int SDLContext::getHeight (  )  const [inline]

Get the context's drawing area height.

Returns:
The height of the context

bool SDLContext::init (  ) 

Initialize basic functionality.

Returns:
true if no errors occurred, false otherwise

bool SDLContext::initVideo ( int  width,
int  height,
bool  fullscreen 
)

Initialize video output.

Parameters:
width The width of the video context
height The height of the video context
fullscreen Whether or not to enable fullscreen by default
Returns:
true if no errors occurred, false otherwise

bool SDLContext::initAudio (  ) 

Initialize audio output.

Returns:
true if no errors occurred, false otherwise

bool SDLContext::initGame ( const ustring &  pathToCase  ) 

Initialize the game.

Parameters:
pathToCase Path to the case file
Returns:
true if no errors occurred, false otherwise

void SDLContext::onKeyboardEvent ( SDL_KeyboardEvent *  e  ) 

Handle keyboard events.

Parameters:
e SDL struct representing the keyboard event

void SDLContext::onMouseEvent ( SDL_MouseButtonEvent *  e  ) 

Handle mouse click events.

Parameters:
e SDL struct representing the mouse event


The documentation for this class was generated from the following files:
Generated on Fri Feb 22 22:29:23 2008 for Phoenix Wright Case Player API by  doxygen 1.5.3