Browse Source

Platform: rename Sdl2Application::Configuration::Flags to WindowFlags.

Flags etc. will be used for context flags in the future and this would
result in naming collision.
pull/51/head
Vladimír Vondruš 13 years ago
parent
commit
4395a1d21e
  1. 8
      src/Platform/Sdl2Application.cpp
  2. 60
      src/Platform/Sdl2Application.h

8
src/Platform/Sdl2Application.cpp

@ -109,8 +109,8 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) {
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configuration.sampleCount()); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configuration.sampleCount());
/* Flags: if not hidden, set as shown */ /* Flags: if not hidden, set as shown */
Uint32 flags(configuration.flags()); Uint32 windowFlags(configuration.windowFlags());
if(!(configuration.flags() & Configuration::Flag::Hidden)) flags |= SDL_WINDOW_SHOWN; if(!(configuration.windowFlags() & Configuration::WindowFlag::Hidden)) windowFlags |= SDL_WINDOW_SHOWN;
/** @todo Remove when Emscripten has proper SDL2 support */ /** @todo Remove when Emscripten has proper SDL2 support */
#ifndef CORRADE_TARGET_EMSCRIPTEN #ifndef CORRADE_TARGET_EMSCRIPTEN
@ -158,7 +158,7 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) {
if(!(window = SDL_CreateWindow(configuration.title().data(), if(!(window = SDL_CreateWindow(configuration.title().data(),
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
configuration.size().x(), configuration.size().y(), configuration.size().x(), configuration.size().y(),
SDL_WINDOW_OPENGL|flags))) SDL_WINDOW_OPENGL|windowFlags)))
{ {
Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create window:" << SDL_GetError(); Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create window:" << SDL_GetError();
return false; return false;
@ -328,7 +328,7 @@ Sdl2Application::Configuration::Configuration():
#ifndef CORRADE_TARGET_EMSCRIPTEN #ifndef CORRADE_TARGET_EMSCRIPTEN
_title("Magnum SDL2 Application"), _title("Magnum SDL2 Application"),
#endif #endif
_size(800, 600), _flags(Flag::Resizable), _sampleCount(0), _version(Version::None) {} _size(800, 600), _windowFlags(WindowFlag::Resizable), _sampleCount(0), _version(Version::None) {}
Sdl2Application::Configuration::~Configuration() = default; Sdl2Application::Configuration::~Configuration() = default;

60
src/Platform/Sdl2Application.h

@ -41,6 +41,10 @@
#include <SDL.h> #include <SDL.h>
#include <SDL_scancode.h> #include <SDL_scancode.h>
#ifdef MAGNUM_BUILD_DEPRECATED
#include <Utility/Macros.h>
#endif
namespace Magnum { namespace Magnum {
class Context; class Context;
@ -370,9 +374,9 @@ class Sdl2Application::Configuration {
/** /**
* @brief Window flag * @brief Window flag
* *
* @see @ref Flags, @ref setFlags() * @see @ref WindowFlags, @ref setWindowFlags()
*/ */
enum class Flag: Uint32 { enum class WindowFlag: Uint32 {
Resizable = SDL_WINDOW_RESIZABLE, /**< Resizable window */ Resizable = SDL_WINDOW_RESIZABLE, /**< Resizable window */
Fullscreen = SDL_WINDOW_FULLSCREEN, /**< Fullscreen window */ Fullscreen = SDL_WINDOW_FULLSCREEN, /**< Fullscreen window */
Hidden = SDL_WINDOW_HIDDEN, /**< Hidden window */ Hidden = SDL_WINDOW_HIDDEN, /**< Hidden window */
@ -381,14 +385,30 @@ class Sdl2Application::Configuration {
MouseLocked = SDL_WINDOW_INPUT_GRABBED /**< Window with mouse locked */ MouseLocked = SDL_WINDOW_INPUT_GRABBED /**< Window with mouse locked */
}; };
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief WindowFlag
* @deprecated Use @ref Magnum::Platform::Sdl2Application::Configuration::WindowFlag "WindowFlag" instead.
*/
typedef CORRADE_DEPRECATED("use WindowFlag instead") WindowFlag Flag;
#endif
/** /**
* @brief Window flags * @brief Window flags
* *
* @see @ref setFlags() * @see @ref setFlags()
*/ */
typedef Containers::EnumSet<Flag, Uint32, SDL_WINDOW_RESIZABLE| typedef Containers::EnumSet<WindowFlag, Uint32, SDL_WINDOW_RESIZABLE|
SDL_WINDOW_FULLSCREEN|SDL_WINDOW_HIDDEN|SDL_WINDOW_MAXIMIZED| SDL_WINDOW_FULLSCREEN|SDL_WINDOW_HIDDEN|SDL_WINDOW_MAXIMIZED|
SDL_WINDOW_MINIMIZED|SDL_WINDOW_INPUT_GRABBED> Flags; SDL_WINDOW_MINIMIZED|SDL_WINDOW_INPUT_GRABBED> WindowFlags;
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief WindowFlags
* @deprecated Use @ref Magnum::Platform::Sdl2Application::Configuration::WindowFlags "WindowFlags" instead.
*/
typedef CORRADE_DEPRECATED("use WindowFlags instead") WindowFlags Flags;
#endif
/*implicit*/ Configuration(); /*implicit*/ Configuration();
~Configuration(); ~Configuration();
@ -435,19 +455,39 @@ class Sdl2Application::Configuration {
} }
/** @brief Window flags */ /** @brief Window flags */
Flags flags() const { return _flags; } WindowFlags windowFlags() const { return _windowFlags; }
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief windowFlags()
* @deprecated Use @ref Magnum::Platform::Sdl2Application::Configuration::windowFlags() "windowFlags()" instead.
*/
CORRADE_DEPRECATED("use windowFlags() instead") WindowFlags flags() const {
return windowFlags();
}
#endif
/** /**
* @brief Set window flags * @brief Set window flags
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is @ref Flag::Resizable. * Default is @ref WindowFlag::Resizable.
*/ */
Configuration& setFlags(const Flags flags) { Configuration& setWindowFlags(WindowFlags flags) {
_flags = flags; _windowFlags = flags;
return *this; return *this;
} }
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief setWindowFlags()
* @deprecated Use @ref Magnum::Platform::Sdl2Application::Configuration::setWindowFlags "setWindowFlags()" instead.
*/
CORRADE_DEPRECATED("use setWindowFlags() instead") Configuration& setFlags(WindowFlags flags) {
return setWindowFlags(flags);
}
#endif
#ifndef CORRADE_TARGET_EMSCRIPTEN #ifndef CORRADE_TARGET_EMSCRIPTEN
/** /**
* @brief Context version * @brief Context version
@ -496,12 +536,12 @@ class Sdl2Application::Configuration {
std::string _title; std::string _title;
#endif #endif
Vector2i _size; Vector2i _size;
Flags _flags; WindowFlags _windowFlags;
Int _sampleCount; Int _sampleCount;
Version _version; Version _version;
}; };
CORRADE_ENUMSET_OPERATORS(Sdl2Application::Configuration::Flags) CORRADE_ENUMSET_OPERATORS(Sdl2Application::Configuration::WindowFlags)
/** /**
@brief Base for input events @brief Base for input events

Loading…
Cancel
Save