-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameSettings.cpp
63 lines (54 loc) · 1.31 KB
/
GameSettings.cpp
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
#include "stdafx.h"
#include "GameSettings.h"
GameSettings::GameSettings() {}
GameSettings::~GameSettings() {}
void GameSettings::Load(std::string location) {
_settings.clear();
_location = location;
std::string aux;
_file.open(_location);
while(std::getline(_file, aux))
_settings.push_back(std::stoi(aux));
_file.close();
std::cout << "\n_GameSettings: Settings loaded.";
}
void GameSettings::Save() {
_file.open(_location);
for (int i = 0; i < _settings.size(); i++) {
_file << _settings[i];
if (i < _settings.size() - 1) _file << "\n";
}
_file.close();
std::cout << "\n_GameSettings: Settings saved.";
}
int GameSettings::gSettingByIndex(int i) {
return _settings[i];
}
void GameSettings::sSettingByIndex(int i, int val) {
_settings[i] = val;
}
int GameSettings::gFullscreen() {
return _settings[0];
}
void GameSettings::sFullscreen(int val) {
_settings[0] = val;
}
sf::Vector2f GameSettings::gResolution() {
return sf::Vector2f(_settings[1], _settings[2]);
}
void GameSettings::sResolution(sf::Vector2f val) {
_settings[1] = val.x;
_settings[2] = val.y;
}
int GameSettings::gAntialiasing() {
return _settings[3];
}
void GameSettings::sAntialiasing(int val) {
_settings[3] = val;
}
int GameSettings::gVSync() {
return _settings[4];
}
void GameSettings::sVSync(int val) {
_settings[4] = val;
}