-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathField.hpp
69 lines (51 loc) · 1.24 KB
/
Field.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
//
// Field.hpp
// TicTacToe
//
// Created by Савелий Никулин on 02.07.2024.
//
#ifndef Field_hpp
#define Field_hpp
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2_image/SDL_image.h>
#include <vector>
#include <iostream>
#include <functional>
#include "TicTacToeLogic.hpp"
#include "Node.hpp"
#include "TicTacToeLogic.hpp"
using namespace std;
class Field {
const bool drawDebugLines = false;
SDL_Renderer *render;
float x, y, width, height = 0;
TicTacToeLogic *ticTacToeLogic;
Node fieldNode;
vector<Node> symbols;
bool isWin = false;
Node winLineStart;
Node winLineEnd;
SDL_Surface *fieldSurface;
SDL_Texture *fieldTexture;
SDL_Surface *xSurface;
SDL_Texture *xTexture;
SDL_Surface *oSurface;
SDL_Texture *oTexture;
public:
Field();
Field(SDL_Renderer *render,
float x,
float y,
float width,
float height);
void logic();
void draw();
void clear();
Node *interactWithCell(int x, int y);
void drawSymbol(TicTacToeSymbol symbol, Node *node);
void setTicTacToeLogic(TicTacToeLogic *ticTacToeLogic);
Node *getNodeByName(string name);
~Field();
};
#endif /* Field_hpp */