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; 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 */ /* Parse arguments */
Utility::Arguments args{"magnum"}; Utility::Arguments args{"magnum"};
args.addOption("disable-workarounds") args.addOption("disable-workarounds")

2
src/Magnum/Context.h

@ -505,7 +505,7 @@ class MAGNUM_EXPORT Context {
Implementation::State& state() { return *_state; } Implementation::State& state() { return *_state; }
private: private:
explicit Context(NoCreateT, Int argc, char** argv, void functionLoader()); explicit Context(NoCreateT, Int argc, const char** argv, void functionLoader());
bool tryCreate(); bool tryCreate();
void create(); 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}, * @def_gl{CONTEXT_FLAGS}, @def_gl{NUM_EXTENSIONS},
* @fn_gl{GetString} with @def_gl{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 #ifdef MAGNUM_BUILD_DEPRECATED
/** @copybrief Context(Int, char**) /** @copybrief Context(Int, const char**)
* @deprecated Use @ref Context(Int, char**) instead. * @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 #endif
/** /**
@ -71,13 +77,19 @@ class Context: public Magnum::Context {
* left in empty state. Use @ref create() or @ref tryCreate() to * left in empty state. Use @ref create() or @ref tryCreate() to
* complete the setup. * 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) #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
Magnum::Context{NoCreate, argc, argv, flextGLInit} {} Magnum::Context{NoCreate, argc, argv, flextGLInit} {}
#else #else
Magnum::Context{NoCreate, argc, argv, nullptr} {} Magnum::Context{NoCreate, argc, argv, nullptr} {}
#endif #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 * @brief Complete the context setup and exit on failure
* *

Loading…
Cancel
Save