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 committed May 23, 2019
1 parent 7216bf3 commit 2bb3909
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/player/CMakeLists.txt
Original file line number Diff line number Diff line change
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
9 changes: 8 additions & 1 deletion src/player/Player.cpp
Original file line number Diff line number Diff line change
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 @@ -158,7 +162,7 @@ struct BaseUiPlane: Ui::Plane {
stop{*this, {Ui::Snap::Right, play, ControlSize}, "Stop", Ui::Style::Danger},
forward{*this, {Ui::Snap::Right, stop, HalfControlSize}, "»"},
modelInfo{*this, {Ui::Snap::Top|Ui::Snap::Left, LabelSize}, "", Text::Alignment::LineLeft, 128, Ui::Style::Dim},
animationProgress{*this, {Ui::Snap::Right, forward, LabelSize}, "", Text::Alignment::LineLeft, 17}
animationProgress{*this, {Ui::Snap::Right, forward, LabelSize}, "", Text::Alignment::LineLeft, 18}
#ifdef CORRADE_TARGET_EMSCRIPTEN
,
fullsize{*this, {Ui::Snap::Bottom, controls, ButtonSize}, "Full size"},
Expand Down Expand Up @@ -456,7 +460,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 2bb3909

Please sign in to comment.