Skip to content

Commit

Permalink
player: Use EmscriptenApplication
Browse files Browse the repository at this point in the history
Signed-off-by: Squareys <squareys@googlemail.com>
  • Loading branch information
Squareys authored and mosra committed Jun 6, 2019
1 parent 4828c09 commit eca4562
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/player/CMakeLists.txt
Expand Up @@ -28,8 +28,13 @@ find_package(Magnum REQUIRED
MeshTools
Shaders
SceneGraph
Trade
Sdl2Application)
Trade)

if(CORRADE_TARGET_EMSCRIPTEN)
find_package(Magnum REQUIRED EmscriptenApplication)
else()
find_package(Magnum REQUIRED Sdl2Application)
endif()

set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)

Expand Down
7 changes: 7 additions & 0 deletions src/player/Player.cpp
Expand Up @@ -48,7 +48,11 @@
#include <Magnum/GL/TextureFormat.h>
#include <Magnum/Math/FunctionsBatch.h>
#include <Magnum/MeshTools/Compile.h>
#ifdef CORRADE_TARGET_EMSCRIPTEN
#include <Magnum/Platform/EmscriptenApplication.h>
#else
#include <Magnum/Platform/Sdl2Application.h>
#endif
#include <Magnum/SceneGraph/Camera.h>
#include <Magnum/SceneGraph/Drawable.h>
#include <Magnum/SceneGraph/TranslationRotationScalingTransformation3D.h>
Expand Down Expand Up @@ -469,7 +473,10 @@ Player::Player(const Arguments& arguments): Platform::Application{arguments, NoC
load({}, *importer);
#endif

#ifndef CORRADE_TARGET_EMSCRIPTEN
setSwapInterval(1);
#endif

#ifdef CORRADE_TARGET_EMSCRIPTEN
app = this;
#endif
Expand Down

0 comments on commit eca4562

Please sign in to comment.