qol changes to the console
This commit is contained in:
parent
fb9f4349e9
commit
9377a5c865
2
Game.cs
2
Game.cs
@ -55,4 +55,6 @@ public class Game
|
|||||||
{
|
{
|
||||||
_console.Draw();
|
_console.Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -31,11 +31,10 @@ public class RaylibCogwheelConsole : ICogwheelConsole
|
|||||||
|
|
||||||
Write(OpeningMessage);
|
Write(OpeningMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command(Name = "log", Description = "Logs a message to the console.")]
|
|
||||||
public void Log(string message)
|
public void Log(string message)
|
||||||
{
|
{
|
||||||
Write(message);
|
WriteColor("[INFO] " + message, new Color(0, 200, 255, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LogError(string message)
|
public void LogError(string message)
|
||||||
@ -57,8 +56,7 @@ public class RaylibCogwheelConsole : ICogwheelConsole
|
|||||||
|
|
||||||
public void Write(string message)
|
public void Write(string message)
|
||||||
{
|
{
|
||||||
_output += message;
|
_output += message + "\n";
|
||||||
// log [Color=255,0,0,255]G[/Color][Color=0,255,0,255]A[/Color][Color=0,0,255,255]Y[/Color]
|
|
||||||
TrimOutputBuffer();
|
TrimOutputBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,9 +115,8 @@ public class RaylibCogwheelConsole : ICogwheelConsole
|
|||||||
if (match.Index > lastIndex)
|
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.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.PopStyleColor();
|
||||||
ImGui.SameLine(0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the color for the text inside the color tags
|
// Set the color for the text inside the color tags
|
||||||
@ -131,9 +128,8 @@ public class RaylibCogwheelConsole : ICogwheelConsole
|
|||||||
);
|
);
|
||||||
|
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, color);
|
ImGui.PushStyleColor(ImGuiCol.Text, color);
|
||||||
ImGui.Text(match.Groups[5].Value);
|
ImGui.TextUnformatted(match.Groups[5].Value);
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
ImGui.SameLine(0, 0);
|
|
||||||
|
|
||||||
lastIndex = match.Index + match.Length;
|
lastIndex = match.Index + match.Length;
|
||||||
}
|
}
|
||||||
@ -142,10 +138,9 @@ public class RaylibCogwheelConsole : ICogwheelConsole
|
|||||||
if (lastIndex < line.Length)
|
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.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.PopStyleColor();
|
||||||
}
|
}
|
||||||
ImGui.NewLine(); // Move to the next line after processing the current line
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_scrollToBottom)
|
if (_scrollToBottom)
|
||||||
@ -175,9 +170,7 @@ public class RaylibCogwheelConsole : ICogwheelConsole
|
|||||||
|
|
||||||
private void ProcessInput(string input)
|
private void ProcessInput(string input)
|
||||||
{
|
{
|
||||||
_output += "\n" + "> " + input + "\n";
|
Write("\n" + "> " + input + "\n");
|
||||||
TrimOutputBuffer();
|
|
||||||
|
|
||||||
COGWHEEL.RunCommand(input);
|
COGWHEEL.RunCommand(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,9 +183,9 @@ public class RaylibCogwheelConsole : ICogwheelConsole
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command(Name = "test")]
|
[Command(Name = "warn")]
|
||||||
private void Test()
|
private void Test()
|
||||||
{
|
{
|
||||||
Write("[COLOR=255,0,255,255] Test command executed!");
|
LogWarning("This is a test warning message");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user