![]() |
Gamedev Framework (gf) 1.2.0
A C++17 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, const 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::BufferedGeometry, gf::Console, gf::Curve, gf::Grid, gf::Logo, gf::NinePatch, gf::PointParticles, gf::ShapeParticles, gf::SpriteParticles, gf::PostProcessing, gf::Segue, gf::Shape, gf::Sprite, gf::Text, gf::TileLayer, gf::VertexArray, gf::TextWidget, gf::TextButtonWidget, gf::SpriteWidget, and gf::ChoiceSpriteWidget.