This commit is contained in:
end 2016-09-28 07:28:18 +02:00
parent 56b9ef8093
commit 648d7999c8
4 changed files with 13 additions and 7 deletions

View file

@ -12,7 +12,7 @@ set(GAME_SRC
game_window.cpp
renderer_simple.cpp
renderer_shader.cpp
session.hpp
session.cpp
util.cpp
game.cpp

View file

@ -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<float>(time/1000000000.0))) {
std::cout<<"stopping the game..." << std::endl;
if (!m_game->cycle(static_cast<float>(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;
}
};

View file

@ -1,3 +1,5 @@
#define ASIO_STANDALONE
#include <iostream>
#include <getopt.h>
#include <asio.hpp>

View file

@ -1,5 +1,7 @@
#pragma once
#define ASIO_STANDALONE
#include <iostream>
#include <memory>
#include <utility>