#include <openglgraphics.hpp>
Inheritance diagram for gcn::OpenGLGraphics:
Definition at line 69 of file openglgraphics.hpp.
Public Member Functions | |
OpenGLGraphics () | |
Constructor. | |
OpenGLGraphics (int width, int height) | |
Constructor. | |
virtual | ~OpenGLGraphics () |
Destructor. | |
virtual void | setTargetPlane (int width, int height) |
Sets the target plane on where to draw. | |
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 Attributes | |
int | mWidth |
int | mHeight |
bool | mAlpha |
Color | mColor |
gcn::OpenGLGraphics::OpenGLGraphics | ( | int | width, | |
int | height | |||
) |
Constructor.
width | the width of the logical drawing surface. Should be the same as the screen resolution. | |
height | the height ot the logical drawing surface. Should be the same as the screen resolution. |
Definition at line 87 of file openglgraphics.cpp.
References setTargetPlane().
void gcn::OpenGLGraphics::_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.
Reimplemented from gcn::Graphics.
Definition at line 97 of file openglgraphics.cpp.
References mHeight, mWidth, and pushClipArea().
void gcn::OpenGLGraphics::_endDraw | ( | ) | [virtual] |
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 152 of file openglgraphics.cpp.
References popClipArea().
void gcn::OpenGLGraphics::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:
drawImage(myImage, 10, 10, 20, 20, 40, 40);
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.
Definition at line 201 of file openglgraphics.cpp.
References gcn::OpenGLImage::getTextureHandle(), gcn::OpenGLImage::getTextureHeight(), gcn::OpenGLImage::getTextureWidth(), mAlpha, and gcn::Graphics::mClipStack.
void gcn::OpenGLGraphics::drawLine | ( | int | x1, | |
int | y1, | |||
int | x2, | |||
int | y2 | |||
) | [virtual] |
Ddraws a line.
x1 | the first x coordinate. | |
y1 | the first y coordinate. | |
x2 | the second x coordinate. | |
y2 | the second y coordinate. |
Implements gcn::Graphics.
Definition at line 264 of file openglgraphics.cpp.
References gcn::Graphics::mClipStack.
void gcn::OpenGLGraphics::drawPoint | ( | int | x, | |
int | y | |||
) | [virtual] |
Draws a single point/pixel.
x | the x coordinate. | |
y | the y coordinate. |
Implements gcn::Graphics.
Definition at line 254 of file openglgraphics.cpp.
References gcn::Graphics::mClipStack.
void gcn::OpenGLGraphics::drawRectangle | ( | const Rectangle & | rectangle | ) | [virtual] |
Draws a simple, non-filled, Rectangle with one pixel width.
rectangle | the Rectangle to draw. |
Implements gcn::Graphics.
Definition at line 281 of file openglgraphics.cpp.
References gcn::Rectangle::height, gcn::Graphics::mClipStack, gcn::Rectangle::width, gcn::Rectangle::x, and gcn::Rectangle::y.
void gcn::OpenGLGraphics::fillRectangle | ( | const Rectangle & | rectangle | ) | [virtual] |
Draws a filled Rectangle.
rectangle | the filled Rectangle to draw. |
Implements gcn::Graphics.
Definition at line 295 of file openglgraphics.cpp.
References gcn::Rectangle::height, gcn::Graphics::mClipStack, gcn::Rectangle::width, gcn::Rectangle::x, and gcn::Rectangle::y.
const Color & gcn::OpenGLGraphics::getColor | ( | ) | [virtual] |
Gets the Color to use when drawing.
Implements gcn::Graphics.
Definition at line 322 of file openglgraphics.cpp.
References mColor.
void gcn::OpenGLGraphics::popClipArea | ( | ) | [virtual] |
Removes the topmost clip area from the stack.
Exception | if the stack is empty. |
Reimplemented from gcn::Graphics.
Definition at line 180 of file openglgraphics.cpp.
References gcn::Graphics::mClipStack, mHeight, and gcn::Graphics::popClipArea().
Referenced by _endDraw().
bool gcn::OpenGLGraphics::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.
area | the clip area to be pushed onto the stack. |
Reimplemented from gcn::Graphics.
Definition at line 168 of file openglgraphics.cpp.
References gcn::Graphics::mClipStack, mHeight, and gcn::Graphics::pushClipArea().
Referenced by _beginDraw().
void gcn::OpenGLGraphics::setColor | ( | const Color & | color | ) | [virtual] |
Sets the Color to use when drawing.
color | a Color. |
Implements gcn::Graphics.
Definition at line 309 of file openglgraphics.cpp.
References gcn::Color::a, gcn::Color::b, gcn::Color::g, mAlpha, mColor, and gcn::Color::r.
void gcn::OpenGLGraphics::setTargetPlane | ( | int | width, | |
int | height | |||
) | [virtual] |
Sets the target plane on where to draw.
width | the width of the logical drawing surface. Should be the same as the screen resolution. | |
height | the height ot the logical drawing surface. Should be the same as the screen resolution. |
Definition at line 195 of file openglgraphics.cpp.
References mHeight, and mWidth.
Referenced by OpenGLGraphics().