Skip to content

Commit

Permalink
removed color codes from console (was not portable)
Browse files Browse the repository at this point in the history
  • Loading branch information
GoosiferIO committed Feb 7, 2024
1 parent 1ac163f commit aa8e52b
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions EmuAPI/emu/EmuConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ HWND EmuConsole::createConsole()
}
}

std::cout << "\x1B[48;5;22m"; // background color
std::cout << "Welcome to the EMU command console.\nAuthor: Eric \"Goosifer\" Galvan.\nSpecial thanks to: Finn, wowjinxy, Jay\n\nPlease enter your command below. Enter 'help' for a list of commands, or 'exit' to exit." << std::endl << std::endl;
std::cout << "\x1B[0m"; // reset color
std::cout << ""; // reset color
return consoleWindow;
}

Expand All @@ -117,7 +116,7 @@ void EmuConsole::tokenize(bool& CommandIsProcessing)
if (token.size() > 100)
{
// this limit will be increased, it's just a pre-emptive measure
std::cout << "\x1B[31mErr: Command too long.\x1B[0m" << std::endl;
std::cout << "Err: Command too long." << std::endl;
CommandIsProcessing = false;
// std::cin.ignore(32767, '\n');
} else {
Expand All @@ -134,7 +133,7 @@ void EmuConsole::tokenize(bool& CommandIsProcessing)

std::string EmuConsole::HelpDefinition(std::string command, std::string definition)
{
std::string help = "\x1B[32m" + command + "\x1B[37m - " + definition;
std::string help = command + " - " + definition;
return help;
}

Expand All @@ -155,7 +154,7 @@ void EmuConsole::processInput(bool& IsConsoleRunning)
}
if (tokens[0] == "help")
{
std::cout << "==== \x1B[90mCommands\x1B[0m ====" << std::endl << std::endl;
std::cout << "==== Commands ====" << std::endl << std::endl;
std::cout << HelpDefinition("addtobudget <amount>", "Adds <amount> to the zoo budget.") << std::endl;
std::cout << HelpDefinition("getbudget", "Returns the current zoo budget.") << std::endl;
std::cout << HelpDefinition("setbudget <amount>", "Sets the zoo budget to <amount>.") << std::endl;
Expand Down Expand Up @@ -187,7 +186,7 @@ void EmuConsole::processInput(bool& IsConsoleRunning)
std::cout << HelpDefinition("exit", "Exits the console.") << std::endl;
std::cout << HelpDefinition("help", "Displays this help menu.") << std::endl;

std::cout << "\x1B[0m";
std::cout << "";

}
else if (ZooState::IsZooLoaded())
Expand All @@ -197,7 +196,7 @@ void EmuConsole::processInput(bool& IsConsoleRunning)
{
if (tokens.size() < 2)
{
std::cout << "\x1B[31mErr: Command <" << tokens[0] << "> requires an amount.\x1B[0m" << std::endl;
std::cout << "Err: Command <" << tokens[0] << "> requires an amount." << std::endl;
return;
}
// add to budget hook
Expand All @@ -214,7 +213,7 @@ void EmuConsole::processInput(bool& IsConsoleRunning)
{
if (tokens.size() < 2)
{
std::cout << "\x1B[31mErr: Command <" << tokens[0] << "> requires an amount.\x1B[0m" << std::endl;
std::cout << "Err: Command <" << tokens[0] << "> requires an amount." << std::endl;
return;
}
// sets the budget
Expand Down Expand Up @@ -281,7 +280,7 @@ void EmuConsole::processInput(bool& IsConsoleRunning)
{
if (tokens.size() < 2)
{
std::cout << "\x1B[31mErr: Command <" << tokens[0] << "> requires an amount.\x1B[0m" << std::endl;
std::cout << "Err: Command <" << tokens[0] << "> requires an amount." << std::endl;
return;
}
// sets the admissions cost
Expand Down Expand Up @@ -377,7 +376,7 @@ void EmuConsole::processInput(bool& IsConsoleRunning)
{
if (tokens.size() < 2)
{
std::cout << "\x1B[31mErr: Command <" << tokens[0] << "> requires a rating.\x1B[0m" << std::endl;
std::cout << "Err: Command <" << tokens[0] << "> requires a rating." << std::endl;
return;
}
// sets the zoo rating
Expand All @@ -387,7 +386,7 @@ void EmuConsole::processInput(bool& IsConsoleRunning)
{
if (tokens.size() < 2)
{
std::cout << "\x1B[31mErr: Command <" << tokens[0] << "> requires a rating.\x1B[0m" << std::endl;
std::cout << "Err: Command <" << tokens[0] << "> requires a rating." << std::endl;
return;
}
// sets the guest rating
Expand All @@ -397,7 +396,7 @@ void EmuConsole::processInput(bool& IsConsoleRunning)
{
if (tokens.size() < 2)
{
std::cout << "\x1B[31mErr: Command <" << tokens[0] << "> requires a rating.\x1B[0m" << std::endl;
std::cout << "Err: Command <" << tokens[0] << "> requires a rating." << std::endl;
return;
}
// sets the animal rating
Expand All @@ -407,7 +406,7 @@ void EmuConsole::processInput(bool& IsConsoleRunning)
{
if (tokens.size() < 2)
{
std::cout << "\x1B[31mErr: Command <" << tokens[0] << "> requires a boolean.\x1B[0m" << std::endl;
std::cout << "Err: Command <" << tokens[0] << "> requires a boolean." << std::endl;
return;
}
// enable dev mode
Expand All @@ -421,17 +420,17 @@ void EmuConsole::processInput(bool& IsConsoleRunning)
}
else
{
std::cout << "\x1B[31mErr: Command <" << tokens[0] << "> requires a boolean.\x1B[0m" << std::endl;
std::cout << "Err: Command <" << tokens[0] << "> requires a boolean." << std::endl;
}
}
else
{
std::cout << "\x1B[31mErr: Command <" << tokens[0] << "> does not exist.\x1B[0m" << std::endl;
std::cout << "Err: Command <" << tokens[0] << "> does not exist." << std::endl;
}
}
else
{
std::cout << "\x1B[31mErr: Not able to execute command until zoo has been loaded.\x1B[0m" << std::endl;
std::cout << "Err: Not able to execute command until zoo has been loaded." << std::endl;
}

// tokens.clear();
Expand Down

0 comments on commit aa8e52b

Please sign in to comment.