From 648d7999c8ec054fd3112b47f8e9c1d6ed3a8a14 Mon Sep 17 00:00:00 2001 From: end Date: Wed, 28 Sep 2016 07:28:18 +0200 Subject: [PATCH] * fixes --- game/CMakeLists.txt | 2 +- game/game_window.hpp | 14 ++++++++------ game/main.cpp | 2 ++ game/session.hpp | 2 ++ 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index 69522c0..1c510ab 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -12,7 +12,7 @@ set(GAME_SRC game_window.cpp renderer_simple.cpp renderer_shader.cpp - session.hpp + session.cpp util.cpp game.cpp diff --git a/game/game_window.hpp b/game/game_window.hpp index db36f43..5f741ba 100644 --- a/game/game_window.hpp +++ b/game/game_window.hpp @@ -9,7 +9,7 @@ class GameWindow : public endofthejedi::GLWindow { private: - Game m_game; + Game* m_game; endofthejedi::RendererSimple m_renderer; protected: @@ -29,19 +29,21 @@ class GameWindow : public endofthejedi::GLWindow { // } //} - if (!m_game->cycle(static_cast(time/1000000000.0))) { - std::cout<<"stopping the game..." << std::endl; + if (!m_game->cycle(static_cast(time / 1000000000.0))) { + std::cout << "stopping the game..." << std::endl; stop(); } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - m_renderer.render(m_game.state()); + m_renderer.render(m_game->state()); } void resize() override { glViewport(0, 0, getwidth(), getheight()); } public: - GameWindow(unsigned int width, unsigned int height) - : endofthejedi::GLWindow(width, height) {} + GameWindow(unsigned int width, unsigned int height, Game *ptr) + : endofthejedi::GLWindow(width, height) { + m_game = ptr; + } }; diff --git a/game/main.cpp b/game/main.cpp index 2718363..924fcd0 100644 --- a/game/main.cpp +++ b/game/main.cpp @@ -1,3 +1,5 @@ +#define ASIO_STANDALONE + #include #include #include diff --git a/game/session.hpp b/game/session.hpp index 23a8a49..730dc93 100644 --- a/game/session.hpp +++ b/game/session.hpp @@ -1,5 +1,7 @@ #pragma once +#define ASIO_STANDALONE + #include #include #include