Changed to use concepts instead of static_assert

This commit is contained in:
Pasha Bibko
2025-05-07 19:43:09 +01:00
parent 98fc4589ab
commit c472cb5fc5
11 changed files with 65 additions and 47 deletions

View File

@@ -34,9 +34,9 @@ namespace LX
void InvalidFilePath::PrintToConsole() const
{
// Tells the user the input file could not be found and how to fix the issue //
LX::PrintStringAsColor("Error: ", LX::Color::LIGHT_RED);
LX::PrintAsColor<Color::LIGHT_RED>("Error: ");
std::cout << "Invalid " << name << ": ";
LX::PrintStringAsColor(fileLocation, LX::Color::WHITE);
LX::PrintAsColor<Color::WHITE>(fileLocation);
std::cout << "\n\nMake sure the file exists and the process has the correct path to the file\n";
}

View File

@@ -1,19 +0,0 @@
#include <LX-Common.h>
namespace LX
{
void PrintStringAsColor(const std::string& str, Color c)
{
// Gets a handle to the console //
static HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// Sets the color of the console to the desired color //
SetConsoleTextAttribute(hConsole, (WORD)c);
// Outputs the text //
std::cout << str;
// Resets the color //
SetConsoleTextAttribute(hConsole, (WORD)Color::LIGHT_GRAY);
}
}