Refactor + render animation tweaks + updated frame properties + bug fixes

This commit is contained in:
2025-12-17 23:02:00 -05:00
parent b4b4fe3714
commit 119bbc4081
63 changed files with 1964 additions and 1701 deletions

View File

@@ -2,53 +2,37 @@
#include <print>
#include "filesystem_.h"
#include "sdl.h"
#include "time_.h"
using namespace anm2ed::util;
namespace anm2ed
{
void Logger::write_raw(const std::string& message)
{
std::println("{}", message);
if (file.is_open()) file << message << '\n' << std::flush;
}
void Logger::write(const Level level, const std::string& message)
{
std::string formatted = std::format("{} {} {}", time::get("(%d-%B-%Y %I:%M:%S)"), LEVEL_STRINGS[level], message);
std::println("{}", formatted);
if (file.is_open()) file << formatted << '\n' << std::flush;
write_raw(formatted);
}
void Logger::info(const std::string& message)
{
write(INFO, message);
}
void Logger::info(const std::string& message) { write(INFO, message); }
void Logger::warning(const std::string& message) { write(WARNING, message); }
void Logger::error(const std::string& message) { write(ERROR, message); }
void Logger::fatal(const std::string& message) { write(FATAL, message); }
void Logger::command(const std::string& message) { write(COMMAND, message); }
void Logger::open(const std::filesystem::path& path) { file.open(path, std::ios::out | std::ios::app); }
void Logger::warning(const std::string& message)
{
write(WARNING, message);
}
void Logger::error(const std::string& message)
{
write(ERROR, message);
}
void Logger::fatal(const std::string& message)
{
write(FATAL, message);
}
void Logger::command(const std::string& message)
{
write(COMMAND, message);
}
void Logger::open(const std::filesystem::path& path)
{
file.open(path, std::ios::out | std::ios::app);
}
std::filesystem::path Logger::path() { return sdl::preferences_directory_get() / "log.txt"; }
Logger::Logger()
{
open(filesystem::path_preferences_get() / "log.txt");
open(path());
info("Initializing Anm2Ed");
}
@@ -57,7 +41,6 @@ namespace anm2ed
info("Exiting Anm2Ed");
if (file.is_open()) file.close();
}
}
anm2ed::Logger logger;