-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scene.h
42 lines (40 loc) · 1.19 KB
/
Scene.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
#pragma once
#include "Shape.h"
#include "Snake.h"
#include "Block.h"
#include <vector>
const int N = 24, M = 24;
class Scene
{
std::vector<Shape*> shapes; // "ãíó÷êèé" ìàñèâ óêàç³âíèê³â íà åëåìåíòè ãðè
int button; // êíîïêà ìèø³ (-1 - íå íàòèñíóòà, 0 - ë³âà, 2 - ïðàâà)
float angleX, angleY; // ïîòî÷íèé êóò ïîâîðîòó ñöåíè
float mouseX, mouseY; // ïîòî÷í³ êîîðäèíàòè
float width, height; // Ðîçì³ðè â³êíà
float distZ; // â³äñòàíü ïî îñ³ Z äî ñöåíè
bool finish; // îçíàêà òîãî, ùî ãðó çàâåðøåíî
bool pause = true;
bool stop = true;
Snake* snake;
int speed = 4;
bool borders = true;
bool switchText = true;
int score = 0;
int bestscore = 0;
public:
Scene(float side);
~Scene();
void on_paint();
void on_size(int width, int height);
void on_mouse(int button, int state, int x, int y);
void on_motion(int x, int y);
void on_special(int key, int x, int y);
void on_keyboard(int key, int x, int y);
void on_timer(int value);
private:
void initialize();
void eat();
bool checkFinish();
void checkFood();
void bestScore();
};