Ejemplo n.º 1
0
        public bool Render(IRenderable[] objects)
        {
            for (int i = 0; i < objects.Length; i++)
            {
                if (!(objects[i].GetGraphic() is AsciiRenderData))
                {
                    continue;                                                // Incorrect render data, continue.
                }
                AsciiRenderData data = (AsciiRenderData)objects[i].GetGraphic();

                if (data.x - camera.x + Console.BufferWidth / 2 < 0 || data.x - camera.x + Console.BufferWidth / 2 >= Console.BufferWidth || data.y - camera.y + Console.BufferHeight / 2 < 0 || data.y - camera.y + Console.BufferHeight / 2 >= Console.BufferHeight)
                {
                    continue;
                }
                // Console.SetCursorPosition();
                // Console.ForegroundColor = data.fg;
                // Console.BackgroundColor = data.bg;
                // Console.Write(data.glyph[0,0]);

                buf.Draw("" + data.glyph[0, 0], (int)(data.x + Console.BufferWidth / 2 - camera.x), (int)(data.y + Console.BufferHeight / 2 + camera.y), (short)((short)data.fg + ((short)data.bg << 4)));
            }

            buf.Print();
            buf.Clear();

            return(true);
        }
Ejemplo n.º 2
0
 public AsciiRenderable(ConsoleColor fg, ConsoleColor bg, float x, float y, char[,] glyph)
 {
     data = new AsciiRenderData(fg, bg, x, y, glyph);
 }