-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgame.hpp
78 lines (67 loc) · 1.59 KB
/
game.hpp
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef GAME_HPP
#define GAME_HPP
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <string>
#include <iostream>
#include "prank.hpp"
#include "item.hpp"
#include "texture_container.hpp"
#include "soundBuffer_container.hpp"
#include "soundHandler.hpp"
#include "cat.hpp"
#include "Utils.hpp"
#include "Collision.hpp"
#include "Settings.hpp"
class Game {
public:
enum GameState{
INTRO,
GAME,
OUTRO
};
Game(int width, int height, std::string title);
~Game();
sf::RenderWindow window;
void run();
void executeMouseEvents(sf::Event* ev);
void createObjects();
void introLogic(sf::Time);
void gameLogic(sf::Time);
void draw(sf::Time);
void drawStats();
void shotWater();
void setupOutro();
int calcMessiness();
sf::Event event;
TextureContainer assets;
sf::Clock deltaClock;
std::vector<Prank*> pranks;
std::map<std::string, Item*> items;
std::map<std::string, Anim*> anims;
std::vector<Item*> vItems; // items sorted by layer
Cat cat;
sf::Sprite roomSprite;
sf::View view;
bool hasWaterGun=true;
int objectNamesCtr=0;
sf::Music music;
protected:
unsigned int gameState = INTRO;
bool introClockStarted=false;
bool isMouseDown=false;
int lastMouseX, lastMouseY;
Item* draggedItem=nullptr;
sf::Font font;
float secondsPassed=0;
float totalTimeInSeconds=60*2;
float timeSpeed = 1;
AnimSprite mom;
AnimSprite momCloud;
sf::Text momText;
sf::Text countText;
sf::Clock introClock;
sf::Sprite pointer;
};
#endif // GAME_HPP