Logo Search packages:      
Sourcecode: qonk version File versions  Download package

gcn::Graphics Class Reference

#include <graphics.hpp>

Inheritance diagram for gcn::Graphics:


List of all members.

Detailed Description

Used for drawing graphics. It contains all vital functions for drawing. We include implemented Graphics classes for some common platforms like the Allegro library, the OpenGL library and the SDL library. To make Guichan usable under another platform, a Graphics class must be implemented.

In Graphics you can set clip areas to limit drawing to certain areas of the screen. Clip areas are put on a stack, which means that you can push smaller and smaller clip areas onto the stack. All coordinates will be relative to the topmost clip area. In most cases you won't have to worry about the clip areas, unless you want to implement some really complex widget. Pushing and poping of clip areas are handled automatically by container widgets when their child widgets are drawn.

IMPORTANT: Remember to pop each clip area that you pushed on the stack after you are done with it.

If you feel that Graphics is to restrictive for your needs, there is no one stopping you from using your own code for drawing in Widgets. You could for instance use pure SDL in the drawing of Widgets bypassing Graphics. This might however hurt portability of your application.

If you implement a Graphics class not present in Guichan we would be very happy to add it to Guichan.

See also:
AllegroGraphics, OpenGLGraphics, SDLGraphics, Image

Definition at line 100 of file graphics.hpp.

Public Types

enum  { LEFT = 0, CENTER, RIGHT }

Public Member Functions

virtual void _beginDraw ()
virtual void _endDraw ()
virtual void drawImage (const Image *image, int dstX, int dstY)
virtual void drawImage (const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height)=0
virtual void drawLine (int x1, int y1, int x2, int y2)=0
virtual void drawPoint (int x, int y)=0
virtual void drawRectangle (const Rectangle &rectangle)=0
virtual void drawText (const std::string &text, int x, int y, unsigned int alignment=LEFT)
virtual void fillRectangle (const Rectangle &rectangle)=0
virtual const ColorgetColor ()=0
virtual const ClipRectanglegetCurrentClipArea ()
virtual void popClipArea ()
virtual bool pushClipArea (Rectangle area)
virtual void setColor (const Color &color)=0
virtual void setFont (Font *font)

Protected Attributes

std::stack< ClipRectanglemClipStack

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index