Browse Source

Ability to pass const char** arguments to Platform::Context.

pull/162/merge
Vladimír Vondruš 10 years ago
parent
commit
00891e941d
  1. 2
      src/Magnum/Context.cpp
  2. 2
      src/Magnum/Context.h
  3. 22
      src/Magnum/Platform/Context.h

2
src/Magnum/Context.cpp

@ -427,7 +427,7 @@ Context& Context::current() {
return *currentContext;
}
Context::Context(NoCreateT, Int argc, char** argv, void functionLoader()): _functionLoader{functionLoader}, _version{Version::None} {
Context::Context(NoCreateT, Int argc, const char** argv, void functionLoader()): _functionLoader{functionLoader}, _version{Version::None} {
/* Parse arguments */
Utility::Arguments args{"magnum"};
args.addOption("disable-workarounds")

2
src/Magnum/Context.h

@ -505,7 +505,7 @@ class MAGNUM_EXPORT Context {
Implementation::State& state() { return *_state; }
private:
explicit Context(NoCreateT, Int argc, char** argv, void functionLoader());
explicit Context(NoCreateT, Int argc, const char** argv, void functionLoader());
bool tryCreate();
void create();

22
src/Magnum/Platform/Context.h

@ -54,13 +54,19 @@ class Context: public Magnum::Context {
* @def_gl{CONTEXT_FLAGS}, @def_gl{NUM_EXTENSIONS},
* @fn_gl{GetString} with @def_gl{EXTENSIONS}
*/
explicit Context(Int argc, char** argv): Context{NoCreate, argc, argv} { create(); }
explicit Context(Int argc, const char** argv): Context{NoCreate, argc, argv} { create(); }
/** @overload */
explicit Context(Int argc, char** argv): Context{argc, const_cast<const char**>(argv)} {}
/** @overload */
explicit Context(Int argc, std::nullptr_t argv): Context{argc, static_cast<const char**>(argv)} {}
#ifdef MAGNUM_BUILD_DEPRECATED
/** @copybrief Context(Int, char**)
* @deprecated Use @ref Context(Int, char**) instead.
/** @copybrief Context(Int, const char**)
* @deprecated Use @ref Context(Int, const char**) instead.
*/
CORRADE_DEPRECATED("use Context(Int, char**) instead") explicit Context(): Context(0, nullptr) {}
CORRADE_DEPRECATED("use Context(Int, const char**) instead") explicit Context(): Context(0, nullptr) {}
#endif
/**
@ -71,13 +77,19 @@ class Context: public Magnum::Context {
* left in empty state. Use @ref create() or @ref tryCreate() to
* complete the setup.
*/
explicit Context(NoCreateT, Int argc, char** argv):
explicit Context(NoCreateT, Int argc, const char** argv):
#if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
Magnum::Context{NoCreate, argc, argv, flextGLInit} {}
#else
Magnum::Context{NoCreate, argc, argv, nullptr} {}
#endif
/** @overload */
explicit Context(NoCreateT, Int argc, char** argv): Context{NoCreate, argc, const_cast<const char**>(argv)} {}
/** @overload */
explicit Context(NoCreateT, Int argc, std::nullptr_t argv): Context{NoCreate, argc, static_cast<const char**>(argv)} {}
/**
* @brief Complete the context setup and exit on failure
*

Loading…
Cancel
Save