25#ifndef TGUI_CANVAS_SDL_HPP
26#define TGUI_CANVAS_SDL_HPP
28#include <TGUI/Backend/Renderer/SDL_Renderer/BackendTextureSDL.hpp>
30#if !TGUI_BUILD_AS_CXX_MODULE
31 #include <TGUI/Backend/Renderer/BackendRenderTarget.hpp>
32 #include <TGUI/Widgets/CanvasBase.hpp>
35#include <TGUI/extlibs/IncludeSDL.hpp>
39TGUI_MODULE_EXPORT
namespace tgui
71 using Ptr = std::shared_ptr<CanvasSDL>;
72 using ConstPtr = std::shared_ptr<const CanvasSDL>;
74 static constexpr const char StaticWidgetType[] =
"CanvasSDL";
83 CanvasSDL(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
129 using Widget::setSize;
150 return m_textureTarget;
164 SDL_Texture* m_textureTarget =
nullptr;
167 std::shared_ptr<BackendTextureSDL> m_backendTexture;
Base class for render targets.
Definition BackendRenderTarget.hpp:46
This class is used as base class for the backend-specific canvas widgets.
Definition CanvasBase.hpp:38
CanvasSDL provides a way to directly render SDL contents on a widget.
Definition CanvasSDL.hpp:68
void setSize(const Layout2d &size) override
Changes the size of the widget.
std::shared_ptr< const CanvasSDL > ConstPtr
Shared constant widget pointer.
Definition CanvasSDL.hpp:72
std::shared_ptr< CanvasSDL > Ptr
Shared widget pointer.
Definition CanvasSDL.hpp:71
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the widget to a render target.
CanvasSDL(CanvasSDL &©)=default
Default move constructor.
static CanvasSDL::Ptr create(const Layout2d &size={"100%", "100%"})
Creates a new canvas widget.
static CanvasSDL::Ptr copy(const CanvasSDL::ConstPtr &canvas)
Makes a copy of another canvas.
SDL_Texture * getTextureTarget()
Access the internal texture on which you can render.
Definition CanvasSDL.hpp:148
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
CanvasSDL(const CanvasSDL ©)
Copy constructor.
Class to store the position or size of a widget.
Definition Layout.hpp:323
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
States used for drawing.
Definition RenderStates.hpp:38