mirror of
https://github.com/open-goal/jak-project
synced 2026-08-21 14:54:53 -04:00
game: Migrate from GLFW to SDL2 & attempt to rewrite / simplify display and input code (#2397)
Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/util/BinaryReader.h"
|
||||
#include "common/util/string_util.h"
|
||||
#include "common/util/unicode_util.h"
|
||||
|
||||
// This disables the use of PCLMULQDQ which is probably ok, but let's just be safe and disable it
|
||||
@@ -201,10 +202,12 @@ bool create_dir_if_needed(const fs::path& path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO - explodes if the file path is invalid
|
||||
bool create_dir_if_needed_for_file(const std::string& path) {
|
||||
return create_dir_if_needed_for_file(fs::path(path));
|
||||
}
|
||||
|
||||
// TODO - explodes if the file path is invalid
|
||||
bool create_dir_if_needed_for_file(const fs::path& path) {
|
||||
return fs::create_directories(path.parent_path());
|
||||
}
|
||||
@@ -636,4 +639,18 @@ void copy_file(const fs::path& src, const fs::path& dst) {
|
||||
fs::copy_file(src, dst, fs::copy_options::overwrite_existing);
|
||||
}
|
||||
|
||||
std::string make_screenshot_filepath(const GameVersion game_version, const std::string& name) {
|
||||
std::string file_name;
|
||||
if (name.empty()) {
|
||||
file_name = fmt::format("{}_{}.png", version_to_game_name(game_version),
|
||||
str_util::current_local_timestamp_no_colons());
|
||||
} else {
|
||||
file_name = fmt::format("{}_{}_{}.png", version_to_game_name(game_version), name,
|
||||
str_util::current_local_timestamp_no_colons());
|
||||
}
|
||||
const auto file_path = file_util::get_file_path({"screenshots", file_name});
|
||||
file_util::create_dir_if_needed_for_file(file_path);
|
||||
return file_path;
|
||||
}
|
||||
|
||||
} // namespace file_util
|
||||
|
||||
Reference in New Issue
Block a user