From fc1a486f0086f3389e9a5f0fa084b3ea77199350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 18 Dec 2013 00:52:12 +0100 Subject: [PATCH] Platform: ignore Sdl2Application title in Emscripten. --- src/Platform/Sdl2Application.cpp | 7 ++++++- src/Platform/Sdl2Application.h | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Platform/Sdl2Application.cpp b/src/Platform/Sdl2Application.cpp index 417daa0e4..91b4d3d3b 100644 --- a/src/Platform/Sdl2Application.cpp +++ b/src/Platform/Sdl2Application.cpp @@ -251,7 +251,12 @@ void Sdl2Application::mousePressEvent(MouseEvent&) {} void Sdl2Application::mouseReleaseEvent(MouseEvent&) {} void Sdl2Application::mouseMoveEvent(MouseMoveEvent&) {} -Sdl2Application::Configuration::Configuration(): _title("Magnum SDL2 Application"), _size(800, 600), _flags(Flag::Resizable), _sampleCount(0) {} +Sdl2Application::Configuration::Configuration(): + #ifndef CORRADE_TARGET_EMSCRIPTEN + _title("Magnum SDL2 Application"), + #endif + _size(800, 600), _flags(Flag::Resizable), _sampleCount(0) {} + Sdl2Application::Configuration::~Configuration() = default; Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseEvent::modifiers() { diff --git a/src/Platform/Sdl2Application.h b/src/Platform/Sdl2Application.h index 2ae5230b6..50e9339bf 100644 --- a/src/Platform/Sdl2Application.h +++ b/src/Platform/Sdl2Application.h @@ -393,19 +393,32 @@ class Sdl2Application::Configuration { /*implicit*/ Configuration(); ~Configuration(); - /** @brief Window title */ + #ifndef CORRADE_TARGET_EMSCRIPTEN + /** + * @brief Window title + * + * @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN. + */ std::string title() const { return _title; } + #endif /** * @brief Set window title * @return Reference to self (for method chaining) * * Default is `"Magnum SDL2 Application"`. + * @note In @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten" this function + * does nothing and is included only for compatibility. You need + * to set the title separately in application's HTML markup. */ + #ifndef CORRADE_TARGET_EMSCRIPTEN Configuration& setTitle(std::string title) { _title = std::move(title); return *this; } + #else + template Configuration& setTitle(const T&) { return *this; } + #endif /** @brief Window size */ Vector2i size() const { return _size; } @@ -451,7 +464,9 @@ class Sdl2Application::Configuration { } private: + #ifndef CORRADE_TARGET_EMSCRIPTEN std::string _title; + #endif Vector2i _size; Flags _flags; Int _sampleCount;