Gamedev Framework (gf)
0.3.0
A C++11 framework for 2D games
|
Abstract base class for objects that can be drawn to a render window. More...
#include <gf/Drawable.h>
Public Member Functions | |
virtual | ~Drawable () |
Virtual desctructor. More... | |
virtual void | draw (RenderTarget &target, RenderStates states)=0 |
Draw the object to a render target. More... | |
Abstract base class for objects that can be drawn to a render window.
gf::Drawable is a very simple base class that allows objects of derived classes to be drawn to a sf::RenderTarget.
All you have to do in your derived class is to override the draw()
virtual function.
Note that inheriting from gf::Drawable
is not mandatory, but it allows this nice syntax target.draw(object)
rather than object.draw(target)
, which is more consistent with other classes.
Example:
|
virtual |
Virtual desctructor.
|
pure virtual |
Draw the object to a render target.
This is a pure virtual function that has to be implemented by the derived class to define how the drawable should be drawn.
target | Render target to draw to |
states | Current render states |
Implemented in gf::UI, gf::Text, gf::Shape, gf::NinePatch, gf::Sprite, gf::Curve, gf::VertexArray, gf::TileLayer, gf::BufferedGeometry, and gf::PostProcessing.