summaryrefslogtreecommitdiff
path: root/src/game/pseudostate.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-21 18:20:49 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-21 18:20:49 +0200
commit4cfe1361fff6223d11a25cefd74af7a51b7d57bd (patch)
treed1ca7dca22567ec15be3f97d34b44766ad5dc7f4 /src/game/pseudostate.cpp
parent076f69f12ba4000a9c307e803e05827d037d1ff6 (diff)
Hide game and interface behind a pimpl.
Diffstat (limited to 'src/game/pseudostate.cpp')
-rw-r--r--src/game/pseudostate.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/game/pseudostate.cpp b/src/game/pseudostate.cpp
new file mode 100644
index 0000000..0f2d0c5
--- /dev/null
+++ b/src/game/pseudostate.cpp
@@ -0,0 +1,64 @@
+/*
+This file is part of Minitrem.
+
+Minitrem is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+Minitrem is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Minitrem. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "game.hpp"
+
+namespace game {
+
+pseudostate_t::pseudostate_t(sf::RenderWindow *window_)
+{
+ pimpl = new state_t();
+
+ pimpl->interface.window = window_;
+ pimpl->interface.game = pimpl;
+}
+
+pseudostate_t::~pseudostate_t(void)
+{
+ delete pimpl;
+}
+
+void pseudostate_t::start(void)
+{
+ pimpl->start();
+}
+
+void pseudostate_t::stop(void)
+{
+ pimpl->stop();
+}
+
+void pseudostate_t::tick(ntime_t time, double dt)
+{
+ pimpl->tick(time);
+ pimpl->interface.tick(dt);
+}
+
+world::world_t *pseudostate_t::get_world(void)
+{
+ return &pimpl->world;
+}
+
+void pseudostate_t::render_interface_to(render::state_t *render)
+{
+ pimpl->interface.render_to(render);
+
+ pimpl->compute_ambience(render);
+ audio::update(pimpl->interface.camera_3d, pimpl->paused);
+}
+
+}