blob: 5ebf69ed86a95b4789e2589b8cfbbc08d3d4efca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#ifndef GAME_HPP
#define GAME_HPP
#include <YAGE/camera2d.hpp>
#include <YAGE/glslprogram.hpp>
#include <YAGE/gltexture.hpp>
#include <YAGE/inputmanager.hpp>
#include <YAGE/spritebatch.hpp>
#include <YAGE/window.hpp>
#include <memory>
#include <vector>
enum class GameState
{
PLAY,
EXIT
};
class Game
{
// member variables
private:
// screen width and height initialized in constructor
int screen_width_;
int screen_height_;
// initializer game state
GameState game_state_=GameState::PLAY;
// set timer to 0
float time_=0;
// window
yage::Window window_;
// camera
yage::Camera2D camera_;
// temporary program
yage::GlslProgram program_;
// sprites
yage::SpriteBatch sprite_batch_;
// input manager
yage::InputManager input_manager_;
// member functions
public:
Game(int screen_width=1280, int screen_height=720);
~Game();
void run();
private:
void initSystems();
void initShaders();
void processInput();
void gameLoop();
void drawGame();
float calculateFps();
};
#endif
|