-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Persist window resolution and fullscreen preferences
- Loading branch information
1 parent
37ef894
commit b2df3aa
Showing
12 changed files
with
88 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef CONFIG_H | ||
#define CONFIG_H | ||
|
||
#include <string> | ||
|
||
#define RES_FOLDER string("res/") | ||
|
||
using std::string; | ||
|
||
class Config{ | ||
public: | ||
static void init(); | ||
static int get_width(); | ||
static int get_height(); | ||
static int is_fullscreen(); | ||
static void update_information(int cwidth, int cheight, int cfullscreen); | ||
|
||
private: | ||
static int width; | ||
static int height; | ||
static int fullscreen; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1024 768 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "Config.h" | ||
|
||
#include <fstream> | ||
|
||
int Config::width; | ||
int Config::height; | ||
int Config::fullscreen; | ||
|
||
void Config::init(){ | ||
std::fstream config_file(RES_FOLDER + "config_file.dat"); | ||
config_file >> width >> height >> fullscreen; | ||
} | ||
|
||
int Config::get_width(){ | ||
return width; | ||
} | ||
|
||
int Config::get_height(){ | ||
return height; | ||
} | ||
|
||
int Config::is_fullscreen(){ | ||
return fullscreen; | ||
} | ||
|
||
void Config::update_information(int cwidth, int cheight, int cfullscreen){ | ||
width = cwidth; | ||
height = cheight; | ||
fullscreen = cfullscreen; | ||
std::ofstream config_file(RES_FOLDER + "config_file.dat", std::ios::trunc); | ||
config_file << width << " " << height << " " << fullscreen << std::endl; | ||
config_file.close(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters