-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameState.h
70 lines (55 loc) · 1.38 KB
/
GameState.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
#pragma once
#include "State.h"
#include "Button.h"
#include "Question.h"
#include "FinishState.h"
#include "FeedbackState.h"
#include "ScoreCompare.h"
class GameState :
public State
{
protected:
sf::Text text, text1;
sf::Font font;
sf::Texture GameTexture;
sf::Sprite GameSprite;
sf::RectangleShape background;
std::map<std::string, Button*> buttons;
//Question related variables
char opt;
char uo[10];
std::string question, opta, optb, optc, optd;
std::fstream file;
std::string str;
Question q;
int i;
int j;
//function
public:
GameState(sf::RenderWindow* window, std::stack<State*>* states);
virtual ~GameState();
//function
//buttons
void initButtons();
void updateButtons();
void renderButtons(sf::RenderTarget* target);
void deleteButtons();
//text
void initText();
void renderText(sf::RenderTarget* target);
//gui
void initGui();
void renderGui(sf::RenderTarget* target);
void endstate();
//question
void askQuestion(std::fstream &file, Question &q);
void setQuestionPos();
void verifyAnswer(std::fstream& file, Question& q);
int getQnNumber();
void setQnNumber();
void setOption();
//engine
void updateInput(const float& dt);
void update(const float &dt);
void render(sf::RenderTarget *target = NULL);
};