|
@@ -116,17 +116,14 @@ namespace NTERA.Engine.Runtime.Base
|
|
|
runtime.Console.Alignment = alignmentValue;
|
|
|
}
|
|
|
|
|
|
- [Keyword("SETCOLOR")]
|
|
|
- public static void SetColor(EraRuntime runtime, StackFrame context, ExecutionNode node)
|
|
|
+ private static Color ParseColorArguments(EraRuntime runtime, StackFrame context, ExecutionNode node)
|
|
|
{
|
|
|
if (node.SubNodes.Length == 1)
|
|
|
{
|
|
|
uint argb = (uint)runtime.ComputeExpression(context, node[0]).Real;
|
|
|
argb |= 0xFF000000U;
|
|
|
|
|
|
- Color c = Color.FromArgb((int)argb);
|
|
|
-
|
|
|
- runtime.Console.SetStringStyle(c);
|
|
|
+ return Color.FromArgb((int)argb);
|
|
|
}
|
|
|
else if (node.SubNodes.Length == 3)
|
|
|
{
|
|
@@ -134,18 +131,37 @@ namespace NTERA.Engine.Runtime.Base
|
|
|
int g = (int)runtime.ComputeExpression(context, node[1]).Real;
|
|
|
int b = (int)runtime.ComputeExpression(context, node[2]).Real;
|
|
|
|
|
|
- runtime.Console.SetStringStyle(Color.FromArgb(r, g, b));
|
|
|
+ return Color.FromArgb(r, g, b);
|
|
|
}
|
|
|
else
|
|
|
throw new EraRuntimeException("Unable to parse color");
|
|
|
}
|
|
|
|
|
|
+ [Keyword("SETCOLOR")]
|
|
|
+ public static void SetColor(EraRuntime runtime, StackFrame context, ExecutionNode node)
|
|
|
+ {
|
|
|
+ runtime.Console.SetStringStyle(ParseColorArguments(runtime, context, node));
|
|
|
+ }
|
|
|
+
|
|
|
[Keyword("RESETCOLOR")]
|
|
|
public static void ResetColor(EraRuntime runtime, StackFrame context, ExecutionNode node)
|
|
|
{
|
|
|
runtime.Console.ResetStyle();
|
|
|
}
|
|
|
|
|
|
+ [Keyword("SETBGCOLOR")]
|
|
|
+ public static void SetBgColor(EraRuntime runtime, StackFrame context, ExecutionNode node)
|
|
|
+ {
|
|
|
+
|
|
|
+ runtime.Console.SetBgColor(ParseColorArguments(runtime, context, node));
|
|
|
+ }
|
|
|
+
|
|
|
+ [Keyword("RESETBGCOLOR")]
|
|
|
+ public static void ResetBgColor(EraRuntime runtime, StackFrame context, ExecutionNode node)
|
|
|
+ {
|
|
|
+ runtime.Console.SetBgColor(Color.Black);
|
|
|
+ }
|
|
|
+
|
|
|
[Keyword("CLEARLINE")]
|
|
|
public static void ClearLine(EraRuntime runtime, StackFrame context, ExecutionNode node)
|
|
|
{
|
|
@@ -215,4 +231,4 @@ namespace NTERA.Engine.Runtime.Base
|
|
|
runtime.Console.PrintSingleLine(value.ToString());
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|