-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameLogic.hpp
84 lines (61 loc) · 1.5 KB
/
GameLogic.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
79
80
81
82
83
84
//
// GameLogic.hpp
// TicTacToe
//
// Created by Савелий Никулин on 30.06.2024.
//
#ifndef GameLogic_hpp
#define GameLogic_hpp
#include <SDL2/SDL.h>
#include <SDL_ttf.h>
#include <SDL2_image/SDL_image.h>
#include <stdio.h>
#include <vector>
#include <iostream>
#include "users.h"
#include "math/point.h"
#include "TicTacToeLogic.hpp"
#include "Node.hpp"
#include "Field.hpp"
#include "GameMode.h"
#include "GameState.h"
#include "Menu.hpp"
using namespace std;
class GameLogic {
int screenWidth, screenHeight = 0;
SDL_Window *window;
SDL_Renderer *render;
SDL_Event event;
bool isGameOpen = false;
bool isGameOver = false;
Uint32 startTime, endTime = 0;
float delta = 0;
const float frameTime = 1.0f / 30.0f;
users currentUser = ::player;
TicTacToeLogic ticTacToeLogic;
Node rootNode;
const float fieldSize = 360;
Field *field;
GameState gameState;
GameMode gameMode;
Menu *mainMenu;
TTF_Font *font;
SDL_Surface *player1StatsSurface;
SDL_Texture *player1StatsTexture;
SDL_Surface *player2StatsSurface;
SDL_Texture *player2StatsTexture;
SDL_Surface *infoSurface;
SDL_Texture *infoTexture;
public:
GameLogic(int screenWidth, int screenHeight);
void StartGame();
~GameLogic();
private:
void resetGame();
void eventController();
void clearScreen();
void logic();
void draw();
void drawText();
};
#endif /* GameLogic_hpp */