mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Refactor: added Screen interface class, LevelScreen
This commit is contained in:
parent
79aa754e66
commit
fee25abb5e
11 changed files with 64 additions and 84 deletions
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue