public void Render(ref String[] Document, Boolean Partial) { //Draw the stored graphic if (!Partial) { int X = 1; foreach (String Line in Document) { RenderUtils.SetPos(0, X); HiColorGraphic.HiColorDraw(Line); X++; } } //Draw the color wheel RenderUtils.SetPos(Console.WindowWidth - ColorWheel.Split('-').Length - 4, Console.WindowHeight - 2); HiColorGraphic.HiColorDraw(ColorString + "-000-" + ColorWheel); ConsoleColor PickerColor; if (CustomColor) { PickerColor = ConsoleColor.Red; } else { PickerColor = ConsoleColor.DarkRed; } Draw.Row(ConsoleColor.Black, ColorWheel.Split('-').Length, Console.WindowWidth - ColorWheel.Split('-').Length - 2, Console.WindowHeight - 1); Draw.Block(PickerColor, Console.WindowWidth - ColorWheel.Split('-').Length - 2 + CurrentColorWheelPosition, Console.WindowHeight - 1); Draw.Sprite("Use PGUP/PGDOWN to change colors, C to open the\nold color editor, K to pick color, and SPACE to draw.", ConsoleColor.Black, ConsoleColor.White, 0, Console.WindowHeight - 2); }
public override KeyPressReturn Action() { //Launch the showcase RenderUtils.Color(ConsoleColor.Black, ConsoleColor.Gray); Console.Clear(); RenderUtils.Echo("Hello!", true); RenderUtils.Sleep(3000); RenderUtils.Type("...", 500); RenderUtils.Sleep(2000); RenderUtils.Type("Hello?\n", 30); RenderUtils.Sleep(1000); RenderUtils.Echo("It is cloudy: \n\n", true); new Cloud().Draw(Console.CursorLeft, Console.CursorTop); RenderUtils.Sleep(3000); RenderUtils.Type("\n\nCool I didn't care\n", 30); RenderUtils.Sleep(1000); Draw.Sprite("H o w d a r e y o u", ConsoleColor.Black, ConsoleColor.Red); RenderUtils.Sleep(5000); Console.Clear(); RenderUtils.Sleep(3000); Graphic Landscape = BasicGraphic.LoadFromResource(Resources.Landscape); Landscape.Draw(0, 0); RenderUtils.Sleep(5000); Graphic TextBox = HiColorGraphic.LoadFromResource(Resources.Textbox); TextBox.Draw(Landscape.GetWidth() - TextBox.GetWidth() - 2, 2); RenderUtils.Color(ConsoleColor.Gray, ConsoleColor.Black); RenderUtils.SetPos(Landscape.GetWidth() - TextBox.GetWidth() - 2 + 6, 2); RenderUtils.Type("And so the man died."); RenderUtils.Sleep(3000); RenderUtils.SetPos(Landscape.GetWidth() - TextBox.GetWidth() - 2 + 6, 3); RenderUtils.Type(" t h e e n d ", 100); RenderUtils.Sleep(5000); RenderUtils.Color(ConsoleColor.DarkCyan, ConsoleColor.White); Console.Clear(); Parent.Redraw(); return(KeyPressReturn.NOTHING); }
/// <summary>Shows the BasicRender SplashScreen (which also shows the logo)</summary> static void BasicRenderSplash() { RenderUtils.Color(ConsoleColor.DarkGray, ConsoleColor.White); Console.Clear(); Graphic Rainbow = HiColorGraphic.LoadFromResource(Resources.Rainbow); Draw.Box(ConsoleColor.Black, Rainbow.GetWidth(), Rainbow.GetHeight() - 1, 19, 11); Rainbow.Draw(17, 10); Draw.CenterText("BasicRender", 12, ConsoleColor.White, ConsoleColor.Black); Draw.CenterText("P r e s s a k e y", 20, ConsoleColor.DarkGray, ConsoleColor.White); }
public void KeyPress(ref string[] Document, int X, int Y, ConsoleKeyInfo Key) { switch (Key.Key) { case ConsoleKey.PageUp: //Move up in the color wheel CurrentColorWheelPosition++; break; case ConsoleKey.PageDown: //Move down in the color wheel CurrentColorWheelPosition--; break; case ConsoleKey.K: //Pick Color ColorString = Document[Y].Split('-')[X]; CustomColor = true; break; case ConsoleKey.C: HiColorPicker Picker = new HiColorPicker(); Picker.Execute(); if (Picker.OK()) { ColorString = Picker.GetResultColorString(); CustomColor = true; } Render(ref Document, false); break; case ConsoleKey.Spacebar: //Replace the text at that position string[] Line = Document[Y].Split('-'); Line[X] = ColorString; Document[Y] = String.Join("-", Line); HiColorGraphic.HiColorDraw(ColorString); break; default: return; } Render(ref Document, true); }
/// <summary>Starts a bouncy ball</summary> /// <param name="args"></param> public static void Main(string[] args) { BasicBall Ball = new BasicBall { XSpeed = 3, BallGraphic = new BasicGraphic(squareball3x3, "SquareBall 3x3"), Bounciness = 0.9, Gravity = 0.5 }; //default settings bool ShowInfo = true; int FPS = 20; bool StopOnZero = false; string ErrorString = ""; foreach (string arg in args) { try { //split string[] SplitArg = arg.Split('='); if (SplitArg.Length < 2) { continue; } //Parse switch (SplitArg[0].ToUpper()) { case "/GRAPHIC": if (SplitArg[1].ToUpper().EndsWith(".DF")) { Ball.BallGraphic = BasicGraphic.LoadFromFile(SplitArg[1]); } if (SplitArg[1].ToUpper().EndsWith(".HC")) { Ball.BallGraphic = HiColorGraphic.LoadFromFile(SplitArg[1]); } break; case "/X": Ball.X = double.Parse(SplitArg[1]); break; case "/Y": Ball.Y = double.Parse(SplitArg[1]); break; case "/XSPEED": Ball.XSpeed = double.Parse(SplitArg[1]); break; case "/YSPEED": Ball.YSpeed = double.Parse(SplitArg[1]); break; case "/SPEED": //ok Speed is going to be formatted like: VEL:ANG (IE: 10:30 is 10 speed units at 30 degrees up string[] splitsplitarg = SplitArg[1].Split(':'); double Vel = double.Parse(splitsplitarg[0]); double Ang = double.Parse(splitsplitarg[1]) * (Math.PI / 180); Ball.XSpeed = Vel * Math.Cos(Ang); Ball.YSpeed = -1 * Vel * Math.Sin(Ang); //negative since positive is *down* break; case "/BOUNCE": case "/BOUNCINESS": Ball.Bounciness = double.Parse(SplitArg[1]); break; case "/GRAV": case "/GRAVITY": Ball.Gravity = double.Parse(SplitArg[1]); break; case "/FPS": FPS = int.Parse(SplitArg[1]); break; case "/SHOWINFO": ShowInfo = bool.Parse(SplitArg[1]); break; case "/STOPONZERO": StopOnZero = bool.Parse(SplitArg[1]); break; default: break; } } catch (FormatException) { ErrorString += "\nCould not parse parameter for " + arg; } catch (FileNotFoundException) { ErrorString += "\nCould not find file for " + arg; } catch (IndexOutOfRangeException) { ErrorString += "\nNo Parameter for " + arg; } } if (!string.IsNullOrWhiteSpace(ErrorString)) { RenderUtils.Echo("\nErrors occurred while parsing parameters:\n" + ErrorString + "\n\nPress CTRL+C to stop execution, or any other key to continue."); RenderUtils.Pause(); Console.Clear(); } BallRenderer(Ball, ShowInfo, FPS, StopOnZero); }
public override void DrawPixel(string ColorString) { HiColorGraphic.HiColorDraw(ColorString); }