qol changes to the console

This commit is contained in:
Chris Bell 2025-01-02 16:59:26 -06:00
parent fb9f4349e9
commit 9377a5c865
2 changed files with 11 additions and 16 deletions

View File

@ -55,4 +55,6 @@ public class Game
{
_console.Draw();
}
}

View File

@ -31,11 +31,10 @@ public class RaylibCogwheelConsole : ICogwheelConsole
Write(OpeningMessage);
}
[Command(Name = "log", Description = "Logs a message to the console.")]
public void Log(string message)
{
Write(message);
WriteColor("[INFO] " + message, new Color(0, 200, 255, 255));
}
public void LogError(string message)
@ -57,8 +56,7 @@ public class RaylibCogwheelConsole : ICogwheelConsole
public void Write(string message)
{
_output += message;
// log [Color=255,0,0,255]G[/Color][Color=0,255,0,255]A[/Color][Color=0,0,255,255]Y[/Color]
_output += message + "\n";
TrimOutputBuffer();
}
@ -117,9 +115,8 @@ public class RaylibCogwheelConsole : ICogwheelConsole
if (match.Index > lastIndex)
{
ImGui.PushStyleColor(ImGuiCol.Text, new System.Numerics.Vector4(1.0f, 1.0f, 1.0f, 1.0f)); // White for normal text
ImGui.Text(line.Substring(lastIndex, match.Index - lastIndex));
ImGui.TextUnformatted(line.Substring(lastIndex, match.Index - lastIndex));
ImGui.PopStyleColor();
ImGui.SameLine(0, 0);
}
// Set the color for the text inside the color tags
@ -131,9 +128,8 @@ public class RaylibCogwheelConsole : ICogwheelConsole
);
ImGui.PushStyleColor(ImGuiCol.Text, color);
ImGui.Text(match.Groups[5].Value);
ImGui.TextUnformatted(match.Groups[5].Value);
ImGui.PopStyleColor();
ImGui.SameLine(0, 0);
lastIndex = match.Index + match.Length;
}
@ -142,10 +138,9 @@ public class RaylibCogwheelConsole : ICogwheelConsole
if (lastIndex < line.Length)
{
ImGui.PushStyleColor(ImGuiCol.Text, new System.Numerics.Vector4(1.0f, 1.0f, 1.0f, 1.0f)); // White for normal text
ImGui.Text(line.Substring(lastIndex));
ImGui.TextUnformatted(line.Substring(lastIndex));
ImGui.PopStyleColor();
}
ImGui.NewLine(); // Move to the next line after processing the current line
}
if (_scrollToBottom)
@ -175,9 +170,7 @@ public class RaylibCogwheelConsole : ICogwheelConsole
private void ProcessInput(string input)
{
_output += "\n" + "> " + input + "\n";
TrimOutputBuffer();
Write("\n" + "> " + input + "\n");
COGWHEEL.RunCommand(input);
}
@ -190,9 +183,9 @@ public class RaylibCogwheelConsole : ICogwheelConsole
}
}
[Command(Name = "test")]
[Command(Name = "warn")]
private void Test()
{
Write("[COLOR=255,0,255,255] Test command executed!");
LogWarning("This is a test warning message");
}
}