mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
Use in-class member initializers
This commit is contained in:
parent
8049aa3b75
commit
b7198b08d6
@ -117,12 +117,12 @@ struct SFML_GRAPHICS_API BlendMode
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member Data
|
||||
////////////////////////////////////////////////////////////
|
||||
Factor colorSrcFactor; //!< Source blending factor for the color channels
|
||||
Factor colorDstFactor; //!< Destination blending factor for the color channels
|
||||
Equation colorEquation; //!< Blending equation for the color channels
|
||||
Factor alphaSrcFactor; //!< Source blending factor for the alpha channel
|
||||
Factor alphaDstFactor; //!< Destination blending factor for the alpha channel
|
||||
Equation alphaEquation; //!< Blending equation for the alpha channel
|
||||
Factor colorSrcFactor{BlendMode::SrcAlpha}; //!< Source blending factor for the color channels
|
||||
Factor colorDstFactor{BlendMode::OneMinusSrcAlpha}; //!< Destination blending factor for the color channels
|
||||
Equation colorEquation{BlendMode::Add}; //!< Blending equation for the color channels
|
||||
Factor alphaSrcFactor{BlendMode::One}; //!< Source blending factor for the alpha channel
|
||||
Factor alphaDstFactor{BlendMode::OneMinusSrcAlpha}; //!< Destination blending factor for the alpha channel
|
||||
Equation alphaEquation{BlendMode::Add}; //!< Blending equation for the alpha channel
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -96,10 +96,10 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
std::uint8_t r; //!< Red component
|
||||
std::uint8_t g; //!< Green component
|
||||
std::uint8_t b; //!< Blue component
|
||||
std::uint8_t a; //!< Alpha (opacity) component
|
||||
std::uint8_t r{0}; //!< Red component
|
||||
std::uint8_t g{0}; //!< Green component
|
||||
std::uint8_t b{0}; //!< Blue component
|
||||
std::uint8_t a{255}; //!< Alpha (opacity) component
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -24,9 +24,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
constexpr Color::Color() : r(0), g(0), b(0), a(255)
|
||||
{
|
||||
}
|
||||
constexpr Color::Color() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -336,11 +336,11 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
struct Row
|
||||
{
|
||||
Row(unsigned int rowTop, unsigned int rowHeight) : width(0), top(rowTop), height(rowHeight)
|
||||
Row(unsigned int rowTop, unsigned int rowHeight) : top(rowTop), height(rowHeight)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int width; //!< Current width of the row
|
||||
unsigned int width{0}; //!< Current width of the row
|
||||
unsigned int top; //!< Y position of the row into the texture
|
||||
unsigned int height; //!< Height of the row
|
||||
};
|
||||
@ -424,7 +424,7 @@ private:
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
std::shared_ptr<FontHandles> m_fontHandles; //!< Shared information about the internal font instance
|
||||
bool m_isSmooth; //!< Status of the smooth filter
|
||||
bool m_isSmooth{true}; //!< Status of the smooth filter
|
||||
Info m_info; //!< Information about the font
|
||||
mutable PageTable m_pages; //!< Table containing the glyphs pages by character size
|
||||
mutable std::vector<std::uint8_t> m_pixelBuffer; //!< Pixel buffer holding a glyph's pixels before being written to the texture
|
||||
|
@ -95,9 +95,7 @@ struct Vector4
|
||||
/// \brief Default constructor, creates a zero vector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector4() : x(0), y(0), z(0), w(0)
|
||||
{
|
||||
}
|
||||
Vector4() = default;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct from 4 vector components
|
||||
@ -142,13 +140,12 @@ struct Vector4
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector4(const Color& color)
|
||||
// uninitialized
|
||||
{
|
||||
copyVector(color, *this);
|
||||
}
|
||||
|
||||
T x; //!< 1st component (X) of the 4D vector
|
||||
T y; //!< 2nd component (Y) of the 4D vector
|
||||
T z; //!< 3rd component (Z) of the 4D vector
|
||||
T w; //!< 4th component (W) of the 4D vector
|
||||
T x{0}; //!< 1st component (X) of the 4D vector
|
||||
T y{0}; //!< 2nd component (Y) of the 4D vector
|
||||
T z{0}; //!< 3rd component (Z) of the 4D vector
|
||||
T w{0}; //!< 4th component (W) of the 4D vector
|
||||
};
|
||||
|
@ -42,20 +42,12 @@ namespace sf
|
||||
class SFML_GRAPHICS_API Glyph
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Glyph() : advance(0), lsbDelta(0), rsbDelta(0)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
float advance; //!< Offset to move horizontally to the next character
|
||||
int lsbDelta; //!< Left offset after forced autohint. Internally used by getKerning()
|
||||
int rsbDelta; //!< Right offset after forced autohint. Internally used by getKerning()
|
||||
float advance{0}; //!< Offset to move horizontally to the next character
|
||||
int lsbDelta{0}; //!< Left offset after forced autohint. Internally used by getKerning()
|
||||
int rsbDelta{0}; //!< Right offset after forced autohint. Internally used by getKerning()
|
||||
FloatRect bounds; //!< Bounding rectangle of the glyph, in coordinates relative to the baseline
|
||||
IntRect textureRect; //!< Texture coordinates of the glyph inside the font's texture
|
||||
};
|
||||
|
@ -128,10 +128,10 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
T left; //!< Left coordinate of the rectangle
|
||||
T top; //!< Top coordinate of the rectangle
|
||||
T width; //!< Width of the rectangle
|
||||
T height; //!< Height of the rectangle
|
||||
T left{0}; //!< Left coordinate of the rectangle
|
||||
T top{0}; //!< Top coordinate of the rectangle
|
||||
T width{0}; //!< Width of the rectangle
|
||||
T height{0}; //!< Height of the rectangle
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -25,9 +25,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
constexpr Rect<T>::Rect() : left(0), top(0), width(0), height(0)
|
||||
{
|
||||
}
|
||||
constexpr Rect<T>::Rect() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -112,10 +112,10 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
BlendMode blendMode; //!< Blending mode
|
||||
BlendMode blendMode{BlendAlpha}; //!< Blending mode
|
||||
Transform transform; //!< Transform
|
||||
const Texture* texture; //!< Texture
|
||||
const Shader* shader; //!< Shader
|
||||
const Texture* texture{nullptr}; //!< Texture
|
||||
const Shader* shader{nullptr}; //!< Shader
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -486,7 +486,7 @@ private:
|
||||
};
|
||||
|
||||
bool enable; //!< Is the cache enabled?
|
||||
bool glStatesSet; //!< Are our internal GL states set yet?
|
||||
bool glStatesSet{false}; //!< Are our internal GL states set yet?
|
||||
bool viewChanged; //!< Has the current view changed since last draw?
|
||||
BlendMode lastBlendMode; //!< Cached blending mode
|
||||
std::uint64_t lastTextureId; //!< Cached texture
|
||||
@ -501,7 +501,7 @@ private:
|
||||
View m_defaultView; //!< Default view
|
||||
View m_view; //!< Current view
|
||||
StatesCache m_cache; //!< Render states cache
|
||||
std::uint64_t m_id; //!< Unique number that identifies the RenderTarget
|
||||
std::uint64_t m_id{0}; //!< Unique number that identifies the RenderTarget
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -166,7 +166,7 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int m_defaultFrameBuffer; //!< Framebuffer to bind when targeting this window
|
||||
unsigned int m_defaultFrameBuffer{0}; //!< Framebuffer to bind when targeting this window
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -699,8 +699,8 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int m_shaderProgram; //!< OpenGL identifier for the program
|
||||
int m_currentTexture; //!< Location of the current texture in the shader
|
||||
unsigned int m_shaderProgram{0}; //!< OpenGL identifier for the program
|
||||
int m_currentTexture{-1}; //!< Location of the current texture in the shader
|
||||
TextureTable m_textures; //!< Texture variables in the shader, mapped to their location
|
||||
UniformTable m_uniforms; //!< Parameters location cache
|
||||
};
|
||||
|
@ -304,13 +304,13 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
const Texture* m_texture; //!< Texture of the shape
|
||||
const Texture* m_texture{nullptr}; //!< Texture of the shape
|
||||
IntRect m_textureRect; //!< Rectangle defining the area of the source texture to display
|
||||
Color m_fillColor; //!< Fill color
|
||||
Color m_outlineColor; //!< Outline color
|
||||
float m_outlineThickness; //!< Thickness of the shape's outline
|
||||
VertexArray m_vertices; //!< Vertex array containing the fill geometry
|
||||
VertexArray m_outlineVertices; //!< Vertex array containing the outline geometry
|
||||
Color m_fillColor{Color::White}; //!< Fill color
|
||||
Color m_outlineColor{Color::White}; //!< Outline color
|
||||
float m_outlineThickness{0}; //!< Thickness of the shape's outline
|
||||
VertexArray m_vertices{PrimitiveType::TriangleFan}; //!< Vertex array containing the fill geometry
|
||||
VertexArray m_outlineVertices{PrimitiveType::TriangleStrip}; //!< Vertex array containing the outline geometry
|
||||
FloatRect m_insideBounds; //!< Bounding rectangle of the inside (fill)
|
||||
FloatRect m_bounds; //!< Bounding rectangle of the whole shape (outline + fill)
|
||||
};
|
||||
|
@ -215,7 +215,7 @@ private:
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
Vertex m_vertices[4]; //!< Vertices defining the sprite's geometry
|
||||
const Texture* m_texture; //!< Texture of the sprite
|
||||
const Texture* m_texture{nullptr}; //!< Texture of the sprite
|
||||
IntRect m_textureRect; //!< Rectangle defining the area of the source texture to display
|
||||
};
|
||||
|
||||
|
@ -429,19 +429,19 @@ private:
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
String m_string; //!< String to display
|
||||
const Font* m_font; //!< Font used to display the string
|
||||
unsigned int m_characterSize; //!< Base size of characters, in pixels
|
||||
float m_letterSpacingFactor; //!< Spacing factor between letters
|
||||
float m_lineSpacingFactor; //!< Spacing factor between lines
|
||||
std::uint32_t m_style; //!< Text style (see Style enum)
|
||||
Color m_fillColor; //!< Text fill color
|
||||
Color m_outlineColor; //!< Text outline color
|
||||
float m_outlineThickness; //!< Thickness of the text's outline
|
||||
mutable VertexArray m_vertices; //!< Vertex array containing the fill geometry
|
||||
mutable VertexArray m_outlineVertices; //!< Vertex array containing the outline geometry
|
||||
const Font* m_font{nullptr}; //!< Font used to display the string
|
||||
unsigned int m_characterSize{30}; //!< Base size of characters, in pixels
|
||||
float m_letterSpacingFactor{1.f}; //!< Spacing factor between letters
|
||||
float m_lineSpacingFactor{1.f}; //!< Spacing factor between lines
|
||||
std::uint32_t m_style{Regular}; //!< Text style (see Style enum)
|
||||
Color m_fillColor{Color::White}; //!< Text fill color
|
||||
Color m_outlineColor{Color::Black}; //!< Text outline color
|
||||
float m_outlineThickness{0.f}; //!< Thickness of the text's outline
|
||||
mutable VertexArray m_vertices{PrimitiveType::Triangles}; //!< Vertex array containing the fill geometry
|
||||
mutable VertexArray m_outlineVertices{PrimitiveType::Triangles}; //!< Vertex array containing the outline geometry
|
||||
mutable FloatRect m_bounds; //!< Bounding rectangle of the text (in local coordinates)
|
||||
mutable bool m_geometryNeedUpdate; //!< Does the geometry need to be recomputed?
|
||||
mutable std::uint64_t m_fontTextureId; //!< The font texture id
|
||||
mutable bool m_geometryNeedUpdate{false}; //!< Does the geometry need to be recomputed?
|
||||
mutable std::uint64_t m_fontTextureId{0}; //!< The font texture id
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -613,13 +613,13 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2u m_size; //!< Public texture size
|
||||
Vector2u m_actualSize; //!< Actual texture size (can be greater than public size because of padding)
|
||||
unsigned int m_texture; //!< Internal texture identifier
|
||||
bool m_isSmooth; //!< Status of the smooth filter
|
||||
bool m_sRgb; //!< Should the texture source be converted from sRGB?
|
||||
bool m_isRepeated; //!< Is the texture in repeat mode?
|
||||
mutable bool m_pixelsFlipped; //!< To work around the inconsistency in Y orientation
|
||||
bool m_fboAttachment; //!< Is this texture owned by a framebuffer object?
|
||||
bool m_hasMipmap; //!< Has the mipmap been generated?
|
||||
unsigned int m_texture{0}; //!< Internal texture identifier
|
||||
bool m_isSmooth{false}; //!< Status of the smooth filter
|
||||
bool m_sRgb{false}; //!< Should the texture source be converted from sRGB?
|
||||
bool m_isRepeated{false}; //!< Is the texture in repeat mode?
|
||||
mutable bool m_pixelsFlipped{false}; //!< To work around the inconsistency in Y orientation
|
||||
bool m_fboAttachment{false}; //!< Is this texture owned by a framebuffer object?
|
||||
bool m_hasMipmap{false}; //!< Has the mipmap been generated?
|
||||
std::uint64_t m_cacheId; //!< Unique number that identifies the texture to the render target's cache
|
||||
};
|
||||
|
||||
|
@ -266,7 +266,12 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
float m_matrix[16]; //!< 4x4 matrix defining the transformation
|
||||
// clang-format off
|
||||
float m_matrix[16]{1.f, 0.f, 0.f, 0.f,
|
||||
0.f, 1.f, 0.f, 0.f,
|
||||
0.f, 0.f, 1.f, 0.f,
|
||||
0.f, 0.f, 0.f, 1.f}; //!< 4x4 matrix defining the transformation
|
||||
// clang-format off
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -24,16 +24,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// clang-format off
|
||||
constexpr Transform::Transform()
|
||||
// Identity matrix
|
||||
: m_matrix{1.f, 0.f, 0.f, 0.f,
|
||||
0.f, 1.f, 0.f, 0.f,
|
||||
0.f, 0.f, 1.f, 0.f,
|
||||
0.f, 0.f, 0.f, 1.f}
|
||||
{
|
||||
}
|
||||
// clang-format on
|
||||
constexpr Transform::Transform() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -233,11 +233,11 @@ private:
|
||||
Vector2f m_origin; //!< Origin of translation/rotation/scaling of the object
|
||||
Vector2f m_position; //!< Position of the object in the 2D world
|
||||
Angle m_rotation; //!< Orientation of the object
|
||||
Vector2f m_scale; //!< Scale of the object
|
||||
Vector2f m_scale{1, 1}; //!< Scale of the object
|
||||
mutable Transform m_transform; //!< Combined transformation of the object
|
||||
mutable Transform m_inverseTransform; //!< Combined transformation of the object
|
||||
mutable bool m_transformNeedUpdate; //!< Does the transform need to be recomputed?
|
||||
mutable bool m_inverseTransformNeedUpdate; //!< Does the transform need to be recomputed?
|
||||
mutable bool m_transformNeedUpdate{true}; //!< Does the transform need to be recomputed?
|
||||
mutable bool m_inverseTransformNeedUpdate{true}; //!< Does the transform need to be recomputed?
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2f position; //!< 2D position of the vertex
|
||||
Color color; //!< Color of the vertex
|
||||
Color color{Color::White}; //!< Color of the vertex
|
||||
Vector2f texCoords; //!< Coordinates of the texture's pixel to map to the vertex
|
||||
};
|
||||
|
||||
|
@ -24,22 +24,17 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
constexpr Vertex::Vertex() : position(0, 0), color(255, 255, 255), texCoords(0, 0)
|
||||
constexpr Vertex::Vertex() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
constexpr Vertex::Vertex(const Vector2f& thePosition) : position(thePosition)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
constexpr Vertex::Vertex(const Vector2f& thePosition) : position(thePosition), color(255, 255, 255), texCoords(0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
constexpr Vertex::Vertex(const Vector2f& thePosition, const Color& theColor) :
|
||||
position(thePosition),
|
||||
color(theColor),
|
||||
texCoords(0, 0)
|
||||
constexpr Vertex::Vertex(const Vector2f& thePosition, const Color& theColor) : position(thePosition), color(theColor)
|
||||
{
|
||||
}
|
||||
|
||||
@ -47,7 +42,6 @@ texCoords(0, 0)
|
||||
////////////////////////////////////////////////////////////
|
||||
constexpr Vertex::Vertex(const Vector2f& thePosition, const Vector2f& theTexCoords) :
|
||||
position(thePosition),
|
||||
color(255, 255, 255),
|
||||
texCoords(theTexCoords)
|
||||
{
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ private:
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
std::vector<Vertex> m_vertices; //!< Vertices contained in the array
|
||||
PrimitiveType m_primitiveType; //!< Type of primitives to draw
|
||||
PrimitiveType m_primitiveType{PrimitiveType::Points}; //!< Type of primitives to draw
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -334,10 +334,10 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int m_buffer; //!< Internal buffer identifier
|
||||
std::size_t m_size; //!< Size in Vertexes of the currently allocated buffer
|
||||
PrimitiveType m_primitiveType; //!< Type of primitives to draw
|
||||
Usage m_usage; //!< How this vertex buffer is to be used
|
||||
unsigned int m_buffer{0}; //!< Internal buffer identifier
|
||||
std::size_t m_size{0}; //!< Size in Vertexes of the currently allocated buffer
|
||||
PrimitiveType m_primitiveType{PrimitiveType::Points}; //!< Type of primitives to draw
|
||||
Usage m_usage{Stream}; //!< How this vertex buffer is to be used
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -239,11 +239,11 @@ private:
|
||||
Vector2f m_center; //!< Center of the view, in scene coordinates
|
||||
Vector2f m_size; //!< Size of the view, in scene coordinates
|
||||
Angle m_rotation; //!< Angle of rotation of the view rectangle
|
||||
FloatRect m_viewport; //!< Viewport rectangle, expressed as a factor of the render-target's size
|
||||
FloatRect m_viewport{{0, 0}, {1, 1}}; //!< Viewport rectangle, expressed as a factor of the render-target's size
|
||||
mutable Transform m_transform; //!< Precomputed projection transform corresponding to the view
|
||||
mutable Transform m_inverseTransform; //!< Precomputed inverse projection transform corresponding to the view
|
||||
mutable bool m_transformUpdated; //!< Internal state telling if the transform needs to be updated
|
||||
mutable bool m_invTransformUpdated; //!< Internal state telling if the inverse transform needs to be updated
|
||||
mutable bool m_transformUpdated{false}; //!< Internal state telling if the transform needs to be updated
|
||||
mutable bool m_invTransformUpdated{false}; //!< Internal state telling if the inverse transform needs to be updated
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -47,15 +47,7 @@ const BlendMode BlendNone(BlendMode::One, BlendMode::Zero, BlendMode::Add);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
BlendMode::BlendMode() :
|
||||
colorSrcFactor(BlendMode::SrcAlpha),
|
||||
colorDstFactor(BlendMode::OneMinusSrcAlpha),
|
||||
colorEquation(BlendMode::Add),
|
||||
alphaSrcFactor(BlendMode::One),
|
||||
alphaDstFactor(BlendMode::OneMinusSrcAlpha),
|
||||
alphaEquation(BlendMode::Add)
|
||||
{
|
||||
}
|
||||
BlendMode::BlendMode() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -120,9 +120,7 @@ public:
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Font::Font() : m_fontHandles(), m_isSmooth(true), m_info()
|
||||
{
|
||||
}
|
||||
Font::Font() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -85,10 +85,7 @@ ImageLoader& ImageLoader::getInstance()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
ImageLoader::ImageLoader()
|
||||
{
|
||||
// Nothing to do
|
||||
}
|
||||
ImageLoader::ImageLoader() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -45,47 +45,29 @@ const RenderStates RenderStates::Default(BlendMode(
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates::RenderStates() : blendMode(BlendAlpha), transform(), texture(nullptr), shader(nullptr)
|
||||
RenderStates::RenderStates() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates::RenderStates(const Transform& theTransform) : transform(theTransform)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates::RenderStates(const Transform& theTransform) :
|
||||
blendMode(BlendAlpha),
|
||||
transform(theTransform),
|
||||
texture(nullptr),
|
||||
shader(nullptr)
|
||||
RenderStates::RenderStates(const BlendMode& theBlendMode) : blendMode(theBlendMode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates::RenderStates(const BlendMode& theBlendMode) :
|
||||
blendMode(theBlendMode),
|
||||
transform(),
|
||||
texture(nullptr),
|
||||
shader(nullptr)
|
||||
RenderStates::RenderStates(const Texture* theTexture) : texture(theTexture)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates::RenderStates(const Texture* theTexture) :
|
||||
blendMode(BlendAlpha),
|
||||
transform(),
|
||||
texture(theTexture),
|
||||
shader(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates::RenderStates(const Shader* theShader) :
|
||||
blendMode(BlendAlpha),
|
||||
transform(),
|
||||
texture(nullptr),
|
||||
shader(theShader)
|
||||
RenderStates::RenderStates(const Shader* theShader) : shader(theShader)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -147,10 +147,7 @@ std::uint32_t equationToGlConstant(sf::BlendMode::Equation blendEquation)
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderTarget::RenderTarget() : m_defaultView(), m_view(), m_cache(), m_id(0)
|
||||
{
|
||||
m_cache.glStatesSet = false;
|
||||
}
|
||||
RenderTarget::RenderTarget() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -39,9 +39,7 @@ namespace sf
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderTextureImplDefault::RenderTextureImplDefault() : m_context(), m_size(0, 0)
|
||||
{
|
||||
}
|
||||
RenderTextureImplDefault::RenderTextureImplDefault() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -117,15 +117,7 @@ namespace sf
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderTextureImplFBO::RenderTextureImplFBO() :
|
||||
m_depthStencilBuffer(0),
|
||||
m_colorBuffer(0),
|
||||
m_size(0, 0),
|
||||
m_context(),
|
||||
m_textureId(0),
|
||||
m_multisample(false),
|
||||
m_stencil(false),
|
||||
m_sRgb(false)
|
||||
RenderTextureImplFBO::RenderTextureImplFBO()
|
||||
{
|
||||
std::scoped_lock lock(mutex);
|
||||
|
||||
|
@ -139,14 +139,14 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
std::unordered_map<std::uint64_t, unsigned int> m_frameBuffers; //!< OpenGL frame buffer objects per context
|
||||
std::unordered_map<std::uint64_t, unsigned int> m_multisampleFrameBuffers; //!< Optional per-context OpenGL frame buffer objects with multisample attachments
|
||||
unsigned int m_depthStencilBuffer; //!< Optional depth/stencil buffer attached to the frame buffer
|
||||
unsigned int m_colorBuffer; //!< Optional multisample color buffer attached to the frame buffer
|
||||
unsigned int m_depthStencilBuffer{0}; //!< Optional depth/stencil buffer attached to the frame buffer
|
||||
unsigned int m_colorBuffer{0}; //!< Optional multisample color buffer attached to the frame buffer
|
||||
Vector2u m_size; //!< Width and height of the attachments
|
||||
std::unique_ptr<Context> m_context; //!< Backup OpenGL context, used when none already exist
|
||||
unsigned int m_textureId; //!< The ID of the texture to attach to the FBO
|
||||
bool m_multisample; //!< Whether we have to create a multisample frame buffer as well
|
||||
bool m_stencil; //!< Whether we have stencil attachment
|
||||
bool m_sRgb; //!< Whether we need to encode drawn pixels into sRGB color space
|
||||
unsigned int m_textureId{0}; //!< The ID of the texture to attach to the FBO
|
||||
bool m_multisample{false}; //!< Whether we have to create a multisample frame buffer as well
|
||||
bool m_stencil{false}; //!< Whether we have stencil attachment
|
||||
bool m_sRgb{false}; //!< Whether we need to encode drawn pixels into sRGB color space
|
||||
};
|
||||
|
||||
} // namespace priv
|
||||
|
@ -35,15 +35,11 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderWindow::RenderWindow() : m_defaultFrameBuffer(0)
|
||||
{
|
||||
// Nothing to do
|
||||
}
|
||||
RenderWindow::RenderWindow() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderWindow::RenderWindow(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings) :
|
||||
m_defaultFrameBuffer(0)
|
||||
RenderWindow::RenderWindow(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings)
|
||||
{
|
||||
// Don't call the base class constructor because it contains virtual function calls
|
||||
Window::create(mode, title, style, settings);
|
||||
@ -51,7 +47,7 @@ m_defaultFrameBuffer(0)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderWindow::RenderWindow(WindowHandle handle, const ContextSettings& settings) : m_defaultFrameBuffer(0)
|
||||
RenderWindow::RenderWindow(WindowHandle handle, const ContextSettings& settings)
|
||||
{
|
||||
// Don't call the base class constructor because it contains virtual function calls
|
||||
Window::create(handle, settings);
|
||||
|
@ -187,10 +187,7 @@ struct Shader::UniformBinder
|
||||
/// \brief Constructor: set up state before uniform is set
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
UniformBinder(Shader& shader, const std::string& name) :
|
||||
savedProgram(0),
|
||||
currentProgram(castToGlHandle(shader.m_shaderProgram)),
|
||||
location(-1)
|
||||
UniformBinder(Shader& shader, const std::string& name) : currentProgram(castToGlHandle(shader.m_shaderProgram))
|
||||
{
|
||||
if (currentProgram)
|
||||
{
|
||||
@ -228,16 +225,14 @@ struct Shader::UniformBinder
|
||||
UniformBinder& operator=(const UniformBinder&) = delete;
|
||||
|
||||
TransientContextLock lock; //!< Lock to keep context active while uniform is bound
|
||||
GLEXT_GLhandle savedProgram; //!< Handle to the previously active program object
|
||||
GLEXT_GLhandle savedProgram{0}; //!< Handle to the previously active program object
|
||||
GLEXT_GLhandle currentProgram; //!< Handle to the program object of the modified sf::Shader instance
|
||||
GLint location; //!< Uniform location, used by the surrounding sf::Shader code
|
||||
GLint location{-1}; //!< Uniform location, used by the surrounding sf::Shader code
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Shader::Shader() : m_shaderProgram(0), m_currentTexture(-1), m_textures(), m_uniforms()
|
||||
{
|
||||
}
|
||||
Shader::Shader() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -991,9 +986,7 @@ Shader::CurrentTextureType Shader::CurrentTexture;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Shader::Shader() : m_shaderProgram(0), m_currentTexture(-1)
|
||||
{
|
||||
}
|
||||
Shader::Shader() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -149,18 +149,7 @@ FloatRect Shape::getGlobalBounds() const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Shape::Shape() :
|
||||
m_texture(nullptr),
|
||||
m_textureRect(),
|
||||
m_fillColor(255, 255, 255),
|
||||
m_outlineColor(255, 255, 255),
|
||||
m_outlineThickness(0),
|
||||
m_vertices(PrimitiveType::TriangleFan),
|
||||
m_outlineVertices(PrimitiveType::TriangleStrip),
|
||||
m_insideBounds(),
|
||||
m_bounds()
|
||||
{
|
||||
}
|
||||
Shape::Shape() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -35,20 +35,18 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
Sprite::Sprite() : m_texture(nullptr), m_textureRect()
|
||||
{
|
||||
}
|
||||
Sprite::Sprite() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Sprite::Sprite(const Texture& texture) : m_texture(nullptr), m_textureRect()
|
||||
Sprite::Sprite(const Texture& texture)
|
||||
{
|
||||
setTexture(texture, true);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Sprite::Sprite(const Texture& texture, const IntRect& rectangle) : m_texture(nullptr), m_textureRect()
|
||||
Sprite::Sprite(const Texture& texture, const IntRect& rectangle)
|
||||
{
|
||||
// Compute the texture area
|
||||
setTextureRect(rectangle);
|
||||
|
@ -94,41 +94,14 @@ void addGlyphQuad(sf::VertexArray& vertices, sf::Vector2f position, const sf::Co
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
Text::Text() :
|
||||
m_string(),
|
||||
m_font(nullptr),
|
||||
m_characterSize(30),
|
||||
m_letterSpacingFactor(1.f),
|
||||
m_lineSpacingFactor(1.f),
|
||||
m_style(Regular),
|
||||
m_fillColor(255, 255, 255),
|
||||
m_outlineColor(0, 0, 0),
|
||||
m_outlineThickness(0),
|
||||
m_vertices(PrimitiveType::Triangles),
|
||||
m_outlineVertices(PrimitiveType::Triangles),
|
||||
m_bounds(),
|
||||
m_geometryNeedUpdate(false),
|
||||
m_fontTextureId(0)
|
||||
{
|
||||
}
|
||||
Text::Text() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Text::Text(const String& string, const Font& font, unsigned int characterSize) :
|
||||
m_string(string),
|
||||
m_font(&font),
|
||||
m_characterSize(characterSize),
|
||||
m_letterSpacingFactor(1.f),
|
||||
m_lineSpacingFactor(1.f),
|
||||
m_style(Regular),
|
||||
m_fillColor(255, 255, 255),
|
||||
m_outlineColor(0, 0, 0),
|
||||
m_outlineThickness(0),
|
||||
m_vertices(PrimitiveType::Triangles),
|
||||
m_outlineVertices(PrimitiveType::Triangles),
|
||||
m_bounds(),
|
||||
m_geometryNeedUpdate(true),
|
||||
m_fontTextureId(0)
|
||||
m_characterSize(characterSize)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -65,32 +65,16 @@ std::uint64_t getUniqueId()
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
Texture::Texture() :
|
||||
m_size(0, 0),
|
||||
m_actualSize(0, 0),
|
||||
m_texture(0),
|
||||
m_isSmooth(false),
|
||||
m_sRgb(false),
|
||||
m_isRepeated(false),
|
||||
m_pixelsFlipped(false),
|
||||
m_fboAttachment(false),
|
||||
m_hasMipmap(false),
|
||||
m_cacheId(TextureImpl::getUniqueId())
|
||||
Texture::Texture() : m_cacheId(TextureImpl::getUniqueId())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Texture::Texture(const Texture& copy) :
|
||||
m_size(0, 0),
|
||||
m_actualSize(0, 0),
|
||||
m_texture(0),
|
||||
m_isSmooth(copy.m_isSmooth),
|
||||
m_sRgb(copy.m_sRgb),
|
||||
m_isRepeated(copy.m_isRepeated),
|
||||
m_pixelsFlipped(false),
|
||||
m_fboAttachment(false),
|
||||
m_hasMipmap(false),
|
||||
m_cacheId(TextureImpl::getUniqueId())
|
||||
{
|
||||
if (copy.m_texture)
|
||||
|
@ -33,17 +33,7 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
Transformable::Transformable() :
|
||||
m_origin(0, 0),
|
||||
m_position(0, 0),
|
||||
m_rotation(),
|
||||
m_scale(1, 1),
|
||||
m_transform(),
|
||||
m_inverseTransform(),
|
||||
m_transformNeedUpdate(true),
|
||||
m_inverseTransformNeedUpdate(true)
|
||||
{
|
||||
}
|
||||
Transformable::Transformable() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -32,9 +32,7 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
VertexArray::VertexArray() : m_vertices(), m_primitiveType(PrimitiveType::Points)
|
||||
{
|
||||
}
|
||||
VertexArray::VertexArray() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -63,43 +63,29 @@ GLenum usageToGlEnum(sf::VertexBuffer::Usage usage)
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
VertexBuffer::VertexBuffer() : m_buffer(0), m_size(0), m_primitiveType(PrimitiveType::Points), m_usage(Stream)
|
||||
VertexBuffer::VertexBuffer() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
VertexBuffer::VertexBuffer(PrimitiveType type) : m_primitiveType(type)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
VertexBuffer::VertexBuffer(PrimitiveType type) : m_buffer(0), m_size(0), m_primitiveType(type), m_usage(Stream)
|
||||
VertexBuffer::VertexBuffer(VertexBuffer::Usage usage) : m_usage(usage)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
VertexBuffer::VertexBuffer(VertexBuffer::Usage usage) :
|
||||
m_buffer(0),
|
||||
m_size(0),
|
||||
m_primitiveType(PrimitiveType::Points),
|
||||
m_usage(usage)
|
||||
VertexBuffer::VertexBuffer(PrimitiveType type, VertexBuffer::Usage usage) : m_primitiveType(type), m_usage(usage)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
VertexBuffer::VertexBuffer(PrimitiveType type, VertexBuffer::Usage usage) :
|
||||
m_buffer(0),
|
||||
m_size(0),
|
||||
m_primitiveType(type),
|
||||
m_usage(usage)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
VertexBuffer::VertexBuffer(const VertexBuffer& copy) :
|
||||
m_buffer(0),
|
||||
m_size(0),
|
||||
m_primitiveType(copy.m_primitiveType),
|
||||
m_usage(copy.m_usage)
|
||||
VertexBuffer::VertexBuffer(const VertexBuffer& copy) : m_primitiveType(copy.m_primitiveType), m_usage(copy.m_usage)
|
||||
{
|
||||
if (copy.m_buffer && copy.m_size)
|
||||
{
|
||||
|
@ -33,39 +33,21 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
View::View() :
|
||||
m_center(),
|
||||
m_size(),
|
||||
m_rotation(),
|
||||
m_viewport({0, 0}, {1, 1}),
|
||||
m_transformUpdated(false),
|
||||
m_invTransformUpdated(false)
|
||||
View::View()
|
||||
{
|
||||
reset(FloatRect({0, 0}, {1000, 1000}));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
View::View(const FloatRect& rectangle) :
|
||||
m_center(),
|
||||
m_size(),
|
||||
m_rotation(),
|
||||
m_viewport({0, 0}, {1, 1}),
|
||||
m_transformUpdated(false),
|
||||
m_invTransformUpdated(false)
|
||||
View::View(const FloatRect& rectangle)
|
||||
{
|
||||
reset(rectangle);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
View::View(const Vector2f& center, const Vector2f& size) :
|
||||
m_center(center),
|
||||
m_size(size),
|
||||
m_rotation(),
|
||||
m_viewport({0, 0}, {1, 1}),
|
||||
m_transformUpdated(false),
|
||||
m_invTransformUpdated(false)
|
||||
View::View(const Vector2f& center, const Vector2f& size) : m_center(center), m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user