mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 12:51:05 +08:00
Use in-class member initializers
This commit is contained in:
parent
e8fa5d7d31
commit
c0acaef204
@ -75,11 +75,9 @@ public:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct SFML_WINDOW_API Identification
|
struct SFML_WINDOW_API Identification
|
||||||
{
|
{
|
||||||
Identification();
|
String name{"No Joystick"}; //!< Name of the joystick
|
||||||
|
unsigned int vendorId{0}; //!< Manufacturer identifier
|
||||||
String name; //!< Name of the joystick
|
unsigned int productId{0}; //!< Product identifier
|
||||||
unsigned int vendorId; //!< Manufacturer identifier
|
|
||||||
unsigned int productId; //!< Product identifier
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -101,7 +101,7 @@ public:
|
|||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Vector2u size; //!< Video mode width and height, in pixels
|
Vector2u size; //!< Video mode width and height, in pixels
|
||||||
unsigned int bitsPerPixel; //!< Video mode pixel depth, in bits per pixels
|
unsigned int bitsPerPixel{0}; //!< Video mode pixel depth, in bits per pixels
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -31,14 +31,6 @@ namespace sf
|
|||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
CursorImpl::CursorImpl()
|
|
||||||
{
|
|
||||||
// Nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CursorImpl::loadFromPixels(const std::uint8_t* /* pixels */, Vector2u /* size */, Vector2u /* hotspot */)
|
bool CursorImpl::loadFromPixels(const std::uint8_t* /* pixels */, Vector2u /* size */, Vector2u /* hotspot */)
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
/// Refer to sf::Cursor::Cursor().
|
/// Refer to sf::Cursor::Cursor().
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CursorImpl();
|
CursorImpl() = default;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Deleted copy constructor
|
/// \brief Deleted copy constructor
|
||||||
|
@ -52,11 +52,7 @@ namespace priv
|
|||||||
WindowImplAndroid* WindowImplAndroid::singleInstance = nullptr;
|
WindowImplAndroid* WindowImplAndroid::singleInstance = nullptr;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplAndroid::WindowImplAndroid(WindowHandle /* handle */) :
|
WindowImplAndroid::WindowImplAndroid(WindowHandle /* handle */)
|
||||||
m_size(0, 0),
|
|
||||||
m_windowBeingCreated(false),
|
|
||||||
m_windowBeingDestroyed(false),
|
|
||||||
m_hasFocus(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,10 +62,7 @@ WindowImplAndroid::WindowImplAndroid(VideoMode mode,
|
|||||||
const String& /* title */,
|
const String& /* title */,
|
||||||
unsigned long style,
|
unsigned long style,
|
||||||
const ContextSettings& /* settings */) :
|
const ContextSettings& /* settings */) :
|
||||||
m_size(mode.size),
|
m_size(mode.size)
|
||||||
m_windowBeingCreated(false),
|
|
||||||
m_windowBeingDestroyed(false),
|
|
||||||
m_hasFocus(false)
|
|
||||||
{
|
{
|
||||||
ActivityStates& states = getActivity();
|
ActivityStates& states = getActivity();
|
||||||
std::scoped_lock lock(states.mutex);
|
std::scoped_lock lock(states.mutex);
|
||||||
|
@ -233,9 +233,9 @@ private:
|
|||||||
static int getUnicode(AInputEvent* event);
|
static int getUnicode(AInputEvent* event);
|
||||||
|
|
||||||
Vector2u m_size;
|
Vector2u m_size;
|
||||||
bool m_windowBeingCreated;
|
bool m_windowBeingCreated{false};
|
||||||
bool m_windowBeingDestroyed;
|
bool m_windowBeingDestroyed{false};
|
||||||
bool m_hasFocus;
|
bool m_hasFocus{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -34,12 +34,6 @@ namespace sf
|
|||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
CursorImpl::CursorImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CursorImpl::loadFromPixels(const std::uint8_t* /*pixels*/, Vector2u /*size*/, Vector2u /*hotspot*/)
|
bool CursorImpl::loadFromPixels(const std::uint8_t* /*pixels*/, Vector2u /*size*/, Vector2u /*hotspot*/)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
/// Refer to sf::Cursor::Cursor().
|
/// Refer to sf::Cursor::Cursor().
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CursorImpl();
|
CursorImpl() = default;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Deleted copy constructor
|
/// \brief Deleted copy constructor
|
||||||
|
@ -511,17 +511,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
DRMContext::DRMContext(DRMContext* shared) :
|
DRMContext::DRMContext(DRMContext* shared)
|
||||||
m_display(EGL_NO_DISPLAY),
|
|
||||||
m_context(EGL_NO_CONTEXT),
|
|
||||||
m_surface(EGL_NO_SURFACE),
|
|
||||||
m_config(nullptr),
|
|
||||||
m_currentBO(nullptr),
|
|
||||||
m_nextBO(nullptr),
|
|
||||||
m_gbmSurface(nullptr),
|
|
||||||
m_size(0, 0),
|
|
||||||
m_shown(false),
|
|
||||||
m_scanOut(false)
|
|
||||||
{
|
{
|
||||||
contextCount++;
|
contextCount++;
|
||||||
|
|
||||||
@ -543,17 +533,7 @@ m_scanOut(false)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
DRMContext::DRMContext(DRMContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel) :
|
DRMContext::DRMContext(DRMContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel)
|
||||||
m_display(EGL_NO_DISPLAY),
|
|
||||||
m_context(EGL_NO_CONTEXT),
|
|
||||||
m_surface(EGL_NO_SURFACE),
|
|
||||||
m_config(nullptr),
|
|
||||||
m_currentBO(nullptr),
|
|
||||||
m_nextBO(nullptr),
|
|
||||||
m_gbmSurface(nullptr),
|
|
||||||
m_size(0, 0),
|
|
||||||
m_shown(false),
|
|
||||||
m_scanOut(false)
|
|
||||||
{
|
{
|
||||||
contextCount++;
|
contextCount++;
|
||||||
|
|
||||||
@ -573,17 +553,7 @@ m_scanOut(false)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
DRMContext::DRMContext(DRMContext* shared, const ContextSettings& settings, const Vector2u& size) :
|
DRMContext::DRMContext(DRMContext* shared, const ContextSettings& settings, const Vector2u& size)
|
||||||
m_display(EGL_NO_DISPLAY),
|
|
||||||
m_context(EGL_NO_CONTEXT),
|
|
||||||
m_surface(EGL_NO_SURFACE),
|
|
||||||
m_config(nullptr),
|
|
||||||
m_currentBO(nullptr),
|
|
||||||
m_nextBO(nullptr),
|
|
||||||
m_gbmSurface(nullptr),
|
|
||||||
m_size(0, 0),
|
|
||||||
m_shown(false),
|
|
||||||
m_scanOut(false)
|
|
||||||
{
|
{
|
||||||
contextCount++;
|
contextCount++;
|
||||||
|
|
||||||
|
@ -199,17 +199,17 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EGLDisplay m_display; ///< The internal EGL display
|
EGLDisplay m_display{EGL_NO_DISPLAY}; ///< The internal EGL display
|
||||||
EGLContext m_context; ///< The internal EGL context
|
EGLContext m_context{EGL_NO_CONTEXT}; ///< The internal EGL context
|
||||||
EGLSurface m_surface; ///< The internal EGL surface
|
EGLSurface m_surface{EGL_NO_SURFACE}; ///< The internal EGL surface
|
||||||
EGLConfig m_config; ///< The internal EGL config
|
EGLConfig m_config{nullptr}; ///< The internal EGL config
|
||||||
|
|
||||||
gbm_bo* m_currentBO;
|
gbm_bo* m_currentBO{nullptr};
|
||||||
gbm_bo* m_nextBO;
|
gbm_bo* m_nextBO{nullptr};
|
||||||
gbm_surface* m_gbmSurface;
|
gbm_surface* m_gbmSurface{nullptr};
|
||||||
Vector2u m_size;
|
Vector2u m_size;
|
||||||
bool m_shown;
|
bool m_shown{false};
|
||||||
bool m_scanOut;
|
bool m_scanOut{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -47,13 +47,9 @@ namespace
|
|||||||
{
|
{
|
||||||
struct TouchSlot
|
struct TouchSlot
|
||||||
{
|
{
|
||||||
int oldId;
|
int oldId{-1};
|
||||||
int id;
|
int id{-1};
|
||||||
sf::Vector2i pos;
|
sf::Vector2i pos;
|
||||||
|
|
||||||
TouchSlot() : oldId(-1), id(-1), pos(0, 0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::recursive_mutex inputMutex; // threadsafe? maybe...
|
std::recursive_mutex inputMutex; // threadsafe? maybe...
|
||||||
|
@ -38,7 +38,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplDRM::WindowImplDRM(WindowHandle /*handle*/) : m_size(0, 0)
|
WindowImplDRM::WindowImplDRM(WindowHandle /*handle*/)
|
||||||
{
|
{
|
||||||
sf::priv::InputImpl::setTerminalConfig();
|
sf::priv::InputImpl::setTerminalConfig();
|
||||||
}
|
}
|
||||||
|
@ -102,11 +102,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EglContext::EglContext(EglContext* shared) :
|
EglContext::EglContext(EglContext* shared)
|
||||||
m_display(EGL_NO_DISPLAY),
|
|
||||||
m_context(EGL_NO_CONTEXT),
|
|
||||||
m_surface(EGL_NO_SURFACE),
|
|
||||||
m_config(nullptr)
|
|
||||||
{
|
{
|
||||||
EglContextImpl::ensureInit();
|
EglContextImpl::ensureInit();
|
||||||
|
|
||||||
@ -132,11 +128,7 @@ m_config(nullptr)
|
|||||||
EglContext::EglContext(EglContext* shared,
|
EglContext::EglContext(EglContext* shared,
|
||||||
const ContextSettings& settings,
|
const ContextSettings& settings,
|
||||||
[[maybe_unused]] const WindowImpl& owner,
|
[[maybe_unused]] const WindowImpl& owner,
|
||||||
unsigned int bitsPerPixel) :
|
unsigned int bitsPerPixel)
|
||||||
m_display(EGL_NO_DISPLAY),
|
|
||||||
m_context(EGL_NO_CONTEXT),
|
|
||||||
m_surface(EGL_NO_SURFACE),
|
|
||||||
m_config(nullptr)
|
|
||||||
{
|
{
|
||||||
EglContextImpl::ensureInit();
|
EglContextImpl::ensureInit();
|
||||||
|
|
||||||
@ -170,11 +162,7 @@ m_config(nullptr)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EglContext::EglContext(EglContext* /*shared*/, const ContextSettings& /*settings*/, const Vector2u& /*size*/) :
|
EglContext::EglContext(EglContext* /*shared*/, const ContextSettings& /*settings*/, const Vector2u& /*size*/)
|
||||||
m_display(EGL_NO_DISPLAY),
|
|
||||||
m_context(EGL_NO_CONTEXT),
|
|
||||||
m_surface(EGL_NO_SURFACE),
|
|
||||||
m_config(nullptr)
|
|
||||||
{
|
{
|
||||||
EglContextImpl::ensureInit();
|
EglContextImpl::ensureInit();
|
||||||
|
|
||||||
|
@ -188,10 +188,10 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EGLDisplay m_display; //!< The internal EGL display
|
EGLDisplay m_display{EGL_NO_DISPLAY}; //!< The internal EGL display
|
||||||
EGLContext m_context; //!< The internal EGL context
|
EGLContext m_context{EGL_NO_CONTEXT}; //!< The internal EGL context
|
||||||
EGLSurface m_surface; //!< The internal EGL surface
|
EGLSurface m_surface{EGL_NO_SURFACE}; //!< The internal EGL surface
|
||||||
EGLConfig m_config; //!< The internal EGL config
|
EGLConfig m_config{nullptr}; //!< The internal EGL config
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -79,10 +79,4 @@ void Joystick::update()
|
|||||||
return priv::JoystickManager::getInstance().update();
|
return priv::JoystickManager::getInstance().update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Joystick::Identification::Identification() : name("No Joystick"), vendorId(0), productId(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
@ -220,10 +220,10 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool m_isValid; ///< If any error occurs this variable is false
|
bool m_isValid{true}; ///< If any error occurs this variable is false
|
||||||
CFDataRef m_layoutData; ///< CFData containing the layout
|
CFDataRef m_layoutData{0}; ///< CFData containing the layout
|
||||||
UCKeyboardLayout* m_layout; ///< Current Keyboard Layout
|
UCKeyboardLayout* m_layout{nullptr}; ///< Current Keyboard Layout
|
||||||
IOHIDManagerRef m_manager; ///< HID Manager
|
IOHIDManagerRef m_manager{0}; ///< HID Manager
|
||||||
|
|
||||||
IOHIDElements m_keys[Keyboard::KeyCount]; ///< All the keys on any connected keyboard
|
IOHIDElements m_keys[Keyboard::KeyCount]; ///< All the keys on any connected keyboard
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ CFDictionaryRef HIDInputManager::copyDevicesMask(UInt32 page, UInt32 usage)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
HIDInputManager::HIDInputManager() : m_isValid(true), m_layoutData(0), m_layout(0), m_manager(0)
|
HIDInputManager::HIDInputManager()
|
||||||
{
|
{
|
||||||
// Get the current keyboard layout
|
// Get the current keyboard layout
|
||||||
TISInputSourceRef tis = TISCopyCurrentKeyboardLayoutInputSource();
|
TISInputSourceRef tis = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
|
@ -69,7 +69,7 @@ CFSetRef HIDJoystickManager::copyJoysticks()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
HIDJoystickManager::HIDJoystickManager() : m_manager(0), m_joystickCount(0)
|
HIDJoystickManager::HIDJoystickManager()
|
||||||
{
|
{
|
||||||
m_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
m_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||||
|
|
||||||
|
@ -123,8 +123,8 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
IOHIDManagerRef m_manager; ///< HID Manager
|
IOHIDManagerRef m_manager{0}; ///< HID Manager
|
||||||
unsigned int m_joystickCount; ///< Number of joysticks currently connected
|
unsigned int m_joystickCount{0}; ///< Number of joysticks currently connected
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,9 +156,9 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
NSOpenGLContextRef m_context; ///< OpenGL context.
|
NSOpenGLContextRef m_context{0}; ///< OpenGL context.
|
||||||
NSOpenGLViewRef m_view; ///< Only for offscreen context.
|
NSOpenGLViewRef m_view{0}; ///< Only for offscreen context.
|
||||||
NSWindowRef m_window; ///< Only for offscreen context.
|
NSWindowRef m_window{0}; ///< Only for offscreen context.
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -44,7 +44,7 @@ namespace priv
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SFContext::SFContext(SFContext* shared) : m_context(0), m_view(0), m_window(0)
|
SFContext::SFContext(SFContext* shared)
|
||||||
{
|
{
|
||||||
AutoreleasePool pool;
|
AutoreleasePool pool;
|
||||||
// Create the context
|
// Create the context
|
||||||
@ -53,10 +53,7 @@ SFContext::SFContext(SFContext* shared) : m_context(0), m_view(0), m_window(0)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SFContext::SFContext(SFContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel) :
|
SFContext::SFContext(SFContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel)
|
||||||
m_context(0),
|
|
||||||
m_view(0),
|
|
||||||
m_window(0)
|
|
||||||
{
|
{
|
||||||
AutoreleasePool pool;
|
AutoreleasePool pool;
|
||||||
// Create the context.
|
// Create the context.
|
||||||
@ -69,10 +66,7 @@ m_window(0)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SFContext::SFContext(SFContext* shared, const ContextSettings& settings, const Vector2u& size) :
|
SFContext::SFContext(SFContext* shared, const ContextSettings& settings, const Vector2u& size)
|
||||||
m_context(0),
|
|
||||||
m_view(0),
|
|
||||||
m_window(0)
|
|
||||||
{
|
{
|
||||||
AutoreleasePool pool;
|
AutoreleasePool pool;
|
||||||
// Ensure the process is setup in order to create a valid window.
|
// Ensure the process is setup in order to create a valid window.
|
||||||
|
@ -365,7 +365,7 @@ private:
|
|||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplDelegateRef m_delegate; ///< Implementation in Obj-C.
|
WindowImplDelegateRef m_delegate; ///< Implementation in Obj-C.
|
||||||
bool m_showCursor; ///< Is the cursor displayed or hidden?
|
bool m_showCursor{true}; ///< Is the cursor displayed or hidden?
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -85,7 +85,7 @@ void showMouseCursor()
|
|||||||
#pragma mark WindowImplCocoa's ctor/dtor
|
#pragma mark WindowImplCocoa's ctor/dtor
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplCocoa::WindowImplCocoa(WindowHandle handle) : m_showCursor(true)
|
WindowImplCocoa::WindowImplCocoa(WindowHandle handle)
|
||||||
{
|
{
|
||||||
AutoreleasePool pool;
|
AutoreleasePool pool;
|
||||||
// Treat the handle as it real type
|
// Treat the handle as it real type
|
||||||
@ -118,8 +118,7 @@ WindowImplCocoa::WindowImplCocoa(WindowHandle handle) : m_showCursor(true)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplCocoa::WindowImplCocoa(VideoMode mode, const String& title, unsigned long style, const ContextSettings& /*settings*/) :
|
WindowImplCocoa::WindowImplCocoa(VideoMode mode, const String& title, unsigned long style, const ContextSettings& /*settings*/)
|
||||||
m_showCursor(true)
|
|
||||||
{
|
{
|
||||||
AutoreleasePool pool;
|
AutoreleasePool pool;
|
||||||
// Transform the app process.
|
// Transform the app process.
|
||||||
|
@ -74,7 +74,7 @@ void ClipboardImpl::processEvents()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ClipboardImpl::ClipboardImpl() : m_window(0), m_requestResponded(false)
|
ClipboardImpl::ClipboardImpl()
|
||||||
{
|
{
|
||||||
// Open a connection with the X server
|
// Open a connection with the X server
|
||||||
m_display = openDisplay();
|
m_display = openDisplay();
|
||||||
|
@ -136,7 +136,7 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
::Window m_window; ///< X identifier defining our window
|
::Window m_window{0}; ///< X identifier defining our window
|
||||||
::Display* m_display; ///< Pointer to the display
|
::Display* m_display; ///< Pointer to the display
|
||||||
Atom m_clipboard; ///< X Atom identifying the CLIPBOARD selection
|
Atom m_clipboard; ///< X Atom identifying the CLIPBOARD selection
|
||||||
Atom m_targets; ///< X Atom identifying TARGETS
|
Atom m_targets; ///< X Atom identifying TARGETS
|
||||||
@ -145,7 +145,7 @@ private:
|
|||||||
Atom m_targetProperty; ///< X Atom identifying our destination window property
|
Atom m_targetProperty; ///< X Atom identifying our destination window property
|
||||||
String m_clipboardContents; ///< Our clipboard contents
|
String m_clipboardContents; ///< Our clipboard contents
|
||||||
std::deque<XEvent> m_events; ///< Queue we use to store pending events for this window
|
std::deque<XEvent> 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
|
bool m_requestResponded{false}; ///< Holds whether our selection request has been responded to or not
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -42,9 +42,8 @@ namespace priv
|
|||||||
{
|
{
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CursorImpl::CursorImpl() : m_display(openDisplay()), m_cursor(None)
|
CursorImpl::CursorImpl() : m_display(openDisplay())
|
||||||
{
|
{
|
||||||
// That's it.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ private:
|
|||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
::Display* m_display;
|
::Display* m_display;
|
||||||
::Cursor m_cursor;
|
::Cursor m_cursor{None};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -81,7 +81,7 @@ int handleXError(::Display*, XErrorEvent*)
|
|||||||
class GlxErrorHandler
|
class GlxErrorHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GlxErrorHandler(::Display* display) : m_lock(glxErrorMutex), m_display(display)
|
GlxErrorHandler(::Display* display) : m_display(display)
|
||||||
{
|
{
|
||||||
glxErrorOccurred = false;
|
glxErrorOccurred = false;
|
||||||
m_previousHandler = XSetErrorHandler(handleXError);
|
m_previousHandler = XSetErrorHandler(handleXError);
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::scoped_lock<std::recursive_mutex> m_lock;
|
std::scoped_lock<std::recursive_mutex> m_lock{glxErrorMutex};
|
||||||
::Display* m_display;
|
::Display* m_display;
|
||||||
int (*m_previousHandler)(::Display*, XErrorEvent*);
|
int (*m_previousHandler)(::Display*, XErrorEvent*);
|
||||||
};
|
};
|
||||||
@ -106,12 +106,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
GlxContext::GlxContext(GlxContext* shared) :
|
GlxContext::GlxContext(GlxContext* shared)
|
||||||
m_display(nullptr),
|
|
||||||
m_window(0),
|
|
||||||
m_context(nullptr),
|
|
||||||
m_pbuffer(0),
|
|
||||||
m_ownsWindow(false)
|
|
||||||
{
|
{
|
||||||
// Save the creation settings
|
// Save the creation settings
|
||||||
m_settings = ContextSettings();
|
m_settings = ContextSettings();
|
||||||
@ -131,12 +126,7 @@ m_ownsWindow(false)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int /*bitsPerPixel*/) :
|
GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int /*bitsPerPixel*/)
|
||||||
m_display(nullptr),
|
|
||||||
m_window(0),
|
|
||||||
m_context(nullptr),
|
|
||||||
m_pbuffer(0),
|
|
||||||
m_ownsWindow(false)
|
|
||||||
{
|
{
|
||||||
// Save the creation settings
|
// Save the creation settings
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
@ -156,12 +146,7 @@ m_ownsWindow(false)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const Vector2u& size) :
|
GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const Vector2u& size)
|
||||||
m_display(nullptr),
|
|
||||||
m_window(0),
|
|
||||||
m_context(nullptr),
|
|
||||||
m_pbuffer(0),
|
|
||||||
m_ownsWindow(false)
|
|
||||||
{
|
{
|
||||||
// Save the creation settings
|
// Save the creation settings
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
|
@ -176,11 +176,11 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
::Display* m_display; ///< Connection to the X server
|
::Display* m_display{nullptr}; ///< Connection to the X server
|
||||||
::Window m_window; ///< Window to which the context is attached
|
::Window m_window{0}; ///< Window to which the context is attached
|
||||||
GLXContext m_context; ///< OpenGL context
|
GLXContext m_context{nullptr}; ///< OpenGL context
|
||||||
GLXPbuffer m_pbuffer; ///< GLX pbuffer ID if one was created
|
GLXPbuffer m_pbuffer{0}; ///< GLX pbuffer ID if one was created
|
||||||
bool m_ownsWindow; ///< Do we own the window associated to the context?
|
bool m_ownsWindow{false}; ///< Do we own the window associated to the context?
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -434,13 +434,6 @@ namespace sf
|
|||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
JoystickImpl::JoystickImpl() : m_file(-1)
|
|
||||||
{
|
|
||||||
std::fill(m_mapping, m_mapping + ABS_MAX + 1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void JoystickImpl::initialize()
|
void JoystickImpl::initialize()
|
||||||
{
|
{
|
||||||
|
@ -44,12 +44,6 @@ namespace priv
|
|||||||
class JoystickImpl
|
class JoystickImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Constructor
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
JoystickImpl();
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Perform the global initialization of the joystick module
|
/// \brief Perform the global initialization of the joystick module
|
||||||
///
|
///
|
||||||
@ -116,8 +110,8 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int m_file; ///< File descriptor of the joystick
|
int m_file{-1}; ///< File descriptor of the joystick
|
||||||
char m_mapping[ABS_MAX + 1]; ///< Axes mapping (index to axis id)
|
char m_mapping[ABS_MAX + 1]{0}; ///< Axes mapping (index to axis id)
|
||||||
JoystickState m_state; ///< Current state of the joystick
|
JoystickState m_state; ///< Current state of the joystick
|
||||||
sf::Joystick::Identification m_identification; ///< Identification of the joystick
|
sf::Joystick::Identification m_identification; ///< Identification of the joystick
|
||||||
};
|
};
|
||||||
|
@ -41,14 +41,6 @@ namespace
|
|||||||
{
|
{
|
||||||
struct VulkanLibraryWrapper
|
struct VulkanLibraryWrapper
|
||||||
{
|
{
|
||||||
VulkanLibraryWrapper() :
|
|
||||||
library(nullptr),
|
|
||||||
vkGetInstanceProcAddr(nullptr),
|
|
||||||
vkEnumerateInstanceLayerProperties(nullptr),
|
|
||||||
vkEnumerateInstanceExtensionProperties(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~VulkanLibraryWrapper()
|
~VulkanLibraryWrapper()
|
||||||
{
|
{
|
||||||
if (library)
|
if (library)
|
||||||
@ -98,11 +90,11 @@ struct VulkanLibraryWrapper
|
|||||||
return (entryPoint != nullptr);
|
return (entryPoint != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* library;
|
void* library{nullptr};
|
||||||
|
|
||||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
|
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{nullptr};
|
||||||
PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties;
|
PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties{nullptr};
|
||||||
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
|
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
VulkanLibraryWrapper wrapper;
|
VulkanLibraryWrapper wrapper;
|
||||||
|
@ -478,25 +478,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplX11::WindowImplX11(WindowHandle handle) :
|
WindowImplX11::WindowImplX11(WindowHandle handle) : m_isExternal(true)
|
||||||
m_window(0),
|
|
||||||
m_screen(0),
|
|
||||||
m_inputMethod(nullptr),
|
|
||||||
m_inputContext(nullptr),
|
|
||||||
m_isExternal(true),
|
|
||||||
m_oldVideoMode(0),
|
|
||||||
m_oldRRCrtc(0),
|
|
||||||
m_hiddenCursor(0),
|
|
||||||
m_lastCursor(None),
|
|
||||||
m_keyRepeat(true),
|
|
||||||
m_previousSize(-1, -1),
|
|
||||||
m_useSizeHints(false),
|
|
||||||
m_fullscreen(false),
|
|
||||||
m_cursorGrabbed(false),
|
|
||||||
m_windowMapped(false),
|
|
||||||
m_iconPixmap(0),
|
|
||||||
m_iconMaskPixmap(0),
|
|
||||||
m_lastInputTime(0)
|
|
||||||
{
|
{
|
||||||
using namespace WindowsImplX11Impl;
|
using namespace WindowsImplX11Impl;
|
||||||
|
|
||||||
@ -530,24 +512,9 @@ m_lastInputTime(0)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
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_window(0),
|
|
||||||
m_screen(0),
|
|
||||||
m_inputMethod(nullptr),
|
|
||||||
m_inputContext(nullptr),
|
|
||||||
m_isExternal(false),
|
m_isExternal(false),
|
||||||
m_oldVideoMode(0),
|
|
||||||
m_oldRRCrtc(0),
|
|
||||||
m_hiddenCursor(0),
|
|
||||||
m_lastCursor(None),
|
|
||||||
m_keyRepeat(true),
|
|
||||||
m_previousSize(-1, -1),
|
|
||||||
m_useSizeHints(false),
|
|
||||||
m_fullscreen((style & Style::Fullscreen) != 0),
|
m_fullscreen((style & Style::Fullscreen) != 0),
|
||||||
m_cursorGrabbed(m_fullscreen),
|
m_cursorGrabbed(m_fullscreen)
|
||||||
m_windowMapped(false),
|
|
||||||
m_iconPixmap(0),
|
|
||||||
m_iconMaskPixmap(0),
|
|
||||||
m_lastInputTime(0)
|
|
||||||
{
|
{
|
||||||
using namespace WindowsImplX11Impl;
|
using namespace WindowsImplX11Impl;
|
||||||
|
|
||||||
|
@ -297,25 +297,25 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
::Window m_window; ///< X identifier defining our window
|
::Window m_window{0}; ///< X identifier defining our window
|
||||||
::Display* m_display; ///< Pointer to the display
|
::Display* m_display; ///< Pointer to the display
|
||||||
int m_screen; ///< Screen identifier
|
int m_screen; ///< Screen identifier
|
||||||
XIM m_inputMethod; ///< Input method linked to the X display
|
XIM m_inputMethod{nullptr}; ///< Input method linked to the X display
|
||||||
XIC m_inputContext; ///< Input context used to get unicode input in our window
|
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
|
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{0}; ///< Video mode in use before we switch to fullscreen
|
||||||
RRCrtc m_oldRRCrtc; ///< RRCrtc in use before we switch to fullscreen
|
RRCrtc m_oldRRCrtc{0}; ///< 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{0}; ///< As X11 doesn't provide cursor hiding, we must create a transparent one
|
||||||
::Cursor m_lastCursor; ///< Last cursor used -- this data is not owned by the window and is required to be always valid
|
::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; ///< Is the KeyRepeat feature enabled?
|
bool m_keyRepeat{true}; ///< Is the KeyRepeat feature enabled?
|
||||||
Vector2i m_previousSize; ///< Previous size of the window, to find if a ConfigureNotify event is a resize event (could be a move event only)
|
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; ///< Is the size of the window fixed with size hints?
|
bool m_useSizeHints{false}; ///< Is the size of the window fixed with size hints?
|
||||||
bool m_fullscreen; ///< Is the window in fullscreen?
|
bool m_fullscreen{false}; ///< Is the window in fullscreen?
|
||||||
bool m_cursorGrabbed; ///< Is the mouse cursor trapped?
|
bool m_cursorGrabbed{false}; ///< Is the mouse cursor trapped?
|
||||||
bool m_windowMapped; ///< Has the window been mapped by the window manager?
|
bool m_windowMapped{false}; ///< Has the window been mapped by the window manager?
|
||||||
Pixmap m_iconPixmap; ///< The current icon pixmap if in use
|
Pixmap m_iconPixmap{0}; ///< The current icon pixmap if in use
|
||||||
Pixmap m_iconMaskPixmap; ///< The current icon mask pixmap if in use
|
Pixmap m_iconMaskPixmap{0}; ///< The current icon mask pixmap if in use
|
||||||
::Time m_lastInputTime; ///< Last time we received user input
|
::Time m_lastInputTime{0}; ///< Last time we received user input
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -35,9 +35,7 @@
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VideoMode::VideoMode() : size(0, 0), bitsPerPixel(0)
|
VideoMode::VideoMode() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -37,14 +37,6 @@ namespace sf
|
|||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
CursorImpl::CursorImpl() : m_cursor(nullptr), m_systemCursor(false)
|
|
||||||
{
|
|
||||||
// That's it.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CursorImpl::~CursorImpl()
|
CursorImpl::~CursorImpl()
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
/// Refer to sf::Cursor::Cursor().
|
/// Refer to sf::Cursor::Cursor().
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CursorImpl();
|
CursorImpl() = default;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Destructor
|
/// \brief Destructor
|
||||||
@ -99,8 +99,8 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void* m_cursor; // Type erasure via `void*` is used here to avoid depending on `windows.h`
|
void* m_cursor{nullptr}; // Type erasure via `void*` is used here to avoid depending on `windows.h`
|
||||||
bool m_systemCursor;
|
bool m_systemCursor{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -103,10 +103,7 @@ namespace
|
|||||||
{
|
{
|
||||||
struct ConnectionCache
|
struct ConnectionCache
|
||||||
{
|
{
|
||||||
ConnectionCache() : connected(false)
|
bool connected{false};
|
||||||
{
|
|
||||||
}
|
|
||||||
bool connected;
|
|
||||||
sf::Clock timer;
|
sf::Clock timer;
|
||||||
};
|
};
|
||||||
const sf::Time connectionRefreshDelay = sf::milliseconds(500);
|
const sf::Time connectionRefreshDelay = sf::milliseconds(500);
|
||||||
|
@ -40,14 +40,6 @@ namespace
|
|||||||
{
|
{
|
||||||
struct VulkanLibraryWrapper
|
struct VulkanLibraryWrapper
|
||||||
{
|
{
|
||||||
VulkanLibraryWrapper() :
|
|
||||||
library(nullptr),
|
|
||||||
vkGetInstanceProcAddr(nullptr),
|
|
||||||
vkEnumerateInstanceLayerProperties(nullptr),
|
|
||||||
vkEnumerateInstanceExtensionProperties(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~VulkanLibraryWrapper()
|
~VulkanLibraryWrapper()
|
||||||
{
|
{
|
||||||
if (library)
|
if (library)
|
||||||
@ -97,11 +89,11 @@ struct VulkanLibraryWrapper
|
|||||||
return (entryPoint != nullptr);
|
return (entryPoint != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
HMODULE library;
|
HMODULE library{nullptr};
|
||||||
|
|
||||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
|
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{nullptr};
|
||||||
PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties;
|
PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties{nullptr};
|
||||||
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
|
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
VulkanLibraryWrapper wrapper;
|
VulkanLibraryWrapper wrapper;
|
||||||
|
@ -116,12 +116,7 @@ WglContext::WglContext(WglContext* shared) : WglContext(shared, ContextSettings(
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WglContext::WglContext(WglContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel) :
|
WglContext::WglContext(WglContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel)
|
||||||
m_window(nullptr),
|
|
||||||
m_pbuffer(nullptr),
|
|
||||||
m_deviceContext(nullptr),
|
|
||||||
m_context(nullptr),
|
|
||||||
m_ownsWindow(false)
|
|
||||||
{
|
{
|
||||||
WglContextImpl::ensureInit();
|
WglContextImpl::ensureInit();
|
||||||
|
|
||||||
@ -137,12 +132,7 @@ m_ownsWindow(false)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WglContext::WglContext(WglContext* shared, const ContextSettings& settings, const Vector2u& size) :
|
WglContext::WglContext(WglContext* shared, const ContextSettings& settings, const Vector2u& size)
|
||||||
m_window(nullptr),
|
|
||||||
m_pbuffer(nullptr),
|
|
||||||
m_deviceContext(nullptr),
|
|
||||||
m_context(nullptr),
|
|
||||||
m_ownsWindow(false)
|
|
||||||
{
|
{
|
||||||
WglContextImpl::ensureInit();
|
WglContextImpl::ensureInit();
|
||||||
|
|
||||||
|
@ -179,11 +179,11 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
HWND m_window; //!< Window to which the context is attached
|
HWND m_window{nullptr}; //!< Window to which the context is attached
|
||||||
HPBUFFERARB m_pbuffer; //!< Handle to a pbuffer if one was created
|
HPBUFFERARB m_pbuffer{nullptr}; //!< Handle to a pbuffer if one was created
|
||||||
HDC m_deviceContext; //!< Device context associated to the context
|
HDC m_deviceContext{nullptr}; //!< Device context associated to the context
|
||||||
HGLRC m_context; //!< OpenGL context
|
HGLRC m_context{nullptr}; //!< OpenGL context
|
||||||
bool m_ownsWindow; //!< Do we own the target window?
|
bool m_ownsWindow{false}; //!< Do we own the target window?
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -130,19 +130,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplWin32::WindowImplWin32(WindowHandle handle) :
|
WindowImplWin32::WindowImplWin32(WindowHandle handle) : m_handle(handle)
|
||||||
m_handle(handle),
|
|
||||||
m_callback(0),
|
|
||||||
m_cursorVisible(true), // might need to call GetCursorInfo
|
|
||||||
m_lastCursor(LoadCursor(nullptr, IDC_ARROW)),
|
|
||||||
m_icon(nullptr),
|
|
||||||
m_keyRepeatEnabled(true),
|
|
||||||
m_lastSize(0, 0),
|
|
||||||
m_resizing(false),
|
|
||||||
m_surrogate(0),
|
|
||||||
m_mouseInside(false),
|
|
||||||
m_fullscreen(false),
|
|
||||||
m_cursorGrabbed(false)
|
|
||||||
{
|
{
|
||||||
// Set that this process is DPI aware and can handle DPI scaling
|
// Set that this process is DPI aware and can handle DPI scaling
|
||||||
setProcessDpiAware();
|
setProcessDpiAware();
|
||||||
@ -164,16 +152,7 @@ m_cursorGrabbed(false)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplWin32::WindowImplWin32(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& /*settings*/) :
|
WindowImplWin32::WindowImplWin32(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& /*settings*/) :
|
||||||
m_handle(nullptr),
|
|
||||||
m_callback(0),
|
|
||||||
m_cursorVisible(true), // might need to call GetCursorInfo
|
|
||||||
m_lastCursor(LoadCursor(nullptr, IDC_ARROW)),
|
|
||||||
m_icon(nullptr),
|
|
||||||
m_keyRepeatEnabled(true),
|
|
||||||
m_lastSize(mode.size),
|
m_lastSize(mode.size),
|
||||||
m_resizing(false),
|
|
||||||
m_surrogate(0),
|
|
||||||
m_mouseInside(false),
|
|
||||||
m_fullscreen((style & Style::Fullscreen) != 0),
|
m_fullscreen((style & Style::Fullscreen) != 0),
|
||||||
m_cursorGrabbed(m_fullscreen)
|
m_cursorGrabbed(m_fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -269,18 +269,19 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
HWND m_handle; //!< Win32 handle of the window
|
HWND m_handle{nullptr}; //!< Win32 handle of the window
|
||||||
LONG_PTR m_callback; //!< Stores the original event callback function of the control
|
LONG_PTR m_callback{0}; //!< Stores the original event callback function of the control
|
||||||
bool m_cursorVisible; //!< Is the cursor visible or hidden?
|
bool m_cursorVisible{true}; //!< Is the cursor visible or hidden?
|
||||||
HCURSOR m_lastCursor; //!< Last cursor used -- this data is not owned by the window and is required to be always valid
|
HCURSOR m_lastCursor{
|
||||||
HICON m_icon; //!< Custom icon assigned to the window
|
LoadCursor(nullptr, IDC_ARROW)}; //!< Last cursor used -- this data is not owned by the window and is required to be always valid
|
||||||
bool m_keyRepeatEnabled; //!< Automatic key-repeat state for keydown events
|
HICON m_icon{nullptr}; //!< 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
|
Vector2u m_lastSize; //!< The last handled size of the window
|
||||||
bool m_resizing; //!< Is the window being resized?
|
bool m_resizing{false}; //!< 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
|
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; //!< Mouse is inside the window?
|
bool m_mouseInside{false}; //!< Mouse is inside the window?
|
||||||
bool m_fullscreen; //!< Is the window fullscreen?
|
bool m_fullscreen{false}; //!< Is the window fullscreen?
|
||||||
bool m_cursorGrabbed; //!< Is the mouse cursor trapped?
|
bool m_cursorGrabbed{false}; //!< Is the mouse cursor trapped?
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -37,22 +37,18 @@
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Window::Window() : m_context(), m_frameTimeLimit(Time::Zero)
|
Window::Window() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Window::Window(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings) :
|
Window::Window(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings)
|
||||||
m_context(),
|
|
||||||
m_frameTimeLimit(Time::Zero)
|
|
||||||
{
|
{
|
||||||
Window::create(mode, title, style, settings);
|
Window::create(mode, title, style, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Window::Window(WindowHandle handle, const ContextSettings& settings) : m_context(), m_frameTimeLimit(Time::Zero)
|
Window::Window(WindowHandle handle, const ContextSettings& settings)
|
||||||
{
|
{
|
||||||
Window::create(handle, settings);
|
Window::create(handle, settings);
|
||||||
}
|
}
|
||||||
|
@ -46,20 +46,18 @@ const sf::WindowBase* fullscreenWindow = nullptr;
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowBase::WindowBase() : m_impl(), m_size(0, 0)
|
WindowBase::WindowBase() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowBase::WindowBase(VideoMode mode, const String& title, std::uint32_t style) : m_impl(), m_size(0, 0)
|
WindowBase::WindowBase(VideoMode mode, const String& title, std::uint32_t style)
|
||||||
{
|
{
|
||||||
WindowBase::create(mode, title, style);
|
WindowBase::create(mode, title, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowBase::WindowBase(WindowHandle handle) : m_impl(), m_size(0, 0)
|
WindowBase::WindowBase(WindowHandle handle)
|
||||||
{
|
{
|
||||||
WindowBase::create(handle);
|
WindowBase::create(handle);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ std::unique_ptr<WindowImpl> WindowImpl::create(WindowHandle handle)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImpl::WindowImpl() : m_joystickStatesImpl(std::make_unique<JoystickStatesImpl>()), m_joystickThreshold(0.1f)
|
WindowImpl::WindowImpl() : m_joystickStatesImpl(std::make_unique<JoystickStatesImpl>())
|
||||||
{
|
{
|
||||||
// Get the initial joystick states
|
// Get the initial joystick states
|
||||||
JoystickManager::getInstance().update();
|
JoystickManager::getInstance().update();
|
||||||
|
@ -298,7 +298,7 @@ private:
|
|||||||
std::queue<Event> m_events; //!< Queue of available events
|
std::queue<Event> m_events; //!< Queue of available events
|
||||||
std::unique_ptr<JoystickStatesImpl> m_joystickStatesImpl; //!< Previous state of the joysticks (PImpl)
|
std::unique_ptr<JoystickStatesImpl> m_joystickStatesImpl; //!< Previous state of the joysticks (PImpl)
|
||||||
Vector3f m_sensorValue[Sensor::Count]; //!< Previous value of the sensors
|
Vector3f m_sensorValue[Sensor::Count]; //!< Previous value of the sensors
|
||||||
float m_joystickThreshold; //!< Joystick threshold (minimum motion for "move" event to be generated)
|
float m_joystickThreshold{0.1f}; //!< Joystick threshold (minimum motion for "move" event to be generated)
|
||||||
float m_previousAxes[Joystick::Count][Joystick::AxisCount]; //!< Position of each axis last time a move event triggered, in range [-100, 100]
|
float m_previousAxes[Joystick::Count][Joystick::AxisCount]; //!< Position of each axis last time a move event triggered, in range [-100, 100]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,14 +31,6 @@ namespace sf
|
|||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
CursorImpl::CursorImpl()
|
|
||||||
{
|
|
||||||
// Nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CursorImpl::loadFromPixels(const std::uint8_t* /* pixels */, Vector2u /* size */, Vector2u /* hotspot */)
|
bool CursorImpl::loadFromPixels(const std::uint8_t* /* pixels */, Vector2u /* size */, Vector2u /* hotspot */)
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
/// Refer to sf::Cursor::Cursor().
|
/// Refer to sf::Cursor::Cursor().
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CursorImpl();
|
CursorImpl() = default;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Deleted copy constructor
|
/// \brief Deleted copy constructor
|
||||||
|
@ -160,10 +160,10 @@ private:
|
|||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EAGLContext* m_context; ///< The internal context
|
EAGLContext* m_context; ///< The internal context
|
||||||
GLuint m_framebuffer; ///< Frame buffer associated to the context
|
GLuint m_framebuffer{0}; ///< Frame buffer associated to the context
|
||||||
GLuint m_colorbuffer; ///< Color render buffer
|
GLuint m_colorbuffer{0}; ///< Color render buffer
|
||||||
GLuint m_depthbuffer; ///< Depth render buffer
|
GLuint m_depthbuffer{0}; ///< Depth render buffer
|
||||||
bool m_vsyncEnabled; ///< Vertical sync activation flag
|
bool m_vsyncEnabled{false}; ///< Vertical sync activation flag
|
||||||
Clock m_clock; ///< Measures the elapsed time for the fake v-sync implementation
|
Clock m_clock; ///< Measures the elapsed time for the fake v-sync implementation
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,13 +93,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EaglContext::EaglContext(EaglContext* shared) :
|
EaglContext::EaglContext(EaglContext* shared) : m_context(nil)
|
||||||
m_context(nil),
|
|
||||||
m_framebuffer(0),
|
|
||||||
m_colorbuffer(0),
|
|
||||||
m_depthbuffer(0),
|
|
||||||
m_vsyncEnabled(false),
|
|
||||||
m_clock()
|
|
||||||
{
|
{
|
||||||
ensureInit();
|
ensureInit();
|
||||||
|
|
||||||
@ -114,12 +108,7 @@ m_clock()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EaglContext::EaglContext(EaglContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel) :
|
EaglContext::EaglContext(EaglContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel) :
|
||||||
m_context(nil),
|
m_context(nil)
|
||||||
m_framebuffer(0),
|
|
||||||
m_colorbuffer(0),
|
|
||||||
m_depthbuffer(0),
|
|
||||||
m_vsyncEnabled(false),
|
|
||||||
m_clock()
|
|
||||||
{
|
{
|
||||||
ensureInit();
|
ensureInit();
|
||||||
|
|
||||||
@ -131,12 +120,7 @@ m_clock()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EaglContext::EaglContext(EaglContext* /* shared */, const ContextSettings& /* settings */, const Vector2u& /* size */) :
|
EaglContext::EaglContext(EaglContext* /* shared */, const ContextSettings& /* settings */, const Vector2u& /* size */) :
|
||||||
m_context(nil),
|
m_context(nil)
|
||||||
m_framebuffer(0),
|
|
||||||
m_colorbuffer(0),
|
|
||||||
m_depthbuffer(0),
|
|
||||||
m_vsyncEnabled(false),
|
|
||||||
m_clock()
|
|
||||||
{
|
{
|
||||||
ensureInit();
|
ensureInit();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user