Example #1
0
 /// <summary>Draws a ColorString comprised of ColorChars.<br></br><br></br>
 /// For example, the colorstring '0123456789ABCDEF' will render a rainbow.
 /// </summary>
 /// <param name="ColorString"></param>
 public static void DrawColorString(string ColorString)
 {
     foreach (char ColorChar in ColorString)
     {
         try { BasicRender.Draw.Block(GraphicUtils.ColorCharToConsoleColor(ColorChar)); } catch (ArgumentException) {} //only catch argument exception.
     }
 }
Example #2
0
        /// <summary>
        /// Draws a HiColorString, an example of which is '0F0-0F1-0F2', where the first character is ColorChar 1, second character is ColorChar 2, and the third character determines the gradient between the two colors
        /// </summary>
        /// <param name="HiColorString"></param>
        public static void HiColorDraw(string HiColorString)
        {
            //An example would be 0F1-0F2-1F3
            String[] HiColorRow = HiColorString.Split('-');

            foreach (String HiColorBlock in HiColorRow)
            {
                if (String.IsNullOrWhiteSpace(HiColorBlock) || HiColorBlock.Length < 3)
                {
                    BasicRender.Draw.Block(Console.BackgroundColor);
                }
                else
                {
                    ConsoleColor BG = GraphicUtils.ColorCharToConsoleColor(HiColorBlock[0]);
                    ConsoleColor FG = GraphicUtils.ColorCharToConsoleColor(HiColorBlock[1]);

                    switch (HiColorBlock[2])
                    {
                    case '0':
                        BasicRender.Draw.Sprite("░", BG, FG);
                        break;

                    case '1':
                        BasicRender.Draw.Sprite("▒", BG, FG);
                        break;

                    case '2':
                        BasicRender.Draw.Sprite("▓", BG, FG);
                        break;

                    default:
                        BasicRender.Draw.Block(Console.BackgroundColor);
                        break;
                    }
                }
            }
        }
 public BasicGraphicFromResource(string Name, byte[] Resource) : base(GraphicUtils.ResourceToStringArray(Resource), Name)
 {
 }
Example #4
0
 /// <summary>Generates a HiColorGraphic item from a Resource. Supersedes HiColorGraphicFromResource.</summary>
 public static HiColorGraphic LoadFromResource(byte[] Resource)
 {
     return(new HiColorGraphic(GraphicUtils.ResourceToStringArray(Resource), "Graphic From Resource"));
 }
Example #5
0
 /// <summary>Loads a BasicGraphic from a Resource. Supersedes BasicGraphicFromResource</summary>
 /// <param name="Resource"></param>
 /// <returns></returns>
 public static BasicGraphic LoadFromResource(byte[] Resource)
 {
     return(new BasicGraphic(GraphicUtils.ResourceToStringArray(Resource), "Graphic from Resource"));
 }