-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGameInfo.h
59 lines (49 loc) · 1.31 KB
/
GameInfo.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
#pragma once
#include "SFML/Graphics.hpp"
#include<SFML/Window.hpp>
#include "Mario.h"
#include <chrono>
#include<iostream>
#include<fstream>
#include<ctime>
#include<algorithm>
#include<regex>
#define NUMBER_OF_ITEMS 4
class GameInfo
{
int coins = 0;
int time = 0;
int score = 0;
Mario mario;
sf::Font font;
sf::Text info[NUMBER_OF_ITEMS];
// time in game
std::chrono::steady_clock::time_point start;
std::chrono::steady_clock::time_point finish;
bool difference;
bool switcher = 0;
// save to file
time_t czas; // time in seconds count from 1970 year
std::string localData; // time in standard format example "Thu Jan 01 01:00:00 1970"
std::string fileExtension = ".png";
std::string userName;
public:
friend class Mario;
friend class Game;
GameInfo();
~GameInfo();
void followMario(int center);
void draw(sf::RenderWindow& window, int center); //draws game info
void showLife2();
void showLife1();
int getLife();
void reset(); //resets game stats
void increaseCoins();
void increaseScoreBonus();
void increaseScoreCoins();
void countTime();
void saveResultToFile(); //saves result to file
std::string properFormat3(int number); // return 3 numbers 3 -> 003, 49 -> 049, 234 -> 234
std::string properFormat4(int number); // return 4 numbers 3 -> 0003, 49 -> 0049, 234 -> 0234
void typeUserName();
};