#include <sdlgraphics.h>
|
| SDLGraphics () |
|
virtual void | setTarget (SDL_Surface **surface) |
|
virtual void | drawSDLSurface (SDL_Surface *surface, SDL_Rect source, SDL_Rect destination) |
|
virtual void | _beginDraw () |
|
virtual void | _endDraw () |
|
virtual bool | pushClipArea (Rectangle area) |
|
virtual void | popClipArea () |
|
virtual void | drawImage (const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height) |
|
virtual void | drawPoint (int x, int y) |
|
virtual void | drawLine (int x1, int y1, int x2, int y2) |
|
virtual void | drawRectangle (const Rectangle &rectangle) |
|
virtual void | fillRectangle (const Rectangle &rectangle) |
|
virtual void | setColor (const Color &color) |
|
virtual const Color & | getColor () |
|
virtual void | drawImage (const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height)=0 |
|
virtual void | drawImage (const Image *image, int dstX, int dstY) |
|
| Graphics () |
|
virtual | ~Graphics () |
|
virtual const ClipRectangle & | getCurrentClipArea () |
|
virtual void | drawImage (const Image *image, int dstX, int dstY) |
|
virtual void | setFont (Font *font) |
|
virtual void | drawText (const std::string &text, int x, int y, unsigned int alignment=LEFT, bool is_normal=true) |
|
SDL implementation of the Graphics.
◆ SDLGraphics()
gcn::SDLGraphics::SDLGraphics |
( |
| ) |
|
◆ _beginDraw()
void gcn::SDLGraphics::_beginDraw |
( |
| ) |
|
|
virtual |
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.
- See also
- _endDraw, Gui::draw
Reimplemented from gcn::Graphics.
◆ _endDraw()
void gcn::SDLGraphics::_endDraw |
( |
| ) |
|
|
virtual |
◆ drawHLine()
void gcn::SDLGraphics::drawHLine |
( |
int |
x1, |
|
|
int |
y, |
|
|
int |
x2 |
|
) |
| |
|
protectedvirtual |
Draws a horizontal line.
- Parameters
-
x1 | the start coordinate of the line. |
y | the y coordinate of the line. |
x2 | the end coordinate of the line. |
◆ drawImage() [1/3]
void gcn::Graphics::drawImage |
Draws an image. A simplified version of the other drawImage. It will draw a whole image at the coordinate you specify. It is equivalent to calling:
drawImage(myImage, 0, 0, dstX, dstY, image->getWidth(), image->getHeight());
◆ drawImage() [2/3]
void gcn::SDLGraphics::drawImage |
( |
const Image * |
image, |
|
|
int |
srcX, |
|
|
int |
srcY, |
|
|
int |
dstX, |
|
|
int |
dstY, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
|
virtual |
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:
Will draw a rectangular piece of myImage starting at coordinate (10, 10) in myImage, with width and height 40. The piece will be drawn with it's top left corner at coordinate (20, 20).
- Parameters
-
image | the Image to draw. |
srcX | source Image x coordinate. |
srcY | source Image y coordinate. |
dstX | destination x coordinate. |
dstY | destination y coordinate. |
width | the width of the piece. |
height | the height of the piece. |
Implements gcn::Graphics.
◆ drawImage() [3/3]
virtual void gcn::Graphics::drawImage |
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:
Will draw a rectangular piece of myImage starting at coordinate (10, 10) in myImage, with width and height 40. The piece will be drawn with it's top left corner at coordinate (20, 20).
- Parameters
-
image | the Image to draw. |
srcX | source Image x coordinate. |
srcY | source Image y coordinate. |
dstX | destination x coordinate. |
dstY | destination y coordinate. |
width | the width of the piece. |
height | the height of the piece. |
◆ drawLine()
void gcn::SDLGraphics::drawLine |
( |
int |
x1, |
|
|
int |
y1, |
|
|
int |
x2, |
|
|
int |
y2 |
|
) |
| |
|
virtual |
Ddraws a line.
- Parameters
-
x1 | the first x coordinate. |
y1 | the first y coordinate. |
x2 | the second x coordinate. |
y2 | the second y coordinate. |
Implements gcn::Graphics.
◆ drawPoint()
void gcn::SDLGraphics::drawPoint |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
virtual |
Draws a single point/pixel.
- Parameters
-
x | the x coordinate. |
y | the y coordinate. |
Implements gcn::Graphics.
◆ drawRectangle()
void gcn::SDLGraphics::drawRectangle |
( |
const Rectangle & |
rectangle | ) |
|
|
virtual |
◆ drawSDLSurface()
void gcn::SDLGraphics::drawSDLSurface |
( |
SDL_Surface * |
surface, |
|
|
SDL_Rect |
source, |
|
|
SDL_Rect |
destination |
|
) |
| |
|
virtual |
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.
◆ drawVLine()
void gcn::SDLGraphics::drawVLine |
( |
int |
x, |
|
|
int |
y1, |
|
|
int |
y2 |
|
) |
| |
|
protectedvirtual |
Draws a vertical line.
- Parameters
-
x | the x coordinate of the line. |
y1 | the start coordinate of the line. |
y2 | the end coordinate of the line. |
◆ fillRectangle()
void gcn::SDLGraphics::fillRectangle |
( |
const Rectangle & |
rectangle | ) |
|
|
virtual |
◆ getColor()
const Color & gcn::SDLGraphics::getColor |
( |
| ) |
|
|
virtual |
◆ popClipArea()
void gcn::SDLGraphics::popClipArea |
( |
| ) |
|
|
virtual |
Removes the topmost clip area from the stack.
- Exceptions
-
Reimplemented from gcn::Graphics.
◆ pushClipArea()
bool gcn::SDLGraphics::pushClipArea |
( |
Rectangle |
area | ) |
|
|
virtual |
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.
- Parameters
-
area | the clip area to be pushed onto the stack. |
- Returns
- false if the the new area lays totally outside the current clip area. Note that an empty clip area will be pused in this case.
Reimplemented from gcn::Graphics.
◆ setColor()
void gcn::SDLGraphics::setColor |
( |
const Color & |
color | ) |
|
|
virtual |
◆ setTarget()
void gcn::SDLGraphics::setTarget |
( |
SDL_Surface ** |
surface | ) |
|
|
virtual |
Pointer to the target surface to render into. The target can be any SDL_Surface. This funtion also pushes a clip areas corresponding to the dimension of the target.
- Parameters
-
target | the target to draw to. |
◆ mAlpha
bool gcn::SDLGraphics::mAlpha |
|
protected |
◆ mColor
Color gcn::SDLGraphics::mColor |
|
protected |
◆ mTarget
SDL_Surface** gcn::SDLGraphics::mTarget |
|
protected |
The documentation for this class was generated from the following files:
virtual void drawImage(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height)
Definition: sdlgraphics.cpp:137
(C) Copyright 1998-2012 by The