26#ifndef TGUI_CANVAS_HPP
27#define TGUI_CANVAS_HPP
30#include <TGUI/Widgets/ClickableWidget.hpp>
31#include <SFML/Graphics/RenderTexture.hpp>
32#include <SFML/Graphics/Sprite.hpp>
44 typedef std::shared_ptr<Canvas>
Ptr;
45 typedef std::shared_ptr<const Canvas>
ConstPtr;
176 void draw(
const sf::Drawable& drawable,
const sf::RenderStates& states = sf::RenderStates::Default);
188 void draw(
const sf::Vertex* vertices, std::size_t vertexCount,
189 sf::PrimitiveType type,
const sf::RenderStates& states = sf::RenderStates::Default);
198 void draw(
const tgui::Sprite& sprite,
const sf::RenderStates& states = sf::RenderStates::Default);
219 void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
240 return m_renderTexture;
261 return std::make_shared<Canvas>(*
this);
268 sf::RenderTexture m_renderTexture;
Definition: Canvas.hpp:41
void setSize(const Layout2d &size) override
Changes the size of the widget.
sf::RenderTexture & getRenderTexture()
Access the internal render texture that the canvas widget uses to draw on.
Definition: Canvas.hpp:238
Canvas(const Layout2d &size={"100%", "100%"})
Default constructor.
sf::IntRect getViewport() const
Get the viewport of the currently applied view, applied to this canvas.
bool canGainFocus() const override
Returns whether the widget can gain focus.
void draw(const tgui::Sprite &sprite, const sf::RenderStates &states=sf::RenderStates::Default)
Draws a TGUI sprite to the canvas.
void draw(const sf::Vertex *vertices, std::size_t vertexCount, sf::PrimitiveType type, const sf::RenderStates &states=sf::RenderStates::Default)
Draws primitives defined by an array of vertices.
void draw(const sf::Drawable &drawable, const sf::RenderStates &states=sf::RenderStates::Default)
Draws a drawable object to the canvas.
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw the widget to a render target.
void rendererChanged(const std::string &property) override
Function called when one of the properties of the renderer is changed.
const sf::View & getDefaultView() const
Get the default view of the canvas.
static Canvas::Ptr copy(Canvas::ConstPtr canvas)
Makes a copy of another canvas.
const sf::View & getView() const
Get the view currently in use in the canvas.
void clear(Color color=Color::Black)
Clears the entire canvas with a single color.
Canvas(const Canvas ©)
Copy constructor.
void display()
Updates the contents of the canvas.
static Canvas::Ptr create(Layout2d size={"100%", "100%"})
Creates a new canvas widget.
Canvas(Canvas &©)
Move constructor.
void setView(const sf::View &view)
Change the current active view.
std::shared_ptr< const Canvas > ConstPtr
Shared constant widget pointer.
Definition: Canvas.hpp:45
std::shared_ptr< Canvas > Ptr
Shared widget pointer.
Definition: Canvas.hpp:44
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: Canvas.hpp:259
Wrapper for colors.
Definition: Color.hpp:49
static const Color Black
Black predefined color.
Definition: Color.hpp:206
Class to store the position or size of a widget.
Definition: Layout.hpp:260
Definition: Sprite.hpp:46
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37