mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Add window create functions without style specifier
This brings the create() functions inline with the constructor overloads for WindowBase, Window, and RenderWindow
This commit is contained in:
parent
e2ea1d8a7c
commit
6591c59504
@ -180,9 +180,8 @@ public:
|
|||||||
/// If \a `state` is `State::Fullscreen`, then \a `mode` must be
|
/// If \a `state` is `State::Fullscreen`, then \a `mode` must be
|
||||||
/// a valid video mode.
|
/// a valid video mode.
|
||||||
///
|
///
|
||||||
/// The last parameter is an optional structure specifying
|
/// The last parameter is a structure specifying advanced OpenGL
|
||||||
/// advanced OpenGL context settings such as anti-aliasing,
|
/// context settings such as anti-aliasing, depth-buffer bits, etc.
|
||||||
/// depth-buffer bits, etc.
|
|
||||||
///
|
///
|
||||||
/// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window)
|
/// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window)
|
||||||
/// \param title Title of the window
|
/// \param title Title of the window
|
||||||
@ -193,6 +192,38 @@ public:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void create(VideoMode mode, const String& title, std::uint32_t style, State state, const ContextSettings& settings);
|
virtual void create(VideoMode mode, const String& title, std::uint32_t style, State state, const ContextSettings& settings);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Create (or recreate) the window
|
||||||
|
///
|
||||||
|
/// If the window was already created, it closes it first.
|
||||||
|
/// If \a `state` is `State::Fullscreen`, then \a `mode` must be
|
||||||
|
/// a valid video mode.
|
||||||
|
///
|
||||||
|
/// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window)
|
||||||
|
/// \param title Title of the window
|
||||||
|
/// \param state %Window state
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void create(VideoMode mode, const String& title, State state) override;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Create (or recreate) the window
|
||||||
|
///
|
||||||
|
/// If the window was already created, it closes it first.
|
||||||
|
/// If \a `state` is `State::Fullscreen`, then \a `mode` must be
|
||||||
|
/// a valid video mode.
|
||||||
|
///
|
||||||
|
/// The last parameter is a structure specifying advanced OpenGL
|
||||||
|
/// context settings such as anti-aliasing, depth-buffer bits, etc.
|
||||||
|
///
|
||||||
|
/// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window)
|
||||||
|
/// \param title Title of the window
|
||||||
|
/// \param state %Window state
|
||||||
|
/// \param settings Additional settings for the underlying OpenGL context
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
virtual void create(VideoMode mode, const String& title, State state, const ContextSettings& settings);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create (or recreate) the window from an existing control
|
/// \brief Create (or recreate) the window from an existing control
|
||||||
///
|
///
|
||||||
|
@ -157,6 +157,20 @@ public:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void create(VideoMode mode, const String& title, std::uint32_t style = Style::Default, State state = State::Windowed);
|
virtual void create(VideoMode mode, const String& title, std::uint32_t style = Style::Default, State state = State::Windowed);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Create (or recreate) the window
|
||||||
|
///
|
||||||
|
/// If the window was already created, it closes it first.
|
||||||
|
/// If \a `state` is `State::Fullscreen`, then \a `mode` must be
|
||||||
|
/// a valid video mode.
|
||||||
|
///
|
||||||
|
/// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window)
|
||||||
|
/// \param title Title of the window
|
||||||
|
/// \param state %Window state
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
virtual void create(VideoMode mode, const String& title, State state);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create (or recreate) the window from an existing control
|
/// \brief Create (or recreate) the window from an existing control
|
||||||
///
|
///
|
||||||
|
@ -95,6 +95,20 @@ void Window::create(VideoMode mode, const String& title, std::uint32_t style, St
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void Window::create(VideoMode mode, const String& title, State state)
|
||||||
|
{
|
||||||
|
Window::create(mode, title, sf::Style::Default, state, ContextSettings{});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void Window::create(VideoMode mode, const String& title, State state, const ContextSettings& settings)
|
||||||
|
{
|
||||||
|
Window::create(mode, title, sf::Style::Default, state, settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Window::create(WindowHandle handle)
|
void Window::create(WindowHandle handle)
|
||||||
{
|
{
|
||||||
|
@ -102,6 +102,13 @@ void WindowBase::create(VideoMode mode, const String& title, std::uint32_t style
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void WindowBase::create(VideoMode mode, const String& title, State state)
|
||||||
|
{
|
||||||
|
create(mode, title, Style::Default, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowBase::create(WindowHandle handle)
|
void WindowBase::create(WindowHandle handle)
|
||||||
{
|
{
|
||||||
|
@ -128,7 +128,16 @@ TEST_CASE("[Window] sf::Window", runDisplayTests())
|
|||||||
CHECK(window.getSettings().attributeFlags == sf::ContextSettings::Default);
|
CHECK(window.getSettings().attributeFlags == sf::ContextSettings::Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Mode, title, style, and context settings")
|
SECTION("Mode, title, style, and state")
|
||||||
|
{
|
||||||
|
window.create(sf::VideoMode({240, 360}), "Window Tests", sf::Style::Resize, sf::State::Windowed);
|
||||||
|
CHECK(window.isOpen());
|
||||||
|
CHECK(window.getSize() == sf::Vector2u(240, 360));
|
||||||
|
CHECK(window.getNativeHandle() != sf::WindowHandle());
|
||||||
|
CHECK(window.getSettings().attributeFlags == sf::ContextSettings::Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("Mode, title, style, state, and context settings")
|
||||||
{
|
{
|
||||||
window.create(sf::VideoMode({240, 360}),
|
window.create(sf::VideoMode({240, 360}),
|
||||||
"Window Tests",
|
"Window Tests",
|
||||||
@ -142,5 +151,28 @@ TEST_CASE("[Window] sf::Window", runDisplayTests())
|
|||||||
CHECK(window.getSettings().stencilBits >= 1);
|
CHECK(window.getSettings().stencilBits >= 1);
|
||||||
CHECK(window.getSettings().antiAliasingLevel >= 1);
|
CHECK(window.getSettings().antiAliasingLevel >= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("Mode, title, and state")
|
||||||
|
{
|
||||||
|
window.create(sf::VideoMode({240, 360}), "Window Tests", sf::State::Windowed);
|
||||||
|
CHECK(window.isOpen());
|
||||||
|
CHECK(window.getSize() == sf::Vector2u(240, 360));
|
||||||
|
CHECK(window.getNativeHandle() != sf::WindowHandle());
|
||||||
|
CHECK(window.getSettings().attributeFlags == sf::ContextSettings::Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("Mode, title, state, and context settings")
|
||||||
|
{
|
||||||
|
window.create(sf::VideoMode({240, 360}),
|
||||||
|
"Window Tests",
|
||||||
|
sf::State::Windowed,
|
||||||
|
sf::ContextSettings{/* depthBits*/ 1, /* stencilBits */ 1, /* antiAliasingLevel */ 1});
|
||||||
|
CHECK(window.isOpen());
|
||||||
|
CHECK(window.getSize() == sf::Vector2u(240, 360));
|
||||||
|
CHECK(window.getNativeHandle() != sf::WindowHandle());
|
||||||
|
CHECK(window.getSettings().depthBits >= 1);
|
||||||
|
CHECK(window.getSettings().stencilBits >= 1);
|
||||||
|
CHECK(window.getSettings().antiAliasingLevel >= 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,14 @@ TEST_CASE("[Window] sf::WindowBase", runDisplayTests())
|
|||||||
CHECK(windowBase.getNativeHandle() != sf::WindowHandle());
|
CHECK(windowBase.getNativeHandle() != sf::WindowHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("Mode, title, and state")
|
||||||
|
{
|
||||||
|
windowBase.create(sf::VideoMode({240, 360}), "WindowBase Tests", sf::State::Windowed);
|
||||||
|
CHECK(windowBase.isOpen());
|
||||||
|
CHECK(windowBase.getSize() == sf::Vector2u(240, 360));
|
||||||
|
CHECK(windowBase.getNativeHandle() != sf::WindowHandle());
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("Mode, title, style, and state")
|
SECTION("Mode, title, style, and state")
|
||||||
{
|
{
|
||||||
windowBase.create(sf::VideoMode({240, 360}), "WindowBase Tests", sf::Style::Resize, sf::State::Windowed);
|
windowBase.create(sf::VideoMode({240, 360}), "WindowBase Tests", sf::Style::Resize, sf::State::Windowed);
|
||||||
|
Loading…
Reference in New Issue
Block a user