Check game config before writing or reading it
This commit is contained in:
parent
b700ed3111
commit
e010cb356b
1 changed files with 4 additions and 0 deletions
|
@ -47,6 +47,8 @@ int toInt(const std::string &str) {
|
|||
|
||||
void readConfig() {
|
||||
std::ifstream file("config.txt");
|
||||
if(!file)
|
||||
return;
|
||||
|
||||
std::string line;
|
||||
while(std::getline(file, line)) {
|
||||
|
@ -72,6 +74,8 @@ void readConfig() {
|
|||
|
||||
void writeConfig() {
|
||||
std::ofstream file("config.txt");
|
||||
if(!file)
|
||||
return;
|
||||
|
||||
int x, y;
|
||||
SDL_GetWindowPosition(window, &x, &y);
|
||||
|
|
Reference in a new issue