#include <graphics.h>
Public Methods | |
| Graphics (string title="", int w=1024, int h=768, bool opengl=true) | |
| Constructor for the graphics class. | |
| ~Graphics () | |
| Destructor for the graphics class. | |
| void | PreOpenGLInit () |
| Preinitialize OpenGL. | |
| void | PostOpenGLInit () |
| Postinitialize OpenGL. | |
| void | toggleFullscreen () |
| Toggle fullscreen mode. | |
| bool | isFullscreen () |
| Returns the status of fullscreen mode. | |
| bool | isMouseLocked () |
| Get the status of the mouse lock. | |
| bool | isHWSurface () |
| Returns true if the surface is in hardware memory. | |
| void | hideMouse (bool f) |
| Hides the mouse. | |
| Surface * | getMainSurface () const |
| Get a pointer to the main surface. | |
| void | flip () |
| Flips a double buffer to screen. | |
| void | update (int x, int y, int w, int h) |
| Update a rectangle. | |
| void | update (Rect &r) |
| Update a rectangle. | |
| void | blit (Surface *src, int dx=0, int dy=0) |
| Blit surface to double buffer. | |
| Surface * | newSurface (int w, int h) |
| Create a new surface. | |
| void | deleteSurface (Surface *n) |
| Free surface mem. | |
| void | fillSurface (Surface *n, int color) |
| Fills Surface with a specific value. | |
| int | color (int r, int g, int b, Surface *n=NULL) |
| Creates a single RGB value from individual components. | |
| int | getWidth () const |
| Get the width of the graphics device. | |
| int | getHeight () const |
| Get the height of the graphics device. | |
| void | RotateZ (float degrees) |
| Rotate about the Z axis. | |
Static Public Methods | |
| bool | lockMouse (bool lock) |
| Lock the Mouse. | |
| void | blit (Surface *target, int tx, int ty, Surface *src) |
| Blit surface to surface. | |
| void | blit (Surface *target, Rect &t, Surface *src, Rect &s) |
| Blit surface to surface. | |
| Surface * | CreateSurfaceFrom (Surface *s) |
| Create a surface based on another's pixelformat. | |
| Surface * | CreateSurfaceFrom (Surface *s, int nw, int nh) |
| Create a surface based on another's pixel. | |
| Surface * | loadImage (const char *fname) |
| Load an image from disk. | |
| Surface * | loadImage (string fname) |
| Load an image from disk. | |
| Surface * | freeImage (Surface *surf) |
| Free an image that was loaded with loadImage. | |
| Surface * | displayFormat (Surface *surf, bool alpha=false) |
| Converts a surface to displayFormat of hwSurface. | |
| void | TexturizeSurface (Surface *s) |
| Texturize a Surface. | |
| void | UntexturizeSurface (Surface *s) |
| Free the texture of a Surface. | |
Static Private Methods | |
| void | blitclip (Surface *dest, int drx, int dry, int drw, int drh, Surface *src, int srx, int sry, int srw, int srh) |
| Special clipping function for blit. | |
| void | blitGLtexture (Surface *src, int srx, int sry, int srw, int srh, int drx, int dry, int drw, int drh) |
| Special clipping function for opengl. | |
Private Attributes | |
| Surface * | hwSurface |
| the surface the graphics device uses | |
| int | width |
| the width and height of the hwSurface. | |
| int | height |
| the width and height of the hwSurface. | |
|
||||||||||||||||||||
|
Constructor for the graphics class. Initializes the graphics hardware and sets up a drawing window.
Definition at line 9 of file graphics.cpp. References _Surface::h, height, hwSurface, PostOpenGLInit(), PreOpenGLInit(), _Surface::surface, _Surface::w, and width. |
|
|
Destructor for the graphics class. Closes the graphics drawing area and frees all necessary memory.
Definition at line 46 of file graphics.cpp. References hwSurface, and _Surface::surface. |
|
||||||||||||||||||||
|
Blit surface to surface.
Definition at line 242 of file graphics.cpp. References blitclip(), Rect, and _Surface::w. |
|
||||||||||||||||||||
|
Blit surface to surface.
Definition at line 229 of file graphics.cpp. References blitclip(), _Surface::h, and _Surface::w. |
|
||||||||||||||||
|
Blit surface to double buffer. Blits a surface to the double buffer
Definition at line 222 of file graphics.cpp. References hwSurface. Referenced by Sprite::draw(), Background::DrawRect(), and Background::SetStatic(). |
|
||||||||||||||||||||||||||||||||||||||||||||
|
Special clipping function for blit.
Definition at line 163 of file graphics.cpp. References blitGLtexture(), _Surface::h, Rect, _Surface::surface, Util_BuildRect(), and _Surface::w. Referenced by blit(). |
|
||||||||||||||||||||||||||||||||||||||||
|
Special clipping function for opengl.
Definition at line 144 of file graphics.cpp. References _Surface::h, height, _Surface::tex, _Surface::ts, _Surface::w, and width. Referenced by blitclip(). |
|
||||||||||||||||||||
|
Creates a single RGB value from individual components.
Definition at line 333 of file graphics.cpp. References hwSurface, and _Surface::surface. Referenced by fillSurface(). |
|
||||||||||||||||
|
Create a surface based on another's pixel.
Definition at line 300 of file graphics.cpp. References _Surface::h, Surface, _Surface::surface, and _Surface::w. |
|
|
Create a surface based on another's pixelformat.
Definition at line 277 of file graphics.cpp. References _Surface::h, Surface, _Surface::surface, and _Surface::w. Referenced by Background::SetStatic(). |
|
|
Free surface mem.
Definition at line 322 of file graphics.cpp. References _Surface::surface. |
|
||||||||||||
|
Converts a surface to displayFormat of hwSurface.
Definition at line 371 of file graphics.cpp. References _Surface::h, _Surface::surface, and _Surface::w. |
|
||||||||||||
|
Fills Surface with a specific value.
Definition at line 328 of file graphics.cpp. References color(), and _Surface::surface. |
|
|
Flips a double buffer to screen. Really only useful in Windows hardware mode
Definition at line 393 of file graphics.cpp. References hwSurface, and _Surface::surface. Referenced by Game::RenderScreen(). |
|
|
Free an image that was loaded with loadImage.
Definition at line 362 of file graphics.cpp. References _Surface::surface. Referenced by Sprite::EmptyFrames(), Sprite::RemoveFrame(), Background::~Background(), and SpriteCache::~SpriteCache(). |
|
|
Get the height of the graphics device.
Definition at line 261 of file graphics.h. References height. Referenced by Background::Draw(), Game::Game(), Game::GameLoop(), Game::RenderScreen(), RotateZ(), and Background::SetStatic(). |
|
|
Get a pointer to the main surface.
Definition at line 100 of file graphics.h. References hwSurface. Referenced by Background::Draw(), and Background::DrawRect(). |
|
|
Get the width of the graphics device.
Definition at line 255 of file graphics.h. References width. Referenced by Background::Draw(), Game::Game(), Game::GameLoop(), Background::GetScreenHeight(), Game::RenderScreen(), RotateZ(), and Background::SetStatic(). |
|
|
Hides the mouse.
Definition at line 94 of file graphics.h. Referenced by Application::Application(). |
|
|
Returns the status of fullscreen mode.
Definition at line 67 of file graphics.h. References hwSurface, and _Surface::surface. |
|
|
Returns true if the surface is in hardware memory.
Definition at line 87 of file graphics.h. References hwSurface, and _Surface::surface. Referenced by Game::RenderScreen(). |
|
|
Get the status of the mouse lock.
Definition at line 74 of file graphics.h. Referenced by Game::step(). |
|
|
Load an image from disk.
Definition at line 356 of file graphics.cpp. References loadImage(). |
|
|
Load an image from disk.
Definition at line 343 of file graphics.cpp. References _Surface::h, _Surface::surface, and _Surface::w. Referenced by loadImage(), and Background::SetStatic(). |
|
|
Lock the Mouse.
Definition at line 388 of file graphics.cpp. Referenced by Game::step(). |
|
||||||||||||
|
Create a new surface.
Definition at line 254 of file graphics.cpp. References _Surface::h, hwSurface, Surface, _Surface::surface, and _Surface::w. |
|
|
Postinitialize OpenGL. This function finalizes opengl initialization. Definition at line 65 of file graphics.cpp. References _Surface::h, hwSurface, and _Surface::w. Referenced by Graphics(). |
|
|
Preinitialize OpenGL. This function does the preinitialize opengl calls. Definition at line 54 of file graphics.cpp. Referenced by Graphics(). |
|
|
Rotate about the Z axis. Rotates the screen about the Z axis, value in degrees
Definition at line 450 of file graphics.cpp. References getHeight(), and getWidth(). Referenced by Game::RenderScreen(). |
|
|
Texturize a Surface.
Definition at line 412 of file graphics.cpp. References _Surface::h, _Surface::surface, _Surface::tex, _Surface::ts, _Surface::tx, _Surface::ty, Util_FindBestSurfaceSize(), and _Surface::w. Referenced by Background::SetStatic(). |
|
|
Toggle fullscreen mode. Calls the SDL function switch between fullscreen mode.
Definition at line 60 of file graphics.h. References hwSurface, and _Surface::surface. Referenced by Game::step(). |
|
|
Free the texture of a Surface. Takes a surface and frees the surface memory from the vram Definition at line 442 of file graphics.cpp. References _Surface::tex. Referenced by SpriteCache::~SpriteCache(). |
|
|
Update a rectangle.
Definition at line 134 of file graphics.cpp. |
|
||||||||||||||||||||
|
Update a rectangle.
Definition at line 92 of file graphics.cpp. References hwSurface, and update(). Referenced by Game::RenderScreen(), and update(). |
|
|
the width and height of the hwSurface.
Definition at line 309 of file graphics.h. Referenced by blitGLtexture(), getHeight(), and Graphics(). |
|
|
the surface the graphics device uses
Definition at line 306 of file graphics.h. Referenced by blit(), color(), flip(), getMainSurface(), Graphics(), isFullscreen(), isHWSurface(), newSurface(), PostOpenGLInit(), toggleFullscreen(), update(), and ~Graphics(). |
|
|
the width and height of the hwSurface.
Definition at line 309 of file graphics.h. Referenced by blitGLtexture(), getWidth(), and Graphics(). |
1.3-rc1