Enable moving windows

This commit is contained in:
Chris Thrasher 2023-12-26 17:31:08 -06:00
parent 7556d1be78
commit fbd8407a5f
7 changed files with 60 additions and 6 deletions

View File

@ -134,6 +134,30 @@ public:
////////////////////////////////////////////////////////////
~Window() override;
////////////////////////////////////////////////////////////
/// \brief Deleted copy constructor
///
////////////////////////////////////////////////////////////
Window(const Window&) = delete;
////////////////////////////////////////////////////////////
/// \brief Deleted copy assignment
///
////////////////////////////////////////////////////////////
Window& operator=(const Window&) = delete;
////////////////////////////////////////////////////////////
/// \brief Move constructor
///
////////////////////////////////////////////////////////////
Window(Window&&) noexcept;
////////////////////////////////////////////////////////////
/// \brief Move assignment
///
////////////////////////////////////////////////////////////
Window& operator=(Window&&) noexcept;
////////////////////////////////////////////////////////////
/// \brief Create (or recreate) the window
///

View File

@ -130,6 +130,18 @@ public:
////////////////////////////////////////////////////////////
WindowBase& operator=(const WindowBase&) = delete;
////////////////////////////////////////////////////////////
/// \brief Move constructor
///
////////////////////////////////////////////////////////////
WindowBase(WindowBase&&) noexcept;
////////////////////////////////////////////////////////////
/// \brief Move assignment
///
////////////////////////////////////////////////////////////
WindowBase& operator=(WindowBase&&) noexcept;
////////////////////////////////////////////////////////////
/// \brief Create (or recreate) the window
///

View File

@ -66,6 +66,14 @@ Window::Window(WindowHandle handle, const ContextSettings& settings)
Window::~Window() = default;
////////////////////////////////////////////////////////////
Window::Window(Window&&) noexcept = default;
////////////////////////////////////////////////////////////
Window& Window::operator=(Window&&) noexcept = default;
////////////////////////////////////////////////////////////
void Window::create(VideoMode mode, const String& title, std::uint32_t style, State state)
{

View File

@ -77,6 +77,14 @@ WindowBase::WindowBase(WindowHandle handle)
WindowBase::~WindowBase() = default;
////////////////////////////////////////////////////////////
WindowBase::WindowBase(WindowBase&&) noexcept = default;
////////////////////////////////////////////////////////////
WindowBase& WindowBase::operator=(WindowBase&&) noexcept = default;
////////////////////////////////////////////////////////////
void WindowBase::create(VideoMode mode, const String& title, std::uint32_t style, State state)
{

View File

@ -21,8 +21,8 @@ TEST_CASE("[Graphics] sf::RenderWindow", runDisplayTests())
STATIC_CHECK(std::has_virtual_destructor_v<sf::RenderWindow>);
STATIC_CHECK(!std::is_copy_constructible_v<sf::RenderWindow>);
STATIC_CHECK(!std::is_copy_assignable_v<sf::RenderWindow>);
STATIC_CHECK(!std::is_nothrow_move_constructible_v<sf::RenderWindow>);
STATIC_CHECK(!std::is_nothrow_move_assignable_v<sf::RenderWindow>);
STATIC_CHECK(std::is_nothrow_move_constructible_v<sf::RenderWindow>);
STATIC_CHECK(std::is_nothrow_move_assignable_v<sf::RenderWindow>);
}
SECTION("Construction")

View File

@ -14,10 +14,11 @@ TEST_CASE("[Window] sf::Window", runDisplayTests())
{
SECTION("Type traits")
{
STATIC_CHECK(std::has_virtual_destructor_v<sf::Window>);
STATIC_CHECK(!std::is_copy_constructible_v<sf::Window>);
STATIC_CHECK(!std::is_copy_assignable_v<sf::Window>);
STATIC_CHECK(!std::is_nothrow_move_constructible_v<sf::Window>);
STATIC_CHECK(!std::is_nothrow_move_assignable_v<sf::Window>);
STATIC_CHECK(std::is_nothrow_move_constructible_v<sf::Window>);
STATIC_CHECK(std::is_nothrow_move_assignable_v<sf::Window>);
}
SECTION("Construction")

View File

@ -16,10 +16,11 @@ TEST_CASE("[Window] sf::WindowBase", runDisplayTests())
{
SECTION("Type traits")
{
STATIC_CHECK(std::has_virtual_destructor_v<sf::WindowBase>);
STATIC_CHECK(!std::is_copy_constructible_v<sf::WindowBase>);
STATIC_CHECK(!std::is_copy_assignable_v<sf::WindowBase>);
STATIC_CHECK(!std::is_nothrow_move_constructible_v<sf::WindowBase>);
STATIC_CHECK(!std::is_nothrow_move_assignable_v<sf::WindowBase>);
STATIC_CHECK(std::is_nothrow_move_constructible_v<sf::WindowBase>);
STATIC_CHECK(std::is_nothrow_move_assignable_v<sf::WindowBase>);
}
SECTION("Construction")