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 game_window.cpp
renderer_simple.cpp renderer_simple.cpp
renderer_shader.cpp renderer_shader.cpp
session.hpp session.cpp
util.cpp util.cpp
game.cpp game.cpp

View file

@ -9,7 +9,7 @@
class GameWindow : public endofthejedi::GLWindow { class GameWindow : public endofthejedi::GLWindow {
private: private:
Game m_game; Game* m_game;
endofthejedi::RendererSimple m_renderer; endofthejedi::RendererSimple m_renderer;
protected: protected:
@ -36,12 +36,14 @@ class GameWindow : public endofthejedi::GLWindow {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 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()); } void resize() override { glViewport(0, 0, getwidth(), getheight()); }
public: public:
GameWindow(unsigned int width, unsigned int height) GameWindow(unsigned int width, unsigned int height, Game *ptr)
: endofthejedi::GLWindow(width, height) {} : endofthejedi::GLWindow(width, height) {
m_game = ptr;
}
}; };

View file

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

View file

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