SFML - Simple and Fast Multimedia Library

SFML 3.0.1

- Main Page
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

Loading...
Searching...
No Matches
RenderTexture.hpp
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
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#pragma once
26
28// Headers
30#include <SFML/Graphics/Export.hpp>
31
32#include <SFML/Graphics/RenderTarget.hpp>
33#include <SFML/Graphics/Texture.hpp>
34
35#include <SFML/Window/ContextSettings.hpp>
36
37#include <SFML/System/Vector2.hpp>
38
39#include <memory>
40
41
42namespace sf
43{
44namespace priv
45{
46class RenderTextureImpl;
47}
48
53 class SFML_GRAPHICS_API RenderTexture : public RenderTarget
54{
55public:
64 RenderTexture();
65
83 RenderTexture(Vector2u size, const ContextSettings& settings = {});
84
89 ~RenderTexture() override;
90
95 RenderTexture(const RenderTexture&) = delete;
96
101 RenderTexture& operator=(const RenderTexture&) = delete;
102
107 RenderTexture(RenderTexture&&) noexcept;
108
113 RenderTexture& operator=(RenderTexture&&) noexcept;
114
132 [[nodiscard]] bool resize(Vector2u size, const ContextSettings& settings = {});
133
140 [[nodiscard]] static unsigned int getMaximumAntiAliasingLevel();
141
153 void setSmooth(bool smooth);
154
163 [[nodiscard]] bool isSmooth() const;
164
176 void setRepeated(bool repeated);
177
186 [[nodiscard]] bool isRepeated() const;
187
202 [[nodiscard]] bool generateMipmap();
203
219 [[nodiscard]] bool setActive(bool active = true) override;
220
230 void display();
231
241 [[nodiscard]] Vector2u getSize() const override;
242
252 [[nodiscard]] bool isSrgb() const override;
253
268 [[nodiscard]] const Texture& getTexture() const;
269
270private:
272 // Member data
274 std::unique_ptr<priv::RenderTextureImpl> m_impl;
275 Texture m_texture;
276};
277
278} // namespace sf
279
280
ContextSettings.hpp
Export.hpp
SFML_GRAPHICS_API
#define SFML_GRAPHICS_API
Definition Graphics/Export.hpp:42
RenderTarget.hpp
Texture.hpp
Vector2.hpp
sf::RenderTarget::RenderTarget
RenderTarget(const RenderTarget &)=delete
Deleted copy constructor.
sf::RenderTexture::RenderTexture
RenderTexture()
Default constructor.
sf::RenderTexture::operator=
RenderTexture & operator=(const RenderTexture &)=delete
Deleted copy assignment.
sf::RenderTexture::setActive
bool setActive(bool active=true) override
Activate or deactivate the render-texture for rendering.
sf::RenderTexture::~RenderTexture
~RenderTexture() override
Destructor.
sf::RenderTexture::RenderTexture
RenderTexture(RenderTexture &&) noexcept
Move constructor.
sf::RenderTexture::isSmooth
bool isSmooth() const
Tell whether the smooth filtering is enabled or not.
sf::RenderTexture::getTexture
const Texture & getTexture() const
Get a read-only reference to the target texture.
sf::RenderTexture::RenderTexture
RenderTexture(const RenderTexture &)=delete
Deleted copy constructor.
sf::RenderTexture::getSize
Vector2u getSize() const override
Return the size of the rendering region of the texture.
sf::RenderTexture::isRepeated
bool isRepeated() const
Tell whether the texture is repeated or not.
sf::RenderTexture::generateMipmap
bool generateMipmap()
Generate a mipmap using the current texture data.
sf::RenderTexture::getMaximumAntiAliasingLevel
static unsigned int getMaximumAntiAliasingLevel()
Get the maximum anti-aliasing level supported by the system.
sf::RenderTexture::RenderTexture
RenderTexture(Vector2u size, const ContextSettings &settings={})
Construct a render-texture.
sf::RenderTexture::isSrgb
bool isSrgb() const override
Tell if the render-texture will use sRGB encoding when drawing on it.
sf::RenderTexture::resize
bool resize(Vector2u size, const ContextSettings &settings={})
Resize the render-texture.
sf::RenderTexture::setSmooth
void setSmooth(bool smooth)
Enable or disable texture smoothing.
sf::RenderTexture::setRepeated
void setRepeated(bool repeated)
Enable or disable texture repeating.
sf::RenderTexture::display
void display()
Update the contents of the target texture.
sf::Texture
Image living on the graphics card that can be used for drawing.
Definition Texture.hpp:56
sf
Definition AudioResource.hpp:36
sf::Vector2u
Vector2< unsigned int > Vector2u
Definition Vector2.hpp:209
sf::ContextSettings
Structure defining the settings of the OpenGL context attached to a window.
Definition ContextSettings.hpp:39