summary refs log tree commit diff stats
path: root/src/game.h
blob: 69224dc8a817925663d99872d9734c6da81c5a5c (plain) (blame)
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
#ifndef GAME_H
#define GAME_H

#include "components.h"

const int TILE_WIDTH = 8;
const int TILE_HEIGHT = 8;
const int GAME_WIDTH = 320;
const int GAME_HEIGHT = 200;
const int MAP_WIDTH = GAME_WIDTH/TILE_WIDTH;
const int MAP_HEIGHT = GAME_HEIGHT/TILE_HEIGHT;

const int FRAMES_PER_SECOND = 60;
const double SECONDS_PER_FRAME = 1.0 / FRAMES_PER_SECOND;

class Game {
  public:
    static Game& getInstance()
    {
      static Game instance;
  
      return instance;
    }
    
    ~Game();
    void execute();
    void loadMap(Map* map);
    void input(int key, int action);
    
    bool shouldQuit = false;
  private:
    Game();
    Game(Game const&);
    void operator=(Game const&);
    
    GLFWwindow* window;
    World* world;
    World* nextWorld;
    Map* m;
    Map* m2;
};

#endif