From b7198b08d63172a362c21a1dbc5661da711bae71 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Fri, 12 Aug 2022 22:49:38 -0600 Subject: [PATCH] Use in-class member initializers --- include/SFML/Graphics/BlendMode.hpp | 12 +++---- include/SFML/Graphics/Color.hpp | 8 ++--- include/SFML/Graphics/Color.inl | 4 +-- include/SFML/Graphics/Font.hpp | 16 ++++----- include/SFML/Graphics/Glsl.inl | 13 +++---- include/SFML/Graphics/Glyph.hpp | 14 ++------ include/SFML/Graphics/Rect.hpp | 8 ++--- include/SFML/Graphics/Rect.inl | 4 +-- include/SFML/Graphics/RenderStates.hpp | 8 ++--- include/SFML/Graphics/RenderTarget.hpp | 4 +-- include/SFML/Graphics/RenderWindow.hpp | 2 +- include/SFML/Graphics/Shader.hpp | 8 ++--- include/SFML/Graphics/Shape.hpp | 18 +++++----- include/SFML/Graphics/Sprite.hpp | 6 ++-- include/SFML/Graphics/Text.hpp | 28 +++++++-------- include/SFML/Graphics/Texture.hpp | 20 +++++------ include/SFML/Graphics/Transform.hpp | 7 +++- include/SFML/Graphics/Transform.inl | 11 +----- include/SFML/Graphics/Transformable.hpp | 16 ++++----- include/SFML/Graphics/Vertex.hpp | 6 ++-- include/SFML/Graphics/Vertex.inl | 18 ++++------ include/SFML/Graphics/VertexArray.hpp | 4 +-- include/SFML/Graphics/VertexBuffer.hpp | 8 ++--- include/SFML/Graphics/View.hpp | 16 ++++----- src/SFML/Graphics/BlendMode.cpp | 10 +----- src/SFML/Graphics/Font.cpp | 4 +-- src/SFML/Graphics/ImageLoader.cpp | 5 +-- src/SFML/Graphics/RenderStates.cpp | 34 +++++-------------- src/SFML/Graphics/RenderTarget.cpp | 5 +-- .../Graphics/RenderTextureImplDefault.cpp | 4 +-- src/SFML/Graphics/RenderTextureImplFBO.cpp | 10 +----- src/SFML/Graphics/RenderTextureImplFBO.hpp | 12 +++---- src/SFML/Graphics/RenderWindow.cpp | 10 ++---- src/SFML/Graphics/Shader.cpp | 21 ++++-------- src/SFML/Graphics/Shape.cpp | 13 +------ src/SFML/Graphics/Sprite.cpp | 8 ++--- src/SFML/Graphics/Text.cpp | 31 ++--------------- src/SFML/Graphics/Texture.cpp | 18 +--------- src/SFML/Graphics/Transformable.cpp | 12 +------ src/SFML/Graphics/VertexArray.cpp | 4 +-- src/SFML/Graphics/VertexBuffer.cpp | 30 +++++----------- src/SFML/Graphics/View.cpp | 24 ++----------- 42 files changed, 167 insertions(+), 347 deletions(-) diff --git a/include/SFML/Graphics/BlendMode.hpp b/include/SFML/Graphics/BlendMode.hpp index c979b785d..e70d0fc46 100644 --- a/include/SFML/Graphics/BlendMode.hpp +++ b/include/SFML/Graphics/BlendMode.hpp @@ -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 }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/Color.hpp b/include/SFML/Graphics/Color.hpp index 214a577d2..6cb139ffa 100644 --- a/include/SFML/Graphics/Color.hpp +++ b/include/SFML/Graphics/Color.hpp @@ -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 }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/Color.inl b/include/SFML/Graphics/Color.inl index 4e6d25468..3cc2656c3 100644 --- a/include/SFML/Graphics/Color.inl +++ b/include/SFML/Graphics/Color.inl @@ -24,9 +24,7 @@ //////////////////////////////////////////////////////////// -constexpr Color::Color() : r(0), g(0), b(0), a(255) -{ -} +constexpr Color::Color() = default; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp index 39f7a89ff..e1dd2dae0 100644 --- a/include/SFML/Graphics/Font.hpp +++ b/include/SFML/Graphics/Font.hpp @@ -336,13 +336,13 @@ 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 top; //!< Y position of the row into the texture - unsigned int height; //!< Height 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 }; //////////////////////////////////////////////////////////// @@ -423,10 +423,10 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - std::shared_ptr m_fontHandles; //!< Shared information about the internal font instance - bool m_isSmooth; //!< Status of the smooth filter - Info m_info; //!< Information about the font - mutable PageTable m_pages; //!< Table containing the glyphs pages by character size + std::shared_ptr m_fontHandles; //!< Shared information about the internal font instance + 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 m_pixelBuffer; //!< Pixel buffer holding a glyph's pixels before being written to the texture #ifdef SFML_SYSTEM_ANDROID std::unique_ptr m_stream; //!< Asset file streamer (if loaded from file) diff --git a/include/SFML/Graphics/Glsl.inl b/include/SFML/Graphics/Glsl.inl index 9e678bf8b..ab0fd3d7e 100644 --- a/include/SFML/Graphics/Glsl.inl +++ b/include/SFML/Graphics/Glsl.inl @@ -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 }; diff --git a/include/SFML/Graphics/Glyph.hpp b/include/SFML/Graphics/Glyph.hpp index 3794870d4..216147977 100644 --- a/include/SFML/Graphics/Glyph.hpp +++ b/include/SFML/Graphics/Glyph.hpp @@ -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 }; diff --git a/include/SFML/Graphics/Rect.hpp b/include/SFML/Graphics/Rect.hpp index c4648b4af..770c0c55d 100644 --- a/include/SFML/Graphics/Rect.hpp +++ b/include/SFML/Graphics/Rect.hpp @@ -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 }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/Rect.inl b/include/SFML/Graphics/Rect.inl index 3b172d099..6e834e8a9 100644 --- a/include/SFML/Graphics/Rect.inl +++ b/include/SFML/Graphics/Rect.inl @@ -25,9 +25,7 @@ //////////////////////////////////////////////////////////// template -constexpr Rect::Rect() : left(0), top(0), width(0), height(0) -{ -} +constexpr Rect::Rect() = default; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/RenderStates.hpp b/include/SFML/Graphics/RenderStates.hpp index c4f194ac3..84d69d6fe 100644 --- a/include/SFML/Graphics/RenderStates.hpp +++ b/include/SFML/Graphics/RenderStates.hpp @@ -112,10 +112,10 @@ public: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - BlendMode blendMode; //!< Blending mode - Transform transform; //!< Transform - const Texture* texture; //!< Texture - const Shader* shader; //!< Shader + BlendMode blendMode{BlendAlpha}; //!< Blending mode + Transform transform; //!< Transform + const Texture* texture{nullptr}; //!< Texture + const Shader* shader{nullptr}; //!< Shader }; } // namespace sf diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp index b821321b2..7f4b87ac3 100644 --- a/include/SFML/Graphics/RenderTarget.hpp +++ b/include/SFML/Graphics/RenderTarget.hpp @@ -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 diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp index 8ba96bc5e..9db857610 100644 --- a/include/SFML/Graphics/RenderWindow.hpp +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -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 diff --git a/include/SFML/Graphics/Shader.hpp b/include/SFML/Graphics/Shader.hpp index e7a97767e..00220c248 100644 --- a/include/SFML/Graphics/Shader.hpp +++ b/include/SFML/Graphics/Shader.hpp @@ -699,10 +699,10 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - unsigned int m_shaderProgram; //!< OpenGL identifier for the program - int m_currentTexture; //!< 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 + 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 }; } // namespace sf diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp index d034a8f1b..338d4c36d 100644 --- a/include/SFML/Graphics/Shape.hpp +++ b/include/SFML/Graphics/Shape.hpp @@ -304,15 +304,15 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - const Texture* m_texture; //!< 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 - FloatRect m_insideBounds; //!< Bounding rectangle of the inside (fill) - FloatRect m_bounds; //!< Bounding rectangle of the whole shape (outline + fill) + 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{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) }; } // namespace sf diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp index ba89b033d..6a6e59036 100644 --- a/include/SFML/Graphics/Sprite.hpp +++ b/include/SFML/Graphics/Sprite.hpp @@ -214,9 +214,9 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - Vertex m_vertices[4]; //!< Vertices defining the sprite's geometry - const Texture* m_texture; //!< Texture of the sprite - IntRect m_textureRect; //!< Rectangle defining the area of the source texture to display + Vertex m_vertices[4]; //!< Vertices defining the sprite's geometry + const Texture* m_texture{nullptr}; //!< Texture of the sprite + IntRect m_textureRect; //!< Rectangle defining the area of the source texture to display }; } // namespace sf diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp index e97e34fde..4ccf47676 100644 --- a/include/SFML/Graphics/Text.hpp +++ b/include/SFML/Graphics/Text.hpp @@ -428,20 +428,20 @@ 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 - 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 + String m_string; //!< String to display + 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{false}; //!< Does the geometry need to be recomputed? + mutable std::uint64_t m_fontTextureId{0}; //!< The font texture id }; } // namespace sf diff --git a/include/SFML/Graphics/Texture.hpp b/include/SFML/Graphics/Texture.hpp index f26bfaa2c..f82a8c6f5 100644 --- a/include/SFML/Graphics/Texture.hpp +++ b/include/SFML/Graphics/Texture.hpp @@ -611,16 +611,16 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - 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? - std::uint64_t m_cacheId; //!< Unique number that identifies the texture to the render target's cache + 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{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 }; } // namespace sf diff --git a/include/SFML/Graphics/Transform.hpp b/include/SFML/Graphics/Transform.hpp index 227197473..e1eb9f6ff 100644 --- a/include/SFML/Graphics/Transform.hpp +++ b/include/SFML/Graphics/Transform.hpp @@ -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 }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/Transform.inl b/include/SFML/Graphics/Transform.inl index 712df2844..cb01ce35b 100644 --- a/include/SFML/Graphics/Transform.inl +++ b/include/SFML/Graphics/Transform.inl @@ -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; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/Transformable.hpp b/include/SFML/Graphics/Transformable.hpp index b214d078f..968a1d689 100644 --- a/include/SFML/Graphics/Transformable.hpp +++ b/include/SFML/Graphics/Transformable.hpp @@ -230,14 +230,14 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - 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 - 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? + 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{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{true}; //!< Does the transform need to be recomputed? + mutable bool m_inverseTransformNeedUpdate{true}; //!< Does the transform need to be recomputed? }; } // namespace sf diff --git a/include/SFML/Graphics/Vertex.hpp b/include/SFML/Graphics/Vertex.hpp index e1d20fba8..5c4a686a4 100644 --- a/include/SFML/Graphics/Vertex.hpp +++ b/include/SFML/Graphics/Vertex.hpp @@ -92,9 +92,9 @@ public: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - Vector2f position; //!< 2D position of the vertex - Color color; //!< Color of the vertex - Vector2f texCoords; //!< Coordinates of the texture's pixel to map to the vertex + Vector2f position; //!< 2D position of the vertex + Color color{Color::White}; //!< Color of the vertex + Vector2f texCoords; //!< Coordinates of the texture's pixel to map to the vertex }; #include diff --git a/include/SFML/Graphics/Vertex.inl b/include/SFML/Graphics/Vertex.inl index ca46592f3..e1c7eca29 100644 --- a/include/SFML/Graphics/Vertex.inl +++ b/include/SFML/Graphics/Vertex.inl @@ -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) { } diff --git a/include/SFML/Graphics/VertexArray.hpp b/include/SFML/Graphics/VertexArray.hpp index a33b1cd43..f41e773d1 100644 --- a/include/SFML/Graphics/VertexArray.hpp +++ b/include/SFML/Graphics/VertexArray.hpp @@ -185,8 +185,8 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - std::vector m_vertices; //!< Vertices contained in the array - PrimitiveType m_primitiveType; //!< Type of primitives to draw + std::vector m_vertices; //!< Vertices contained in the array + PrimitiveType m_primitiveType{PrimitiveType::Points}; //!< Type of primitives to draw }; } // namespace sf diff --git a/include/SFML/Graphics/VertexBuffer.hpp b/include/SFML/Graphics/VertexBuffer.hpp index 21d6d2dd3..4b5a04fff 100644 --- a/include/SFML/Graphics/VertexBuffer.hpp +++ b/include/SFML/Graphics/VertexBuffer.hpp @@ -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 diff --git a/include/SFML/Graphics/View.hpp b/include/SFML/Graphics/View.hpp index 15b5abaf9..1d1dc8c1c 100644 --- a/include/SFML/Graphics/View.hpp +++ b/include/SFML/Graphics/View.hpp @@ -236,14 +236,14 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - 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 - 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 + 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{{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{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 diff --git a/src/SFML/Graphics/BlendMode.cpp b/src/SFML/Graphics/BlendMode.cpp index 4872e319b..70a1b5a3c 100644 --- a/src/SFML/Graphics/BlendMode.cpp +++ b/src/SFML/Graphics/BlendMode.cpp @@ -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; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index 29671d304..30947c514 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -120,9 +120,7 @@ public: //////////////////////////////////////////////////////////// -Font::Font() : m_fontHandles(), m_isSmooth(true), m_info() -{ -} +Font::Font() = default; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/ImageLoader.cpp b/src/SFML/Graphics/ImageLoader.cpp index 970277857..a29eec8e8 100644 --- a/src/SFML/Graphics/ImageLoader.cpp +++ b/src/SFML/Graphics/ImageLoader.cpp @@ -85,10 +85,7 @@ ImageLoader& ImageLoader::getInstance() //////////////////////////////////////////////////////////// -ImageLoader::ImageLoader() -{ - // Nothing to do -} +ImageLoader::ImageLoader() = default; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/RenderStates.cpp b/src/SFML/Graphics/RenderStates.cpp index 63afa6521..0ed472bdc 100644 --- a/src/SFML/Graphics/RenderStates.cpp +++ b/src/SFML/Graphics/RenderStates.cpp @@ -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) { } diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index 28a345940..0ea3f55d7 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -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; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/RenderTextureImplDefault.cpp b/src/SFML/Graphics/RenderTextureImplDefault.cpp index 6680ab693..bccba2131 100644 --- a/src/SFML/Graphics/RenderTextureImplDefault.cpp +++ b/src/SFML/Graphics/RenderTextureImplDefault.cpp @@ -39,9 +39,7 @@ namespace sf namespace priv { //////////////////////////////////////////////////////////// -RenderTextureImplDefault::RenderTextureImplDefault() : m_context(), m_size(0, 0) -{ -} +RenderTextureImplDefault::RenderTextureImplDefault() = default; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/RenderTextureImplFBO.cpp b/src/SFML/Graphics/RenderTextureImplFBO.cpp index 40a528ac9..3bdc756f9 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.cpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.cpp @@ -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); diff --git a/src/SFML/Graphics/RenderTextureImplFBO.hpp b/src/SFML/Graphics/RenderTextureImplFBO.hpp index 6732d04d1..a09cad320 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.hpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.hpp @@ -139,14 +139,14 @@ private: //////////////////////////////////////////////////////////// std::unordered_map m_frameBuffers; //!< OpenGL frame buffer objects per context std::unordered_map 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 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 diff --git a/src/SFML/Graphics/RenderWindow.cpp b/src/SFML/Graphics/RenderWindow.cpp index 8e778a14e..d5ca3c63f 100644 --- a/src/SFML/Graphics/RenderWindow.cpp +++ b/src/SFML/Graphics/RenderWindow.cpp @@ -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); diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index e24048804..bfd54ae80 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -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) { @@ -227,17 +224,15 @@ 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 currentProgram; //!< Handle to the program object of the modified sf::Shader instance - GLint location; //!< Uniform location, used by the surrounding sf::Shader code + TransientContextLock lock; //!< Lock to keep context active while uniform is bound + 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{-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; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp index 30713ad71..0302df9d1 100644 --- a/src/SFML/Graphics/Shape.cpp +++ b/src/SFML/Graphics/Shape.cpp @@ -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; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/Sprite.cpp b/src/SFML/Graphics/Sprite.cpp index 8b75050a3..c5102037e 100644 --- a/src/SFML/Graphics/Sprite.cpp +++ b/src/SFML/Graphics/Sprite.cpp @@ -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); diff --git a/src/SFML/Graphics/Text.cpp b/src/SFML/Graphics/Text.cpp index 174fbd24f..c80cce79b 100644 --- a/src/SFML/Graphics/Text.cpp +++ b/src/SFML/Graphics/Text.cpp @@ -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) { } diff --git a/src/SFML/Graphics/Texture.cpp b/src/SFML/Graphics/Texture.cpp index b6ef4a846..9ff3fcd0c 100644 --- a/src/SFML/Graphics/Texture.cpp +++ b/src/SFML/Graphics/Texture.cpp @@ -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) diff --git a/src/SFML/Graphics/Transformable.cpp b/src/SFML/Graphics/Transformable.cpp index cb19421f5..507cad4f4 100644 --- a/src/SFML/Graphics/Transformable.cpp +++ b/src/SFML/Graphics/Transformable.cpp @@ -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; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/VertexArray.cpp b/src/SFML/Graphics/VertexArray.cpp index a572be2da..26f99076f 100644 --- a/src/SFML/Graphics/VertexArray.cpp +++ b/src/SFML/Graphics/VertexArray.cpp @@ -32,9 +32,7 @@ namespace sf { //////////////////////////////////////////////////////////// -VertexArray::VertexArray() : m_vertices(), m_primitiveType(PrimitiveType::Points) -{ -} +VertexArray::VertexArray() = default; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/VertexBuffer.cpp b/src/SFML/Graphics/VertexBuffer.cpp index 245131c5f..5abca70e2 100644 --- a/src/SFML/Graphics/VertexBuffer.cpp +++ b/src/SFML/Graphics/VertexBuffer.cpp @@ -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) { diff --git a/src/SFML/Graphics/View.cpp b/src/SFML/Graphics/View.cpp index a6f812af8..4b4a518c4 100644 --- a/src/SFML/Graphics/View.cpp +++ b/src/SFML/Graphics/View.cpp @@ -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) { }