Refactor: added Screen interface class, LevelScreen

This commit is contained in:
MihailRis
2023-11-15 21:18:10 +03:00
parent 79aa754e66
commit fee25abb5e
11 changed files with 64 additions and 84 deletions
-25
View File
@@ -8,7 +8,6 @@
#include "../typedefs.h"
#define SETTINGS_FILE "settings.toml"
#define SCREENSHOTS_FOLDER "screenshots"
using std::string;
@@ -17,30 +16,6 @@ string platform::get_settings_file() {
return SETTINGS_FILE;
}
string platform::get_screenshot_file(string ext) {
std::string folder = SCREENSHOTS_FOLDER;
if (!std::filesystem::is_directory(folder)) {
std::filesystem::create_directory(folder);
}
auto t = std::time(nullptr);
auto tm = *std::localtime(&t);
const char* format = "%d-%m-%Y_%H-%M-%S";
std::stringstream ss;
ss << std::put_time(&tm, format);
string datetimestr = ss.str();
string filename = folder+"/screenshot-"+datetimestr+"."+ext;
uint index = 0;
while (std::filesystem::exists(filename)) {
filename = folder+"/screenshot-"+datetimestr+"-"+std::to_string(index)+"."+ext;
index++;
}
return filename;
}
#ifdef WIN32
#include <Windows.h>
-1
View File
@@ -6,7 +6,6 @@
namespace platform {
extern void configure_encoding();
extern std::string get_settings_file();
extern std::string get_screenshot_file(std::string ext);
}
#endif // UTIL_PLATFORM_H_