Pixel Dust Game Engine  v0.9.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
Classes | Public Types | Public Member Functions | Friends | List of all members
GraphicsManager Class Reference
Inheritance diagram for GraphicsManager:
Inheritance graph
[legend]
Collaboration diagram for GraphicsManager:
Collaboration graph
[legend]

Classes

struct  ScreenMode
 

Public Types

enum  {
  screenNum_PrimaryScreen = -1,
  screenNum_BestFitScreen = -2
}
 

Public Member Functions

virtual int getNumScreens ()
 returns the number of screens available for display
 
virtual ScreenMode getCurrentScreenMode (int screenNum=screenNum_PrimaryScreen, pdg::Rect *maxWindowRect=0)
 
virtual int getNumSupportedScreenModes (int screenNum=screenNum_PrimaryScreen)
 returns the number of screens modes a particular screen supports
 
virtual ScreenMode getNthSupportedScreenMode (int n, int screenNum=screenNum_PrimaryScreen)
 returns the details of a supported mode (width, height, depth) for a given screen
 
virtual void setScreenMode (long width, long height, int screenNum=screenNum_PrimaryScreen, int bpp=0)
 
virtual PortcreateWindowPort (const Rect &rect, const char *windName=0, int bpp=0)
 
virtual PortcreateFullScreenPort (const Rect &rect, int screenNum=screenNum_PrimaryScreen, bool allowResChange=true, int bpp=0)
 
virtual void closeGraphicsPort (Port *port=0)
 
virtual FontcreateFont (const char *fontName, float scalingFactor=1.0f)
 create a font
 
virtual PortgetMainPort ()
 this is the main window port, or the full screen port if in full screen
 
virtual void setMainPort (Port *port)
 
virtual bool switchToFullScreenMode (bool allowResChange=false, Port *port=0)
 
virtual bool switchToWindowMode (Port *port=0, const char *windName=0)
 returns true if succeeded, false if failed
 
virtual bool inFullScreenMode ()
 return true if main port is in fullscreen mode
 
virtual float getFPS ()
 return the current average frames per second
 
virtual void setTargetFPS (float fps)
 set the desired frames per second
 
virtual float getTargetFPS ()
 return the current desired frames per second
 
virtual Point getMouse (int mouseNumber=0)
 
- Public Member Functions inherited from Singleton< GraphicsManager >
 Singleton ()
 
virtual ~Singleton ()
 

Friends

class Singleton< GraphicsManager >
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< GraphicsManager >
static GraphicsManagergetSingletonInstance ()
 
static bool hasInstance ()
 
static GraphicsManagerinstance ()
 
static void setInstance (GraphicsManager *i)
 
static GraphicsManagercreateSingletonInstance ()
 

Detailed Description

Graphics Manager Used to create and track ports

Member Enumeration Documentation

anonymous enum
Enumerator:
screenNum_PrimaryScreen 
screenNum_BestFitScreen 

Member Function Documentation

virtual void closeGraphicsPort ( Port port = 0)
virtual

close a port and clean it up if port is not passed it will default to the main port, which will trigger the application to quit

virtual Font* createFont ( const char *  fontName,
float  scalingFactor = 1.0f 
)
virtual

create a font

virtual Port* createFullScreenPort ( const Rect rect,
int  screenNum = screenNum_PrimaryScreen,
bool  allowResChange = true,
int  bpp = 0 
)
virtual

create a full screen graphics port. desired screen resolution is in rect, desired screen color depth is in if allowResChange is true, the screen resolution will be changed to the closest possible resolution, and any excess screen real estate will be erased to black if bpp is non-zero and doesn't match the current screen settings, then the screen depth will be changed to match, even if allowResChange is false

virtual Port* createWindowPort ( const Rect rect,
const char *  windName = 0,
int  bpp = 0 
)
virtual

create a port for drawing in a Window. The Window's size and location are given by the rectangle passed in. bpp is the bits per pixel used for the back buffer of the window. Use bpp of zero (0) to match current screen color depth settings

virtual ScreenMode getCurrentScreenMode ( int  screenNum = screenNum_PrimaryScreen,
pdg::Rect maxWindowRect = 0 
)
virtual

returns the current mode (width, height, depth) of a screen if a Rect* is passed in, will also return the maximum dimensions for a window that fits on that screen after discounting menu bars, docks, window frames, etc...

virtual float getFPS ( )
virtual

return the current average frames per second

virtual Port* getMainPort ( )
virtual

this is the main window port, or the full screen port if in full screen

virtual Point getMouse ( int  mouseNumber = 0)
virtual
virtual ScreenMode getNthSupportedScreenMode ( int  n,
int  screenNum = screenNum_PrimaryScreen 
)
virtual

returns the details of a supported mode (width, height, depth) for a given screen

virtual int getNumScreens ( )
virtual

returns the number of screens available for display

virtual int getNumSupportedScreenModes ( int  screenNum = screenNum_PrimaryScreen)
virtual

returns the number of screens modes a particular screen supports

virtual float getTargetFPS ( )
virtual

return the current desired frames per second

virtual bool inFullScreenMode ( )
virtual

return true if main port is in fullscreen mode

virtual void setMainPort ( Port port)
virtual

application developers should rarely, if ever, need to call this. it is primarily included for cases were someone wants to use the graphics layer but nothing else you might also use this before closing the old main port if you are replacing it with a new one, that will avoid triggering the app to quit

virtual void setScreenMode ( long  width,
long  height,
int  screenNum = screenNum_PrimaryScreen,
int  bpp = 0 
)
virtual

set the display mode for a particular screen resulting mode might not be exactly what you asked for, but could instead be the closest viable mode for that screen

virtual void setTargetFPS ( float  fps)
virtual

set the desired frames per second

virtual bool switchToFullScreenMode ( bool  allowResChange = false,
Port port = 0 
)
virtual

make a port be fullscreen if port is not passed it will default to the main port if allowResChange is true, the screen resolution will be changed to the closest possible resolution, and any excess screen real estate will be erased to black returns true if succeeded, false if failed

virtual bool switchToWindowMode ( Port port = 0,
const char *  windName = 0 
)
virtual

returns true if succeeded, false if failed

make a port be in a window if port is not passed it will default to the main port

Friends And Related Function Documentation

friend class Singleton< GraphicsManager >
friend