diff --git a/include/SFML/Graphics/Color.hpp b/include/SFML/Graphics/Color.hpp index cfb0990ba..5f00f4a10 100644 --- a/include/SFML/Graphics/Color.hpp +++ b/include/SFML/Graphics/Color.hpp @@ -95,9 +95,9 @@ public: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - std::uint8_t r{0}; //!< Red component - std::uint8_t g{0}; //!< Green component - std::uint8_t b{0}; //!< Blue component + std::uint8_t r{}; //!< Red component + std::uint8_t g{}; //!< Green component + std::uint8_t b{}; //!< Blue component std::uint8_t a{255}; //!< Alpha (opacity) component }; diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp index 024d892cc..ebbd08acd 100644 --- a/include/SFML/Graphics/Font.hpp +++ b/include/SFML/Graphics/Font.hpp @@ -339,9 +339,9 @@ private: { } - 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 + 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 }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/Glsl.inl b/include/SFML/Graphics/Glsl.inl index ab0fd3d7e..82ca294eb 100644 --- a/include/SFML/Graphics/Glsl.inl +++ b/include/SFML/Graphics/Glsl.inl @@ -144,8 +144,8 @@ struct Vector4 copyVector(color, *this); } - 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 + 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 }; diff --git a/include/SFML/Graphics/Glyph.hpp b/include/SFML/Graphics/Glyph.hpp index 5ae63baf5..95b537cf3 100644 --- a/include/SFML/Graphics/Glyph.hpp +++ b/include/SFML/Graphics/Glyph.hpp @@ -44,9 +44,9 @@ public: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - 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() + 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() 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 8bd9906fb..cba31d023 100644 --- a/include/SFML/Graphics/Rect.hpp +++ b/include/SFML/Graphics/Rect.hpp @@ -127,10 +127,10 @@ public: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - 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 + 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 }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/RenderStates.hpp b/include/SFML/Graphics/RenderStates.hpp index dbcb2e39b..4f6c3b041 100644 --- a/include/SFML/Graphics/RenderStates.hpp +++ b/include/SFML/Graphics/RenderStates.hpp @@ -113,8 +113,8 @@ public: //////////////////////////////////////////////////////////// BlendMode blendMode{BlendAlpha}; //!< Blending mode Transform transform; //!< Transform - const Texture* texture{nullptr}; //!< Texture - const Shader* shader{nullptr}; //!< Shader + const Texture* texture{}; //!< Texture + const Shader* shader{}; //!< Shader }; } // namespace sf diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp index 7e5532f34..046e8733d 100644 --- a/include/SFML/Graphics/RenderTarget.hpp +++ b/include/SFML/Graphics/RenderTarget.hpp @@ -485,7 +485,7 @@ private: }; bool enable; //!< Is the cache enabled? - bool glStatesSet{false}; //!< Are our internal GL states set yet? + bool glStatesSet{}; //!< 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 @@ -500,7 +500,7 @@ private: View m_defaultView; //!< Default view View m_view; //!< Current view StatesCache m_cache; //!< Render states cache - std::uint64_t m_id{0}; //!< Unique number that identifies the RenderTarget + std::uint64_t m_id{}; //!< Unique number that identifies the RenderTarget }; } // namespace sf diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp index be8fbeb6f..2076bcf45 100644 --- a/include/SFML/Graphics/RenderWindow.hpp +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -165,7 +165,7 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - unsigned int m_defaultFrameBuffer{0}; //!< Framebuffer to bind when targeting this window + unsigned int m_defaultFrameBuffer{}; //!< Framebuffer to bind when targeting this window }; } // namespace sf diff --git a/include/SFML/Graphics/Shader.hpp b/include/SFML/Graphics/Shader.hpp index 86ad3d7f2..9a944ffb3 100644 --- a/include/SFML/Graphics/Shader.hpp +++ b/include/SFML/Graphics/Shader.hpp @@ -698,7 +698,7 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - unsigned int m_shaderProgram{0}; //!< OpenGL identifier for the program + unsigned int m_shaderProgram{}; //!< 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 diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp index ea021e01f..93e17468c 100644 --- a/include/SFML/Graphics/Shape.hpp +++ b/include/SFML/Graphics/Shape.hpp @@ -303,11 +303,11 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - const Texture* m_texture{nullptr}; //!< Texture of the shape + const Texture* m_texture{}; //!< 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 + float m_outlineThickness{}; //!< 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) diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp index d8fb96a79..7f5f7c29e 100644 --- a/include/SFML/Graphics/Sprite.hpp +++ b/include/SFML/Graphics/Sprite.hpp @@ -213,9 +213,9 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - 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 + 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 }; } // namespace sf diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp index b8eccf0df..c1b4dba55 100644 --- a/include/SFML/Graphics/Text.hpp +++ b/include/SFML/Graphics/Text.hpp @@ -428,7 +428,7 @@ private: // Member data //////////////////////////////////////////////////////////// String m_string; //!< String to display - const Font* m_font{nullptr}; //!< Font used to display the string + const Font* m_font{}; //!< 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 @@ -438,9 +438,9 @@ private: 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 + 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 }; } // namespace sf diff --git a/include/SFML/Graphics/Texture.hpp b/include/SFML/Graphics/Texture.hpp index b6b20f543..4f134a80a 100644 --- a/include/SFML/Graphics/Texture.hpp +++ b/include/SFML/Graphics/Texture.hpp @@ -610,16 +610,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{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 + 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 }; } // namespace sf diff --git a/include/SFML/Graphics/VertexBuffer.hpp b/include/SFML/Graphics/VertexBuffer.hpp index d2e4712b9..d9cb632bd 100644 --- a/include/SFML/Graphics/VertexBuffer.hpp +++ b/include/SFML/Graphics/VertexBuffer.hpp @@ -333,8 +333,8 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - unsigned int m_buffer{0}; //!< Internal buffer identifier - std::size_t m_size{0}; //!< Size in Vertexes of the currently allocated buffer + unsigned int m_buffer{}; //!< Internal buffer identifier + std::size_t m_size{}; //!< 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 }; diff --git a/include/SFML/Graphics/View.hpp b/include/SFML/Graphics/View.hpp index 242dbf6b5..f838ec75a 100644 --- a/include/SFML/Graphics/View.hpp +++ b/include/SFML/Graphics/View.hpp @@ -235,14 +235,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{{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 + 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{}; //!< 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 }; } // namespace sf diff --git a/include/SFML/Network/Http.hpp b/include/SFML/Network/Http.hpp index 92426c780..493cccded 100644 --- a/include/SFML/Network/Http.hpp +++ b/include/SFML/Network/Http.hpp @@ -328,8 +328,8 @@ public: //////////////////////////////////////////////////////////// FieldTable m_fields; //!< Fields of the header Status m_status{Status::ConnectionFailed}; //!< Status code - unsigned int m_majorVersion{0}; //!< Major HTTP version - unsigned int m_minorVersion{0}; //!< Minor HTTP version + unsigned int m_majorVersion{}; //!< Major HTTP version + unsigned int m_minorVersion{}; //!< Minor HTTP version std::string m_body; //!< Body of the response }; @@ -411,7 +411,7 @@ private: TcpSocket m_connection; //!< Connection to the host std::optional m_host; //!< Web host address std::string m_hostName; //!< Web host name - unsigned short m_port{0}; //!< Port used for connection with host + unsigned short m_port{}; //!< Port used for connection with host }; } // namespace sf diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp index 4d660858c..a542e3b4a 100644 --- a/include/SFML/Network/Packet.hpp +++ b/include/SFML/Network/Packet.hpp @@ -432,8 +432,8 @@ private: // Member data //////////////////////////////////////////////////////////// std::vector m_data; //!< Data stored in the packet - std::size_t m_readPos{0}; //!< Current reading position in the packet - std::size_t m_sendPos{0}; //!< Current send position in the packet (for handling partial sends) + std::size_t m_readPos{}; //!< Current reading position in the packet + std::size_t m_sendPos{}; //!< Current send position in the packet (for handling partial sends) bool m_isValid{true}; //!< Reading state of the packet }; diff --git a/include/SFML/Network/TcpSocket.hpp b/include/SFML/Network/TcpSocket.hpp index 2d3050909..9631b6b0b 100644 --- a/include/SFML/Network/TcpSocket.hpp +++ b/include/SFML/Network/TcpSocket.hpp @@ -218,9 +218,9 @@ private: //////////////////////////////////////////////////////////// struct PendingPacket { - std::uint32_t Size{0}; //!< Data of packet size - std::size_t SizeReceived{0}; //!< Number of size bytes received so far - std::vector Data; //!< Data of the packet + std::uint32_t Size{}; //!< Data of packet size + std::size_t SizeReceived{}; //!< Number of size bytes received so far + std::vector Data; //!< Data of the packet }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/System/Angle.hpp b/include/SFML/System/Angle.hpp index fd92f4e8c..adc3250cb 100644 --- a/include/SFML/System/Angle.hpp +++ b/include/SFML/System/Angle.hpp @@ -160,7 +160,7 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - float m_degrees{0}; //!< Angle value stored as degrees + float m_degrees{}; //!< Angle value stored as degrees }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/System/MemoryInputStream.hpp b/include/SFML/System/MemoryInputStream.hpp index fcf79b5cb..80d3d5cdd 100644 --- a/include/SFML/System/MemoryInputStream.hpp +++ b/include/SFML/System/MemoryInputStream.hpp @@ -104,9 +104,9 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - const char* m_data{nullptr}; //!< Pointer to the data in memory - std::int64_t m_size{0}; //!< Total size of the data - std::int64_t m_offset{0}; //!< Current reading position + const char* m_data{}; //!< Pointer to the data in memory + std::int64_t m_size{}; //!< Total size of the data + std::int64_t m_offset{}; //!< Current reading position }; } // namespace sf diff --git a/include/SFML/System/Time.hpp b/include/SFML/System/Time.hpp index da902e13d..67411a247 100644 --- a/include/SFML/System/Time.hpp +++ b/include/SFML/System/Time.hpp @@ -119,7 +119,7 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - std::chrono::microseconds m_microseconds{0}; //!< Time value stored as microseconds + std::chrono::microseconds m_microseconds{}; //!< Time value stored as microseconds }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/System/Vector2.hpp b/include/SFML/System/Vector2.hpp index 8995ad1ab..713b7be31 100644 --- a/include/SFML/System/Vector2.hpp +++ b/include/SFML/System/Vector2.hpp @@ -209,8 +209,8 @@ public: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - T x{0}; //!< X coordinate of the vector - T y{0}; //!< Y coordinate of the vector + T x{}; //!< X coordinate of the vector + T y{}; //!< Y coordinate of the vector //////////////////////////////////////////////////////////// diff --git a/include/SFML/System/Vector3.hpp b/include/SFML/System/Vector3.hpp index 2d293ab11..be79aa686 100644 --- a/include/SFML/System/Vector3.hpp +++ b/include/SFML/System/Vector3.hpp @@ -133,9 +133,9 @@ public: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - T x{0}; //!< X coordinate of the vector - T y{0}; //!< Y coordinate of the vector - T z{0}; //!< Z coordinate of the vector + T x{}; //!< X coordinate of the vector + T y{}; //!< Y coordinate of the vector + T z{}; //!< Z coordinate of the vector }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Window/Joystick.hpp b/include/SFML/Window/Joystick.hpp index f2c22ad8d..4f409aeae 100644 --- a/include/SFML/Window/Joystick.hpp +++ b/include/SFML/Window/Joystick.hpp @@ -71,8 +71,8 @@ enum Axis struct SFML_WINDOW_API Identification { String name{"No Joystick"}; //!< Name of the joystick - unsigned int vendorId{0}; //!< Manufacturer identifier - unsigned int productId{0}; //!< Product identifier + unsigned int vendorId{}; //!< Manufacturer identifier + unsigned int productId{}; //!< Product identifier }; //////////////////////////////////////////////////////////// diff --git a/include/SFML/Window/VideoMode.hpp b/include/SFML/Window/VideoMode.hpp index 8b0a71809..9e6f1f1ba 100644 --- a/include/SFML/Window/VideoMode.hpp +++ b/include/SFML/Window/VideoMode.hpp @@ -99,8 +99,8 @@ public: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - Vector2u size; //!< Video mode width and height, in pixels - unsigned int bitsPerPixel{0}; //!< Video mode pixel depth, in bits per pixels + Vector2u size; //!< Video mode width and height, in pixels + unsigned int bitsPerPixel{}; //!< Video mode pixel depth, in bits per pixels }; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/RenderTextureImplFBO.hpp b/src/SFML/Graphics/RenderTextureImplFBO.hpp index 73e7f1eba..5eae61da7 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.hpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.hpp @@ -138,14 +138,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{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{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 + 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 + 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 }; } // namespace priv diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index bfd54ae80..77dc8452f 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -224,10 +224,10 @@ struct Shader::UniformBinder //////////////////////////////////////////////////////////// UniformBinder& operator=(const UniformBinder&) = delete; - 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 + 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{-1}; //!< Uniform location, used by the surrounding sf::Shader code }; diff --git a/src/SFML/Window/Android/WindowImplAndroid.hpp b/src/SFML/Window/Android/WindowImplAndroid.hpp index 6b085e44e..1c3506db2 100644 --- a/src/SFML/Window/Android/WindowImplAndroid.hpp +++ b/src/SFML/Window/Android/WindowImplAndroid.hpp @@ -232,9 +232,9 @@ private: static int getUnicode(AInputEvent* event); Vector2u m_size; - bool m_windowBeingCreated{false}; - bool m_windowBeingDestroyed{false}; - bool m_hasFocus{false}; + bool m_windowBeingCreated{}; + bool m_windowBeingDestroyed{}; + bool m_hasFocus{}; }; } // namespace priv diff --git a/src/SFML/Window/DRM/DRMContext.cpp b/src/SFML/Window/DRM/DRMContext.cpp index a9d9d3a28..ac85ad8ad 100644 --- a/src/SFML/Window/DRM/DRMContext.cpp +++ b/src/SFML/Window/DRM/DRMContext.cpp @@ -272,7 +272,7 @@ int findDrmDevice(drmModeResPtr& resources) { static const int maxDrmDevices = 64; - drmDevicePtr devices[maxDrmDevices] = {nullptr}; + drmDevicePtr devices[maxDrmDevices] = {}; const int numDevices = drmGetDevices2(0, devices, maxDrmDevices); if (numDevices < 0) diff --git a/src/SFML/Window/DRM/DRMContext.hpp b/src/SFML/Window/DRM/DRMContext.hpp index 9e2038321..37e5dfda1 100644 --- a/src/SFML/Window/DRM/DRMContext.hpp +++ b/src/SFML/Window/DRM/DRMContext.hpp @@ -201,14 +201,14 @@ private: EGLDisplay m_display{EGL_NO_DISPLAY}; ///< The internal EGL display EGLContext m_context{EGL_NO_CONTEXT}; ///< The internal EGL context EGLSurface m_surface{EGL_NO_SURFACE}; ///< The internal EGL surface - EGLConfig m_config{nullptr}; ///< The internal EGL config + EGLConfig m_config{}; ///< The internal EGL config - gbm_bo* m_currentBO{nullptr}; - gbm_bo* m_nextBO{nullptr}; - gbm_surface* m_gbmSurface{nullptr}; + gbm_bo* m_currentBO{}; + gbm_bo* m_nextBO{}; + gbm_surface* m_gbmSurface{}; Vector2u m_size; - bool m_shown{false}; - bool m_scanOut{false}; + bool m_shown{}; + bool m_scanOut{}; }; } // namespace priv diff --git a/src/SFML/Window/EglContext.hpp b/src/SFML/Window/EglContext.hpp index c07aa993e..6a4e27977 100644 --- a/src/SFML/Window/EglContext.hpp +++ b/src/SFML/Window/EglContext.hpp @@ -190,7 +190,7 @@ private: EGLDisplay m_display{EGL_NO_DISPLAY}; //!< The internal EGL display EGLContext m_context{EGL_NO_CONTEXT}; //!< The internal EGL context EGLSurface m_surface{EGL_NO_SURFACE}; //!< The internal EGL surface - EGLConfig m_config{nullptr}; //!< The internal EGL config + EGLConfig m_config{}; //!< The internal EGL config }; } // namespace priv diff --git a/src/SFML/Window/JoystickImpl.hpp b/src/SFML/Window/JoystickImpl.hpp index 81a4b4212..743fa14c8 100644 --- a/src/SFML/Window/JoystickImpl.hpp +++ b/src/SFML/Window/JoystickImpl.hpp @@ -42,7 +42,7 @@ namespace priv //////////////////////////////////////////////////////////// struct JoystickCaps { - unsigned int buttonCount{0}; //!< Number of buttons supported by the joystick + unsigned int buttonCount{}; //!< Number of buttons supported by the joystick bool axes[Joystick::AxisCount]{}; //!< Support for each axis }; @@ -53,7 +53,7 @@ struct JoystickCaps //////////////////////////////////////////////////////////// struct JoystickState { - bool connected{false}; //!< Is the joystick currently connected? + bool connected{}; //!< Is the joystick currently connected? float axes[Joystick::AxisCount]{}; //!< Position of each axis, in range [-100, 100] bool buttons[Joystick::ButtonCount]{}; //!< Status of each button (true = pressed) }; diff --git a/src/SFML/Window/OSX/HIDInputManager.hpp b/src/SFML/Window/OSX/HIDInputManager.hpp index ad104c515..d4697fa09 100644 --- a/src/SFML/Window/OSX/HIDInputManager.hpp +++ b/src/SFML/Window/OSX/HIDInputManager.hpp @@ -219,10 +219,10 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - bool m_isValid{true}; ///< If any error occurs this variable is false - CFDataRef m_layoutData{0}; ///< CFData containing the layout - UCKeyboardLayout* m_layout{nullptr}; ///< Current Keyboard Layout - IOHIDManagerRef m_manager{0}; ///< HID Manager + bool m_isValid{true}; ///< If any error occurs this variable is false + CFDataRef m_layoutData{}; ///< CFData containing the layout + UCKeyboardLayout* m_layout{}; ///< Current Keyboard Layout + IOHIDManagerRef m_manager{}; ///< HID Manager IOHIDElements m_keys[Keyboard::KeyCount]; ///< All the keys on any connected keyboard diff --git a/src/SFML/Window/OSX/HIDJoystickManager.hpp b/src/SFML/Window/OSX/HIDJoystickManager.hpp index 99e91ce60..d9cf7af59 100644 --- a/src/SFML/Window/OSX/HIDJoystickManager.hpp +++ b/src/SFML/Window/OSX/HIDJoystickManager.hpp @@ -122,8 +122,8 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - IOHIDManagerRef m_manager{0}; ///< HID Manager - unsigned int m_joystickCount{0}; ///< Number of joysticks currently connected + IOHIDManagerRef m_manager{}; ///< HID Manager + unsigned int m_joystickCount{}; ///< Number of joysticks currently connected }; diff --git a/src/SFML/Window/OSX/SFContext.hpp b/src/SFML/Window/OSX/SFContext.hpp index 0c9cd1ce8..627f83017 100644 --- a/src/SFML/Window/OSX/SFContext.hpp +++ b/src/SFML/Window/OSX/SFContext.hpp @@ -155,9 +155,9 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - NSOpenGLContextRef m_context{0}; ///< OpenGL context. - NSOpenGLViewRef m_view{0}; ///< Only for offscreen context. - NSWindowRef m_window{0}; ///< Only for offscreen context. + NSOpenGLContextRef m_context{}; ///< OpenGL context. + NSOpenGLViewRef m_view{}; ///< Only for offscreen context. + NSWindowRef m_window{}; ///< Only for offscreen context. }; } // namespace priv diff --git a/src/SFML/Window/Unix/ClipboardImpl.hpp b/src/SFML/Window/Unix/ClipboardImpl.hpp index f2ed775e4..c3945f069 100644 --- a/src/SFML/Window/Unix/ClipboardImpl.hpp +++ b/src/SFML/Window/Unix/ClipboardImpl.hpp @@ -135,16 +135,16 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - ::Window m_window{0}; ///< X identifier defining our window - ::Display* m_display; ///< Pointer to the display - Atom m_clipboard; ///< X Atom identifying the CLIPBOARD selection - Atom m_targets; ///< X Atom identifying TARGETS - Atom m_text; ///< X Atom identifying TEXT - Atom m_utf8String; ///< X Atom identifying UTF8_STRING - Atom m_targetProperty; ///< X Atom identifying our destination window property - String m_clipboardContents; ///< Our clipboard contents - std::deque m_events; ///< Queue we use to store pending events for this window - bool m_requestResponded{false}; ///< Holds whether our selection request has been responded to or not + ::Window m_window{}; ///< X identifier defining our window + ::Display* m_display; ///< Pointer to the display + Atom m_clipboard; ///< X Atom identifying the CLIPBOARD selection + Atom m_targets; ///< X Atom identifying TARGETS + Atom m_text; ///< X Atom identifying TEXT + Atom m_utf8String; ///< X Atom identifying UTF8_STRING + Atom m_targetProperty; ///< X Atom identifying our destination window property + String m_clipboardContents; ///< Our clipboard contents + std::deque m_events; ///< Queue we use to store pending events for this window + bool m_requestResponded{}; ///< Holds whether our selection request has been responded to or not }; } // namespace priv diff --git a/src/SFML/Window/Unix/GlxContext.hpp b/src/SFML/Window/Unix/GlxContext.hpp index 14b291b9c..1f545f9ba 100644 --- a/src/SFML/Window/Unix/GlxContext.hpp +++ b/src/SFML/Window/Unix/GlxContext.hpp @@ -175,11 +175,11 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - ::Display* m_display{nullptr}; ///< Connection to the X server - ::Window m_window{0}; ///< Window to which the context is attached - GLXContext m_context{nullptr}; ///< OpenGL context - GLXPbuffer m_pbuffer{0}; ///< GLX pbuffer ID if one was created - bool m_ownsWindow{false}; ///< Do we own the window associated to the context? + ::Display* m_display{}; ///< Connection to the X server + ::Window m_window{}; ///< Window to which the context is attached + GLXContext m_context{}; ///< OpenGL context + GLXPbuffer m_pbuffer{}; ///< GLX pbuffer ID if one was created + bool m_ownsWindow{}; ///< Do we own the window associated to the context? }; } // namespace priv diff --git a/src/SFML/Window/Unix/VulkanImplX11.cpp b/src/SFML/Window/Unix/VulkanImplX11.cpp index d0e9a91b0..81520b197 100644 --- a/src/SFML/Window/Unix/VulkanImplX11.cpp +++ b/src/SFML/Window/Unix/VulkanImplX11.cpp @@ -90,11 +90,11 @@ struct VulkanLibraryWrapper return (entryPoint != nullptr); } - void* library{nullptr}; + void* library{}; - PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{nullptr}; - PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties{nullptr}; - PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties{nullptr}; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{}; + PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties{}; + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties{}; }; VulkanLibraryWrapper wrapper; diff --git a/src/SFML/Window/Unix/WindowImplX11.hpp b/src/SFML/Window/Unix/WindowImplX11.hpp index 8a6e9db16..bd2e6534a 100644 --- a/src/SFML/Window/Unix/WindowImplX11.hpp +++ b/src/SFML/Window/Unix/WindowImplX11.hpp @@ -296,25 +296,25 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - ::Window m_window{0}; ///< X identifier defining our window - ::Display* m_display; ///< Pointer to the display - int m_screen; ///< Screen identifier - XIM m_inputMethod{nullptr}; ///< Input method linked to the X display - XIC m_inputContext{nullptr}; ///< Input context used to get unicode input in our window - bool m_isExternal; ///< Tell whether the window has been created externally or by SFML - RRMode m_oldVideoMode{0}; ///< Video mode in use before we switch to fullscreen - RRCrtc m_oldRRCrtc{0}; ///< RRCrtc in use before we switch to fullscreen - ::Cursor m_hiddenCursor{0}; ///< As X11 doesn't provide cursor hiding, we must create a transparent one + ::Window m_window{}; ///< X identifier defining our window + ::Display* m_display; ///< Pointer to the display + int m_screen; ///< Screen identifier + XIM m_inputMethod{}; ///< Input method linked to the X display + XIC m_inputContext{}; ///< Input context used to get unicode input in our window + bool m_isExternal; ///< Tell whether the window has been created externally or by SFML + RRMode m_oldVideoMode{}; ///< Video mode in use before we switch to fullscreen + RRCrtc m_oldRRCrtc{}; ///< RRCrtc in use before we switch to fullscreen + ::Cursor m_hiddenCursor{}; ///< As X11 doesn't provide cursor hiding, we must create a transparent one ::Cursor m_lastCursor{None}; ///< Last cursor used -- this data is not owned by the window and is required to be always valid bool m_keyRepeat{true}; ///< Is the KeyRepeat feature enabled? Vector2i m_previousSize{-1, -1}; ///< Previous size of the window, to find if a ConfigureNotify event is a resize event (could be a move event only) - bool m_useSizeHints{false}; ///< Is the size of the window fixed with size hints? - bool m_fullscreen{false}; ///< Is the window in fullscreen? - bool m_cursorGrabbed{false}; ///< Is the mouse cursor trapped? - bool m_windowMapped{false}; ///< Has the window been mapped by the window manager? - Pixmap m_iconPixmap{0}; ///< The current icon pixmap if in use - Pixmap m_iconMaskPixmap{0}; ///< The current icon mask pixmap if in use - ::Time m_lastInputTime{0}; ///< Last time we received user input + bool m_useSizeHints{}; ///< Is the size of the window fixed with size hints? + bool m_fullscreen{}; ///< Is the window in fullscreen? + bool m_cursorGrabbed{}; ///< Is the mouse cursor trapped? + bool m_windowMapped{}; ///< Has the window been mapped by the window manager? + Pixmap m_iconPixmap{}; ///< The current icon pixmap if in use + Pixmap m_iconMaskPixmap{}; ///< The current icon mask pixmap if in use + ::Time m_lastInputTime{}; ///< Last time we received user input }; } // namespace priv diff --git a/src/SFML/Window/Win32/CursorImpl.hpp b/src/SFML/Window/Win32/CursorImpl.hpp index 07ff24ecc..57ace64c4 100644 --- a/src/SFML/Window/Win32/CursorImpl.hpp +++ b/src/SFML/Window/Win32/CursorImpl.hpp @@ -98,8 +98,8 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - void* m_cursor{nullptr}; // Type erasure via `void*` is used here to avoid depending on `windows.h` - bool m_systemCursor{false}; + void* m_cursor{}; // Type erasure via `void*` is used here to avoid depending on `windows.h` + bool m_systemCursor{}; }; } // namespace priv diff --git a/src/SFML/Window/Win32/JoystickImpl.cpp b/src/SFML/Window/Win32/JoystickImpl.cpp index 1890299b2..6af4d1170 100644 --- a/src/SFML/Window/Win32/JoystickImpl.cpp +++ b/src/SFML/Window/Win32/JoystickImpl.cpp @@ -103,7 +103,7 @@ namespace { struct ConnectionCache { - bool connected{false}; + bool connected{}; sf::Clock timer; }; const sf::Time connectionRefreshDelay = sf::milliseconds(500); diff --git a/src/SFML/Window/Win32/VulkanImplWin32.cpp b/src/SFML/Window/Win32/VulkanImplWin32.cpp index cd5ac5694..023d1e855 100644 --- a/src/SFML/Window/Win32/VulkanImplWin32.cpp +++ b/src/SFML/Window/Win32/VulkanImplWin32.cpp @@ -89,11 +89,11 @@ struct VulkanLibraryWrapper return (entryPoint != nullptr); } - HMODULE library{nullptr}; + HMODULE library{}; - PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{nullptr}; - PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties{nullptr}; - PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties{nullptr}; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{}; + PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties{}; + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties{}; }; VulkanLibraryWrapper wrapper; diff --git a/src/SFML/Window/Win32/WglContext.hpp b/src/SFML/Window/Win32/WglContext.hpp index 84dbc4929..db3de98c8 100644 --- a/src/SFML/Window/Win32/WglContext.hpp +++ b/src/SFML/Window/Win32/WglContext.hpp @@ -178,11 +178,11 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - HWND m_window{nullptr}; //!< Window to which the context is attached - HPBUFFERARB m_pbuffer{nullptr}; //!< Handle to a pbuffer if one was created - HDC m_deviceContext{nullptr}; //!< Device context associated to the context - HGLRC m_context{nullptr}; //!< OpenGL context - bool m_ownsWindow{false}; //!< Do we own the target window? + HWND m_window{}; //!< Window to which the context is attached + HPBUFFERARB m_pbuffer{}; //!< Handle to a pbuffer if one was created + HDC m_deviceContext{}; //!< Device context associated to the context + HGLRC m_context{}; //!< OpenGL context + bool m_ownsWindow{}; //!< Do we own the target window? }; } // namespace priv diff --git a/src/SFML/Window/Win32/WindowImplWin32.hpp b/src/SFML/Window/Win32/WindowImplWin32.hpp index 805cb0afc..adec93faf 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.hpp +++ b/src/SFML/Window/Win32/WindowImplWin32.hpp @@ -268,19 +268,19 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - HWND m_handle{nullptr}; //!< Win32 handle of the window - LONG_PTR m_callback{0}; //!< Stores the original event callback function of the control + HWND m_handle{}; //!< Win32 handle of the window + LONG_PTR m_callback{}; //!< Stores the original event callback function of the control bool m_cursorVisible{true}; //!< Is the cursor visible or hidden? HCURSOR m_lastCursor{ LoadCursor(nullptr, IDC_ARROW)}; //!< Last cursor used -- this data is not owned by the window and is required to be always valid - HICON m_icon{nullptr}; //!< Custom icon assigned to the window + HICON m_icon{}; //!< Custom icon assigned to the window bool m_keyRepeatEnabled{true}; //!< Automatic key-repeat state for keydown events Vector2u m_lastSize; //!< The last handled size of the window - bool m_resizing{false}; //!< Is the window being resized? - std::uint16_t m_surrogate{0}; //!< First half of the surrogate pair, in case we're receiving a Unicode character in two events - bool m_mouseInside{false}; //!< Mouse is inside the window? - bool m_fullscreen{false}; //!< Is the window fullscreen? - bool m_cursorGrabbed{false}; //!< Is the mouse cursor trapped? + bool m_resizing{}; //!< Is the window being resized? + std::uint16_t m_surrogate{}; //!< First half of the surrogate pair, in case we're receiving a Unicode character in two events + bool m_mouseInside{}; //!< Mouse is inside the window? + bool m_fullscreen{}; //!< Is the window fullscreen? + bool m_cursorGrabbed{}; //!< Is the mouse cursor trapped? }; } // namespace priv diff --git a/src/SFML/Window/iOS/EaglContext.hpp b/src/SFML/Window/iOS/EaglContext.hpp index 879bfb4f2..3c90f6290 100644 --- a/src/SFML/Window/iOS/EaglContext.hpp +++ b/src/SFML/Window/iOS/EaglContext.hpp @@ -158,12 +158,12 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - EAGLContext* m_context; ///< The internal context - GLuint m_framebuffer{0}; ///< Frame buffer associated to the context - GLuint m_colorbuffer{0}; ///< Color render buffer - GLuint m_depthbuffer{0}; ///< Depth render buffer - bool m_vsyncEnabled{false}; ///< Vertical sync activation flag - Clock m_clock; ///< Measures the elapsed time for the fake v-sync implementation + EAGLContext* m_context; ///< The internal context + GLuint m_framebuffer{}; ///< Frame buffer associated to the context + GLuint m_colorbuffer{}; ///< Color render buffer + GLuint m_depthbuffer{}; ///< Depth render buffer + bool m_vsyncEnabled{}; ///< Vertical sync activation flag + Clock m_clock; ///< Measures the elapsed time for the fake v-sync implementation }; } // namespace priv