SFML 3.0.1
Loading...
Searching...
No Matches
RenderStates.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/BlendMode.hpp>
33#include <SFML/Graphics/CoordinateType.hpp>
34#include <SFML/Graphics/StencilMode.hpp>
35#include <SFML/Graphics/Transform.hpp>
36
37
38 namespace sf
39{
40 class Shader;
41 class Texture;
42
47 struct SFML_GRAPHICS_API RenderStates
48{
62 RenderStates() = default;
63
70 RenderStates(const BlendMode& theBlendMode);
71
78 RenderStates(const StencilMode& theStencilMode);
79
86 RenderStates(const Transform& theTransform);
87
94 RenderStates(const Texture* theTexture);
95
102 RenderStates(const Shader* theShader);
103
115 RenderStates(const BlendMode& theBlendMode,
116 const StencilMode& theStencilMode,
117 const Transform& theTransform,
118 CoordinateType theCoordinateType,
119 const Texture* theTexture,
120 const Shader* theShader);
121
123 // Static member data
125 // NOLINTNEXTLINE(readability-identifier-naming)
126 static const RenderStates Default;
127
129 // Member data
131 BlendMode blendMode{BlendAlpha};
132 StencilMode stencilMode;
133 Transform transform;
134 CoordinateType coordinateType{CoordinateType::Pixels};
135 const Texture* texture{};
136 const Shader* shader{};
137};
138
139} // namespace sf
140
141
BlendMode.hpp
CoordinateType.hpp
Export.hpp
SFML_GRAPHICS_API
#define SFML_GRAPHICS_API
Definition Graphics/Export.hpp:42
StencilMode.hpp
Transform.hpp
sf::Shader
Shader class (vertex, geometry and fragment)
Definition Shader.hpp:54
sf::Texture
Image living on the graphics card that can be used for drawing.
Definition Texture.hpp:56
sf::Transform
3x3 transform matrix
Definition Transform.hpp:48
sf::CoordinateType
CoordinateType
Types of texture coordinates that can be used for rendering.
Definition CoordinateType.hpp:38
sf::CoordinateType::Pixels
@ Pixels
Texture coordinates in range [0 .. size].
Definition CoordinateType.hpp:40
sf
Definition AudioResource.hpp:36
sf::BlendAlpha
const BlendMode BlendAlpha
Blend source and dest according to dest alpha.
sf::BlendMode
Blending modes for drawing.
Definition BlendMode.hpp:41
sf::RenderStates::RenderStates
RenderStates()=default
Default constructor.
sf::RenderStates::transform
Transform transform
Transform.
Definition RenderStates.hpp:133
sf::RenderStates::RenderStates
RenderStates(const Shader *theShader)
Construct a default set of render states with a custom shader.
sf::RenderStates::RenderStates
RenderStates(const Transform &theTransform)
Construct a default set of render states with a custom transform.
sf::RenderStates::texture
const Texture * texture
Texture.
Definition RenderStates.hpp:135
sf::RenderStates::RenderStates
RenderStates(const BlendMode &theBlendMode, const StencilMode &theStencilMode, const Transform &theTransform, CoordinateType theCoordinateType, const Texture *theTexture, const Shader *theShader)
Construct a set of render states with all its attributes.
sf::RenderStates::coordinateType
CoordinateType coordinateType
Texture coordinate type.
Definition RenderStates.hpp:134
sf::RenderStates::RenderStates
RenderStates(const Texture *theTexture)
Construct a default set of render states with a custom texture.
sf::RenderStates::stencilMode
StencilMode stencilMode
Stencil mode.
Definition RenderStates.hpp:132
sf::RenderStates::RenderStates
RenderStates(const BlendMode &theBlendMode)
Construct a default set of render states with a custom blend mode.
sf::RenderStates::Default
static const RenderStates Default
Special instance holding the default render states.
Definition RenderStates.hpp:126
sf::RenderStates::shader
const Shader * shader
Shader.
Definition RenderStates.hpp:136
sf::RenderStates::blendMode
BlendMode blendMode
Blending mode.
Definition RenderStates.hpp:131
sf::RenderStates::RenderStates
RenderStates(const StencilMode &theStencilMode)
Construct a default set of render states with a custom stencil mode.
sf::StencilMode
Stencil modes for drawing.
Definition StencilMode.hpp:107