Yagl::GfxDevice Class Reference

#include <gfxdevice.h>

List of all members.

Public Member Functions

virtual bool initialize ()=0
 initializes the gfxdevice
virtual void deinitialize ()=0
 deinitializes the gfxdevice
virtual bool setScreenMode (int width, int height, int bitdepth, bool fullscreen)=0
 sets the specified screenmode
virtual const std::list< ScreenModeInfo * > & getScreenModes ()=0
 returns a list of available screenmodes
virtual bool isScreenModeAvailable (int width, int height, int bitdepth)=0
 checks wheter the specified screenmode is available
virtual void setWindowTitle (const Yagl::String title)=0
 sets the window title in windowed mode
virtual void hideMouseCursor ()=0
 hides the mouse cursor
virtual void showMouseCursor ()=0
 shows the mouse cursor
virtual void swapBuffers ()=0
 presents the backbuffer on screen
virtual bool wasWindowCloseButtonPressed ()=0
 reports wheter the user clicked on the close button of the window
virtual bool isMethodImplemented (YAGL_GFX_CAPS method)=0
 returns wheter a certain method is implemented
virtual void set (int attribute, void *value)=0
 sets a backend dependent attribute/value/parameter
virtual void get (int attribute, void *value)=0
 returns a backend dependent attribute/value/parameter
virtual GfxSurfacecreateSurface ()=0
 creates a surface with the specified attributes
virtual void destroySurface (GfxSurface *surface)=0
 destroys the specified surface
virtual void destroyAllSurfaces ()=0
 destroys all Surfaces currently in use
virtual GfxFont * createFont ()=0
 this will create a font object
virtual void destroyFont (GfxFont *font)=0
 destroys the font object specified
virtual void destroyAllFonts ()=0
 destroys all font objects currently in use

Static Public Member Functions

static GfxDevicegetInstance ()
 returns a reference to the singleton instance of the device

Protected Attributes

int width_
 width of the currently set screenmode
int height_
 height of the currently set screenmode
int bitdepth_
 bitdepth of the currently set screenmode


Detailed Description

class GfxDevice

this is the abstract interface all GfxDevice implementations have to fullfill either fully or partially. all Gfx devices should keep track of a attributes, width_, height_ and bitdepth_ of the current screenmode that is. all GfxDevice implementations have to be singletons that can be accesssed via a getInstance() method that will return a reference to the device singleton


Member Function Documentation

virtual GfxFont* Yagl::GfxDevice::createFont  )  [pure virtual]
 

this will create a font object

this will create a font object. as a font is possibly dependant on the chose backend the GfxDevice should also serve as a factory for fonts the FBGFX backend font implementation would probably work differently to the GLFW backend font implementation. the former would store all glyphs in seperate bitmaps, the later might store all glyphs in one big texture. the gfxdevice implementation should also keep track of all created font objects as it does for the surface objects

Returns:
a font object

virtual GfxSurface* Yagl::GfxDevice::createSurface  )  [pure virtual]
 

creates a surface with the specified attributes

this will create a surface with the specified attributes. as the backend is responsible for creating the surface it can chose to ignore the attributes specified. ( e.g. the opengl backend might not create anything at this call, just a GlGfxSurface instance. the actual creation of content would happen elsewhere. the FBGFX backend would ignore the bitdepth field as the created surfaces bitdepth would be set to the current screenmode bitdepth. the backend should also keep track of all created surfaces in order to be able to destroy all surfaces in use at program exit or device deinitialization

Parameters:
width 
height 
bitdepth 
Returns:
pointer to a GfxSurface instance on success, 0 on failure

virtual void Yagl::GfxDevice::deinitialize  )  [pure virtual]
 

deinitializes the gfxdevice

this will deinitialize the gfxdevice, possibly destroy any open window and delete all surfaces still alive.

virtual void Yagl::GfxDevice::destroyAllFonts  )  [pure virtual]
 

destroys all font objects currently in use

this will destroy all font objects currently in use

virtual void Yagl::GfxDevice::destroyAllSurfaces  )  [pure virtual]
 

destroys all Surfaces currently in use

this will destroy all surface currently in use.

virtual void Yagl::GfxDevice::destroyFont GfxFont *  font  )  [pure virtual]
 

destroys the font object specified

this will destroy the specified font object. the backend should keepp track of that

Parameters:
font pointer to the font to be destroyed

virtual void Yagl::GfxDevice::destroySurface GfxSurface surface  )  [pure virtual]
 

destroys the specified surface

this will destroy the specified surface. the backend should also make sure that it is no longer in it's list of surfaces currently in use.

Parameters:
surface pointer to the surface to be destroyed

virtual void Yagl::GfxDevice::get int  attribute,
void *  value
[pure virtual]
 

returns a backend dependent attribute/value/parameter

this is a gateway method that allows users to retrieve features of a certain backend. see the backend implementations of this to check what valid attributes you can get with a given backend

Parameters:
attribute the attribute of the backend you want to get
value pointer to a variable the attribute should get stored to

static GfxDevice& Yagl::GfxDevice::getInstance  )  [static]
 

returns a reference to the singleton instance of the device

this will return a reference to the singletons instance

Returns:
reference to the singletons instance

virtual const std::list<ScreenModeInfo*>& Yagl::GfxDevice::getScreenModes  )  [pure virtual]
 

returns a list of available screenmodes

this will return a list of available screenmodes. use this if you want to enumerate all available screenmodes.

Returns:
a reference to a stl list of ScreenModeInfo classes

virtual void Yagl::GfxDevice::hideMouseCursor  )  [pure virtual]
 

hides the mouse cursor

this will hide the mouse cursor

virtual bool Yagl::GfxDevice::initialize  )  [pure virtual]
 

initializes the gfxdevice

this will initialize all the gfxdevice related things and return true on success

Returns:
true on success, false on failure

virtual bool Yagl::GfxDevice::isMethodImplemented YAGL_GFX_CAPS  method  )  [pure virtual]
 

returns wheter a certain method is implemented

this returns wheter the specified method is implemented see the YAGL_GFXDEVICE_CAPS enum for values a backend only has to implement a subset of the functionality described in this abstract class and this method allows the user to enumerate what is implemented and what is not

Parameters:
method the method in question

virtual bool Yagl::GfxDevice::isScreenModeAvailable int  width,
int  height,
int  bitdepth
[pure virtual]
 

checks wheter the specified screenmode is available

this will check wheter the specified fullscreen screenmode is available

Parameters:
width width in pixels of screenmode in question
height height in pixels of screenmode in question
bitdepth bitdepth of screenmode in question
Returns:
true if available, false otherwise

virtual void Yagl::GfxDevice::set int  attribute,
void *  value
[pure virtual]
 

sets a backend dependent attribute/value/parameter

this is a gateway method that allows users to enable features of a certain backend. see the backend implementations of this to check what valid attributes you can set with a given backend

Parameters:
attribute the attribute of the backend to change
value pointer to the value the attribute should get set to

virtual bool Yagl::GfxDevice::setScreenMode int  width,
int  height,
int  bitdepth,
bool  fullscreen
[pure virtual]
 

sets the specified screenmode

this will set the specified screenmode. any surfaces created before a call to this function have to be converted into a proper format if needed! e.g. the FBGFX backend only allows surfaces to be used with the screensurface if they have an equal bitdepth, thus if you change from 16 to 24 bit this method would have to convert all surfaces to 24-bit in order to keep things working. with the opengl backend all textures would need to get reloaded. ( FIXME how could we do that the best way in opengl? the bitmaps are only stored in vram so we'd have to get them off of vram before changing the screenmode and temporarily save them somewhere, hd or ram maybe scary stuff... ). this should always setup a doublebuffered environment.

Parameters:
width width of the screenmode
height height of the screenmode
bitdepth bitdepth of the screenmode
fullscreen bool indicating wheter fullscreen is wanted
Returns:
true on success, false on failure

virtual void Yagl::GfxDevice::setWindowTitle const Yagl::String  title  )  [pure virtual]
 

sets the window title in windowed mode

this will set the title of the window in a windowed screenmode

Parameters:
title string specifying the title of the window

virtual void Yagl::GfxDevice::showMouseCursor  )  [pure virtual]
 

shows the mouse cursor

this will show the mouse cursor

virtual void Yagl::GfxDevice::swapBuffers  )  [pure virtual]
 

presents the backbuffer on screen

this will present the frame in the backbuffer on screen. wheter this is accomplished via a simple flip or a complete memory copy is up to the backend. it should just make the doublebuffering system work

virtual bool Yagl::GfxDevice::wasWindowCloseButtonPressed  )  [pure virtual]
 

reports wheter the user clicked on the close button of the window

the window will not be closed

Returns:
true if user clicked on button, false otherwise


The documentation for this class was generated from the following file:
Generated on Tue Jan 10 15:42:38 2006 for YAGL - yet another gameprogramming library by  doxygen 1.4.5