#include <sdlgraphics.hpp>
Inheritance diagram for gcn::SDLGraphics:
Definition at line 73 of file sdlgraphics.hpp.
Public Member Functions | |
SDLGraphics () | |
Constructor. | |
virtual void | setTarget (SDL_Surface *target) |
Sets the target SDL_Surface to draw to. | |
virtual SDL_Surface * | getTarget () const |
Gets the target SDL_Surface. | |
virtual void | drawSDLSurface (SDL_Surface *surface, SDL_Rect source, SDL_Rect destination) |
Draws an SDL_Surface on the target surface. | |
virtual void | _beginDraw () |
Initializes drawing. | |
virtual void | _endDraw () |
Deinitializes drawing. | |
virtual bool | pushClipArea (Rectangle area) |
Pushes a clip area onto the stack. | |
virtual void | popClipArea () |
Removes the topmost clip area from the stack. | |
virtual void | drawImage (const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height) |
Draws a part of an Image. | |
virtual void | drawPoint (int x, int y) |
Draws a single point/pixel. | |
virtual void | drawLine (int x1, int y1, int x2, int y2) |
Ddraws a line. | |
virtual void | drawRectangle (const Rectangle &rectangle) |
Draws a simple, non-filled, Rectangle with one pixel width. | |
virtual void | fillRectangle (const Rectangle &rectangle) |
Draws a filled Rectangle. | |
virtual void | setColor (const Color &color) |
Sets the Color to use when drawing. | |
virtual const Color & | getColor () |
Gets the Color to use when drawing. | |
Protected Member Functions | |
virtual void | drawHLine (int x1, int y, int x2) |
Draws a horizontal line. | |
virtual void | drawVLine (int x, int y1, int y2) |
Draws a vertical line. | |
Protected Attributes | |
SDL_Surface * | mTarget |
Color | mColor |
bool | mAlpha |
|
Initializes drawing. Called by the Gui when Gui::draw() is called. It is needed by some implementations of Graphics to perform preparations before drawing. An example of such an implementation would be OpenGLGraphics. NOTE: You will never need to call this function yourself. Gui will do it for you.
Reimplemented from gcn::Graphics. Definition at line 78 of file sdlgraphics.cpp. References gcn::Rectangle::height, pushClipArea(), gcn::Rectangle::width, gcn::Rectangle::x, and gcn::Rectangle::y. |
|
Deinitializes drawing. Called by the Gui when a Gui::draw() is done. done. It should reset any state changes made by _beginDraw(). NOTE: You will never need to call this function yourself. Gui will do it for you.
Reimplemented from gcn::Graphics. Definition at line 88 of file sdlgraphics.cpp. References popClipArea(). |
|
Draws a horizontal line.
Definition at line 219 of file sdlgraphics.cpp. References gcn::Color::a, gcn::Color::b, gcn::Color::g, gcn::Rectangle::height, gcn::Color::r, gcn::Rectangle::width, gcn::Rectangle::x, gcn::ClipRectangle::xOffset, gcn::Rectangle::y, and gcn::ClipRectangle::yOffset. Referenced by drawLine(), and drawRectangle(). |
|
Draws a part of an Image. NOTE: Width and height arguments will not scale the Image but specifies the size of the part to be drawn. If you want to draw the whole Image there is a simplified version of this function. EXAMPLE: drawImage(myImage, 10, 10, 20, 20, 40, 40);
Implements gcn::Graphics. Definition at line 138 of file sdlgraphics.cpp. References gcn::Rectangle::x, gcn::ClipRectangle::xOffset, gcn::Rectangle::y, and gcn::ClipRectangle::yOffset. |
|
Ddraws a line.
Implements gcn::Graphics. Definition at line 444 of file sdlgraphics.cpp. References drawHLine(), drawVLine(), gcn::Rectangle::isPointInRect(), gcn::ClipRectangle::xOffset, and gcn::ClipRectangle::yOffset. |
|
Draws a single point/pixel.
Implements gcn::Graphics. Definition at line 200 of file sdlgraphics.cpp. References gcn::Rectangle::isPointInRect(), gcn::ClipRectangle::xOffset, and gcn::ClipRectangle::yOffset. |
|
Draws a simple, non-filled, Rectangle with one pixel width.
Implements gcn::Graphics. Definition at line 430 of file sdlgraphics.cpp. References drawHLine(), drawVLine(), gcn::Rectangle::height, gcn::Rectangle::width, gcn::Rectangle::x, and gcn::Rectangle::y. |
|
Draws an SDL_Surface on the target surface. Normaly you'll use drawImage, but if you want to write SDL specific code this function might come in handy. NOTE: The clip areas will be taken into account. Definition at line 626 of file sdlgraphics.cpp. References gcn::ClipRectangle::xOffset, gcn::Rectangle::y, and gcn::ClipRectangle::yOffset. |
|
Draws a vertical line.
Definition at line 325 of file sdlgraphics.cpp. References gcn::Color::a, gcn::Color::b, gcn::Color::g, gcn::Rectangle::height, gcn::Color::r, gcn::Rectangle::width, gcn::Rectangle::x, gcn::ClipRectangle::xOffset, gcn::Rectangle::y, and gcn::ClipRectangle::yOffset. Referenced by drawLine(), and drawRectangle(). |
|
Draws a filled Rectangle.
Implements gcn::Graphics. Definition at line 157 of file sdlgraphics.cpp. References gcn::Color::a, gcn::Color::b, gcn::Color::g, gcn::Rectangle::height, gcn::Rectangle::intersect(), gcn::Color::r, gcn::Rectangle::width, gcn::Rectangle::x, gcn::ClipRectangle::xOffset, gcn::Rectangle::y, and gcn::ClipRectangle::yOffset. |
|
Gets the Color to use when drawing.
Implements gcn::Graphics. Definition at line 621 of file sdlgraphics.cpp. |
|
Gets the target SDL_Surface.
Definition at line 133 of file sdlgraphics.cpp. |
|
Removes the topmost clip area from the stack.
Reimplemented from gcn::Graphics. Definition at line 114 of file sdlgraphics.cpp. References gcn::Rectangle::height, gcn::Rectangle::width, gcn::Rectangle::x, and gcn::Rectangle::y. Referenced by _endDraw(). |
|
Pushes a clip area onto the stack. The x and y coordinates in the Rectangle will be relative to the last pushed clip area. If the new area falls outside the current clip area, it will be clipped as necessary.
Reimplemented from gcn::Graphics. Definition at line 98 of file sdlgraphics.cpp. References gcn::Rectangle::height, gcn::Rectangle::width, gcn::Rectangle::x, and gcn::Rectangle::y. Referenced by _beginDraw(). |
|
Sets the Color to use when drawing.
Implements gcn::Graphics. Definition at line 614 of file sdlgraphics.cpp. References gcn::Color::a. |
|
Sets the target SDL_Surface to draw to. The target can be any SDL_Surface. This funtion also pushes a clip areas corresponding to the dimension of the target.
Definition at line 93 of file sdlgraphics.cpp. |