Browse Source

Platform: added Sdl2Application::setContainerCssClass().

pull/272/head
Vladimír Vondruš 8 years ago
parent
commit
9095954e6d
  1. 3
      doc/changelog.dox
  2. 9
      src/Magnum/Platform/Sdl2Application.cpp
  3. 16
      src/Magnum/Platform/Sdl2Application.h

3
doc/changelog.dox

@ -90,6 +90,9 @@ See also:
@ref Platform::Sdl2Application
- Implemented missing resize event support in @ref Platform::Sdl2Application
on @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten"
- Ability to modify CSS classes that control layout of
@ref CORRADE_TARGET_EMSCRIPTEN "Emscripten" app canvas using
@ref Platform::Sdl2Application::setContainerCssClass()
- Implemented @ref Platform::GlfwApplication::MouseMoveEvent::buttons() for
feature parity with @ref Platform::Sdl2Application
- Added @ref Platform::Sdl2Application::GLConfiguration::setColorBufferSize() "GLConfiguration::setColorBufferSize()",

9
src/Magnum/Platform/Sdl2Application.cpp

@ -531,6 +531,15 @@ Vector2i Sdl2Application::framebufferSize() const {
return size;
}
#ifdef CORRADE_TARGET_EMSCRIPTEN
void Sdl2Application::setContainerCssClass(const std::string& cssClass) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension"
EM_ASM_({document.getElementById('container').className = Pointer_stringify($0, $1);}, cssClass.data(), cssClass.size());
#pragma GCC diagnostic pop
}
#endif
void Sdl2Application::swapBuffers() {
#ifndef CORRADE_TARGET_EMSCRIPTEN
SDL_GL_SwapWindow(_window);

16
src/Magnum/Platform/Sdl2Application.h

@ -626,6 +626,22 @@ class Sdl2Application {
*/
Vector2 dpiScaling(const Configuration& configuration) const;
#if defined(CORRADE_TARGET_EMSCRIPTEN) || defined(DOXYGEN_GENERATING_OUTPUT)
/**
* @brief Set container CSS class
*
* Assigns given CSS class to the @cb{.html} <div class="container"> @ce.
* Useful for example to change aspect ratio of the view or stretch it
* to cover the full page. See @ref platforms-html5-layout for more
* information about possible values. Note that this replaces any
* existing class, to set multiple classes separate them with
* whitespace.
*
* @note Only available on @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten".
*/
void setContainerCssClass(const std::string& cssClass);
#endif
protected:
/**
* @brief Swap buffers

Loading…
Cancel
Save