Use more in-class member initializers

This commit is contained in:
Chris Thrasher 2023-10-23 14:17:38 -05:00
parent 3d4ea00135
commit f5497b2db6
3 changed files with 5 additions and 6 deletions

View File

@ -39,7 +39,7 @@
// Our PIMPL // Our PIMPL
struct SFMLmainWindow struct SFMLmainWindow
{ {
SFMLmainWindow(sf::WindowHandle win) : renderWindow(win), text(font), sprite(logo), background(sf::Color::Blue) SFMLmainWindow(sf::WindowHandle win) : renderWindow(win)
{ {
std::filesystem::path resPath = [[[NSBundle mainBundle] resourcePath] tostdstring]; std::filesystem::path resPath = [[[NSBundle mainBundle] resourcePath] tostdstring];
if (!logo.loadFromFile(resPath / "logo.png")) if (!logo.loadFromFile(resPath / "logo.png"))
@ -59,10 +59,10 @@ struct SFMLmainWindow
sf::RenderWindow renderWindow; sf::RenderWindow renderWindow;
sf::Font font; sf::Font font;
sf::Text text; sf::Text text{font};
sf::Texture logo; sf::Texture logo;
sf::Sprite sprite; sf::Sprite sprite{logo};
sf::Color background; sf::Color background{sf::Color::Blue};
}; };
// Private stuff // Private stuff

View File

@ -466,7 +466,6 @@ WindowImplX11::WindowImplX11(WindowHandle handle) : m_isExternal(true)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowImplX11::WindowImplX11(VideoMode mode, const String& title, unsigned long style, const ContextSettings& settings) : WindowImplX11::WindowImplX11(VideoMode mode, const String& title, unsigned long style, const ContextSettings& settings) :
m_isExternal(false),
m_fullscreen((style & Style::Fullscreen) != 0), m_fullscreen((style & Style::Fullscreen) != 0),
m_cursorGrabbed(m_fullscreen) m_cursorGrabbed(m_fullscreen)
{ {

View File

@ -325,7 +325,7 @@ private:
int m_screen; ///< Screen identifier int m_screen; ///< Screen identifier
XIM m_inputMethod{}; ///< Input method linked to the X display XIM m_inputMethod{}; ///< Input method linked to the X display
XIC m_inputContext{}; ///< Input context used to get unicode input in our window 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 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 RRMode m_oldVideoMode{}; ///< Video mode in use before we switch to fullscreen
RRCrtc m_oldRRCrtc{}; ///< RRCrtc 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_hiddenCursor{}; ///< As X11 doesn't provide cursor hiding, we must create a transparent one