diff --git a/include/SFML/Window/Context.h b/include/SFML/Window/Context.h index f46eb76..9bb651f 100644 --- a/include/SFML/Window/Context.h +++ b/include/SFML/Window/Context.h @@ -30,7 +30,7 @@ //////////////////////////////////////////////////////////// #include #include - +#include //////////////////////////////////////////////////////////// /// \brief Create a new context @@ -61,5 +61,16 @@ CSFML_WINDOW_API void sfContext_destroy(sfContext* context); //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfContext_setActive(sfContext* context, sfBool active); +//////////////////////////////////////////////////////////// +/// \brief Get the settings of the context. +/// +/// Note that these settings may be different than the ones passed to the +/// constructor; they are indeed adjusted if the original settings are not +/// directly supported by the system. +/// +/// \return Structure containing the settings +/// +//////////////////////////////////////////////////////////// +CSFML_WINDOW_API sfContextSettings sfContext_getSettings(const sfContext* context); #endif // SFML_CONTEXT_H diff --git a/src/SFML/Window/Context.cpp b/src/SFML/Window/Context.cpp index 894f02e..2c41826 100644 --- a/src/SFML/Window/Context.cpp +++ b/src/SFML/Window/Context.cpp @@ -49,3 +49,21 @@ sfBool sfContext_setActive(sfContext* context, sfBool active) { CSFML_CALL_RETURN(context, setActive(active == sfTrue), false) } + +//////////////////////////////////////////////////////////// +sfContextSettings sfContext_getSettings(const sfContext* context) +{ + sfContextSettings settings = {0, 0, 0, 0, 0}; + CSFML_CHECK_RETURN(context, settings); + + const sf::ContextSettings& params = context->This.getSettings(); + + settings.depthBits = params.depthBits; + settings.stencilBits = params.stencilBits; + settings.antialiasingLevel = params.antialiasingLevel; + settings.majorVersion = params.majorVersion; + settings.minorVersion = params.minorVersion; + settings.attributeFlags = params.attributeFlags; + + return settings; +}