-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathengine.h
74 lines (54 loc) · 1022 Bytes
/
engine.h
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
//
// Created by Patryk on 04.06.2021.
//
#ifndef SNAKE_ENGINE_H
#define SNAKE_ENGINE_H
#include <SFML/Graphics.hpp>
//#include <SFML/Graphics/RectangleShape.hpp>
#include <vector>
#include <deque>
#include "Snake.h"
#include "Eat.h"
#include <iostream>
using namespace sf;
using namespace std;
enum direction{
right =0,
down =1,
left =2,
up = 3
};
enum State{
running = 0,
lose = 1,
won =2
};
class Engine {
RenderWindow window;
vector<Snake> snake;
direction dir = direction::right;
Time timeSinceLastMove;
bool add=false;
State state;
float speed;
bool turbo=false;
int score;
Font font;
Text title;
Text scoreText;
RectangleShape border;
CircleShape head;
Eat eat;
public:
Engine();
void run();
void draw();
void input();
void growUp();
void update();
void randEatPos();
void startGame();
direction getDir() const;
void setDir(direction dir);
};
#endif //SNAKE_ENGINE_H