TGUI 1.14-dev
Loading...
Searching...
No Matches
CanvasVulkan.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2026 Bruno Van de Velde (vdv_b@tgui.eu)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#ifndef TGUI_CANVAS_VULKAN_HPP
26#define TGUI_CANVAS_VULKAN_HPP
27
28#include <TGUI/Backend/Renderer/BackendRenderTarget.hpp>
29#include <TGUI/Backend/Renderer/Vulkan/BackendTextureVulkan.hpp>
30
31#include <TGUI/Widgets/CanvasBase.hpp>
32
34
35namespace tgui
36{
102 class TGUI_API CanvasVulkan : public CanvasBase
103 {
104 public:
105 using Ptr = std::shared_ptr<CanvasVulkan>;
106 using ConstPtr = std::shared_ptr<const CanvasVulkan>;
107
108 static constexpr char StaticWidgetType[] = "CanvasVulkan";
109
117 explicit CanvasVulkan(const char* typeName = StaticWidgetType, bool initRenderer = true);
118
122 CanvasVulkan(const CanvasVulkan& copy);
123
127 CanvasVulkan(CanvasVulkan&& copy) = default;
128
132 CanvasVulkan& operator=(const CanvasVulkan& right);
133
137 CanvasVulkan& operator=(CanvasVulkan&& right) = default;
138
146 [[nodiscard]] static CanvasVulkan::Ptr create(const Layout2d& size = {"100%", "100%"});
147
155 [[nodiscard]] static CanvasVulkan::Ptr copy(const CanvasVulkan::ConstPtr& canvas);
156
164 void setSize(const Layout2d& size) override;
165 using Widget::setSize;
166
173 void draw(BackendRenderTarget& target, RenderStates states) const override;
174
184 [[nodiscard]] VkImage getImage() const
185 {
186 return m_backendTexture->getInternalImage();
187 }
188
194 [[nodiscard]] VkImageView getImageView() const
195 {
196 return m_backendTexture->getInternalImageView();
197 }
198
200
201 protected:
203 // Makes a copy of the widget
205 [[nodiscard]] Widget::Ptr clone() const override;
206
208
209 protected:
210 Vector2u m_textureSize;
211 std::shared_ptr<BackendTextureVulkan> m_backendTexture;
212 };
213} // namespace tgui
214
215#endif // TGUI_CANVAS_VULKAN_HPP
Base class for render targets.
Definition BackendRenderTarget.hpp:46
VkImage getImage() const
Access the internal image on which you can render.
Definition CanvasVulkan.hpp:184
static CanvasVulkan::Ptr copy(const CanvasVulkan::ConstPtr &canvas)
Makes a copy of another canvas.
VkImageView getImageView() const
Access the view of the internal image on which you can render.
Definition CanvasVulkan.hpp:194
std::shared_ptr< CanvasVulkan > Ptr
Shared widget pointer.
Definition CanvasVulkan.hpp:105
CanvasVulkan & operator=(const CanvasVulkan &right)
Overload of copy assignment operator.
CanvasVulkan(CanvasVulkan &&copy)=default
Default move constructor.
std::shared_ptr< const CanvasVulkan > ConstPtr
Shared constant widget pointer.
Definition CanvasVulkan.hpp:106
static CanvasVulkan::Ptr create(const Layout2d &size={"100%", "100%"})
Creates a new canvas widget.
CanvasVulkan & operator=(CanvasVulkan &&right)=default
Default move assignment operator.
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
CanvasVulkan(const CanvasVulkan &copy)
Copy constructor.
static constexpr char StaticWidgetType[]
Type name of the widget.
Definition CanvasVulkan.hpp:108
void setSize(const Layout2d &size) override
Changes the size of the widget.
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the widget to a render target.
Class to store the position or size of a widget.
Definition Layout.hpp:320
std::shared_ptr< Widget > Ptr
Shared widget pointer.
Definition Widget.hpp:85
virtual void setSize(const Layout2d &size)
Changes the size of the widget.
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:37
States used for drawing.
Definition RenderStates.hpp:38