Warning
This page refers to an old version of SFML. Click here to switch to the latest version.
Warning
This page refers to an old version of SFML. Click here to switch to the latest version.
Abstract base class for objects that can be drawn to a render target. More...
#include <SFML/Graphics/Drawable.hpp>
Public Member Functions | |
virtual | ~Drawable ()=default |
Virtual destructor. |
Protected Member Functions | |
virtual void | draw (RenderTarget &target, RenderStates states) const =0 |
Draw the object to a render target. |
Friends | |
class | RenderTarget |
Abstract base class for objects that can be drawn to a render target.
sf::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 sf::Drawable is not mandatory, but it allows this nice syntax window.draw(object) rather than object.draw(window), which is more consistent with other SFML classes.
Example:
Definition at line 43 of file Drawable.hpp.
|
virtualdefault |
Virtual destructor.
|
protectedpure 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 |
|
friend |
Definition at line 53 of file Drawable.hpp.