Code refactoring.

master
Vectozavr 2021-10-17 14:27:19 +07:00
parent 813f23d655
commit f36d94183a
2 changed files with 10 additions and 6 deletions

View File

@ -12,6 +12,7 @@ namespace Consts {
const int STANDARD_SCREEN_HEIGHT = 1920; const int STANDARD_SCREEN_HEIGHT = 1920;
const sf::Color BACKGROUND_COLOR = sf::Color(255, 255, 255); const sf::Color BACKGROUND_COLOR = sf::Color(255, 255, 255);
const std::string PROJECT_NAME = "engine"; const std::string PROJECT_NAME = "engine";
const bool USE_LOG_FILE = true;
const double PI = 3.14159265358979323846264338327950288; const double PI = 3.14159265358979323846264338327950288;
const double EPS = 0.000001; const double EPS = 0.000001;

View File

@ -10,10 +10,12 @@
#include <iomanip> #include <iomanip>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include "../Consts.h"
namespace Log namespace Log
{ {
void log(const std::string& message) { void log(const std::string& message) {
if(Consts::USE_LOG_FILE) {
std::time_t const now_c = std::time(nullptr); std::time_t const now_c = std::time(nullptr);
auto dt = std::put_time(std::localtime(&now_c), "%F %T"); auto dt = std::put_time(std::localtime(&now_c), "%F %T");
@ -22,4 +24,5 @@ namespace Log
std::cout << dt << "\t" << message << " (" << Time::fps() << " fps)" << std::endl; std::cout << dt << "\t" << message << " (" << Time::fps() << " fps)" << std::endl;
file.close(); file.close();
} }
}
} }