示例#1
0
        private int StretchTestQueue(bool applyColor)
        {
            Surface surf   = new Surface("jellybean.png");
            int     frames = 0;

            surf.Color = Color.White;
            double count = 1;

            for (frames = 0; frames < totalFrames; frames++)
            {
                if (Display.CurrentWindow.IsClosed)
                {
                    return(frames);
                }

                count = 1 + Math.Cos(frames / 60.0);

                Display.BeginFrame();


                for (int i = 0; i < 15; i++)
                {
                    surf.SetScale(1.0, 1.0);
                    surf.Color = Color.White;
                    surf.Draw(10, 10);

                    if (applyColor)
                    {
                        surf.Color = Color.Orange;
                    }

                    surf.SetScale(1.5, 1.5);
                    surf.Draw(120, 10);

                    if (applyColor)
                    {
                        surf.Color = Color.LightGreen;
                    }

                    surf.SetScale(count, 1.25);
                    surf.Draw(10, 100);

                    if (applyColor)
                    {
                        surf.Color = Color.LightCoral;
                    }

                    surf.SetScale(0.5 + count / 2, 0.5 + count / 2);
                    surf.Draw((int)(150 + 40 * Math.Cos(frames / 70.0)),
                              (int)(120 + 40 * Math.Sin(frames / 70.0)));

                    font.DrawText(string.Format("{0} frames per second.", Math.Round(Display.FramesPerSecond, 2)));
                }

                Display.EndFrame();
                Core.KeepAlive();
            }

            return(frames);
        }
示例#2
0
        private void DrawScore()
        {
            int x = playAreaWidth + borderSize * 3 / 2;
            int y = borderSize * 2;

            font.DrawText(x, y, "Score");

            for (int i = 0; i < 2; i++)
            {
                y += font.StringDisplayHeight("M") * 2;
                font.DrawText(x, y, names[i]);

                y += font.StringDisplayHeight("M");
                font.DrawText(x, y, score[i].ToString());
            }
        }
示例#3
0
        public void Run(string[] args)
        {
            using (var wind = new DisplayWindowBuilder(args)
                              .BackbufferSize(800, 600)
                              .QuitOnClose()
                              .Build())
            {
                Input.Unhandled.KeyDown += Keyboard_KeyDown;

                FontState state = new FontState
                {
                    Size  = 14,
                    Style = FontStyles.None,
                };

                FontSurface font = Font.AgateSans.Core.FontSurface(state);

                FontSurface unkerned = ConstructUnkernedFont(font);

                string text = ConstructKerningText(wind, font);

                while (AgateApp.IsAlive)
                {
                    Display.BeginFrame();
                    Display.Clear();

                    FontSurface thisFont = useKerning ? font : unkerned;

                    if (useKerning)
                    {
                        thisFont.DrawText(state, "Using kerning. (space to toggle)");
                    }
                    else
                    {
                        thisFont.DrawText(state, "No kerning used. (space to toggle)");
                    }

                    state.Color = Color.White;
                    thisFont.DrawText(state, new Vector2(0, thisFont.FontHeight(state)), text);

                    Display.EndFrame();
                    AgateApp.KeepAlive();
                }
            }
        }
示例#4
0
 public void DebugPrint(int x, int y, string debugText)
 {
     if (debugFontSurface == null)
     {
         debugFontSurface       = new FontSurface("Arial", 12);
         debugFontSurface.Color = Color.Black;
     }
     debugFontSurface.DrawText(destX: x, destY: y, text: debugText);
 }
示例#5
0
        private void FontTests(FontSurface fontSurface, out Rectangle drawRect)
        {
            Point drawPoint = new Point(10, 10);
            Size  fontsize  = fontSurface.StringDisplaySize(text);

            drawRect = new Rectangle(drawPoint, fontsize);

            fontSurface.DrawText(drawPoint, text);
        }
示例#6
0
        private void DrawText()
        {
            if (font == null)
            {
                return;
            }

            font.Color = DisplayColor;
            font.DrawText(Text);
        }
示例#7
0
        public void Show()
        {
            string tx = mandrillDict['┌'].ToString();

            tx  = tx.PadRight(maxWidth - 1, mandrillDict['─']);
            tx += mandrillDict['┐'];
            //            for (int i = 1; i < maxWidth - 1; i++)
            //              tx += mandrillDict['─'];

            font.DrawText(10.0, font.FontHeight * 1, tx);
            font.DrawText(10.0, font.FontHeight * 2, mandrillDict['│'] + currentScreen.title.PadRight(maxWidth - 2, ' ') + mandrillDict['│']);

            tx  = mandrillDict['├'].ToString();
            tx  = tx.PadRight(maxWidth - 1, mandrillDict['─']);
            tx += mandrillDict['┤'];
            font.DrawText(10.0, font.FontHeight * 3, tx);
            for (int i = 0; i < currentScreen.menu.Count; i++)
            {
                font.DrawText(10.0, font.FontHeight * (4 + i), "" + mandrillDict['│']);
                if (i == currentScreen.currentMenuItem)
                {
                    if (currentScreen.menu[i].enabled)
                    {
                        font.Color = Color.Red;
                    }
                    else
                    {
                        font.Color = Color.Gray;
                    }
                    font.DrawText(16.0, font.FontHeight * (4 + i), "> " + currentScreen.menu[i].text.PadRight(maxWidth - 4, ' '));
                }
                else
                {
                    if (currentScreen.menu[i].enabled)
                    {
                        font.Color = Color.White;
                    }
                    else
                    {
                        font.Color = Color.Gray;
                    }
                    font.DrawText(16.0, font.FontHeight * (4 + i), currentScreen.menu[i].text.PadRight(maxWidth - 2, ' '));
                }
                font.Color = Color.White;
                font.DrawText(10.0 + 6.0 * (maxWidth - 1), font.FontHeight * (4 + i), "" + mandrillDict['│']);
            }

            tx  = mandrillDict['└'].ToString();
            tx  = tx.PadRight(maxWidth - 1, mandrillDict['─']);
            tx += mandrillDict['┘'];
            font.DrawText(10.0, font.FontHeight * (4 + currentScreen.menu.Count), tx);
        }
示例#8
0
        /// <summary>
        /// Override this method to render your game.
        ///  Do not call Display.BeginFrame or Display.EndFrame.
        /// </summary>
        /// <remarks>Do not call Display.BeginFrame or Display.EndFrame or change
        /// render targets in this method.</remarks>
        protected virtual void Render()
        {
            RenderSplashScreen();

            if (splashFadeDone)
            {
                Surface powered = InternalResources.Data.PoweredBy;
                Size    size    = powered.SurfaceSize;

                int bottom = MainWindow.Height - size.Height;
                int h      = font.FontHeight;

                font.DisplayAlignment = OriginAlignment.BottomLeft;
                font.Color            = Color.Black;

                font.DrawText(0, bottom - 2 * h, "Welcome to AgateLib.");
                font.DrawText(0, bottom - h, "Your application framework is ready.");
                font.DrawText(0, bottom, "Override the Render method in order to do your own drawing.");
            }
        }
示例#9
0
        protected override void Render()
        {
            Display.Clear(Color.Blue);

            surf.InterpolationHint = InterpolationMode.Fastest;
            surf.Draw(10, 10);

            font.DrawText(10, 500, "Chonky chonk chonk");

            surf2.InterpolationHint = InterpolationMode.Fastest;
            surf2.Draw(500, 10);
        }
示例#10
0
        public void Main(string[] args)
        {
            using (AgateSetup setup = new AgateSetup(args))
            {
                setup.AskUser = true;
                setup.Initialize(true, false, false);
                if (setup.WasCanceled)
                {
                    return;
                }

                DisplayWindow wind = DisplayWindow.CreateWindowed(
                    "Bitmap Font Tester", 800, 600, false);

                Display.BeginFrame();
                Display.Clear(Color.Navy);
                Display.EndFrame();
                Core.KeepAlive();

                BitmapFontOptions fontOptions = new BitmapFontOptions("Times", 18, FontStyle.Bold);
                fontOptions.UseTextRenderer = true;

                FontSurface font = new FontSurface(fontOptions);

                // TODO: Fix this
                //font.Save("testfont.xml");


                //FontSurface second = FontSurface.LoadBitmapFont("testfont.png", "testfont.xml");

                while (wind.IsClosed == false)
                {
                    Display.BeginFrame();
                    Display.Clear(Color.Navy);

                    font.DrawText("The quick brown fox jumps over the lazy dog.");

                    //second.DrawText(0, font.StringDisplayHeight("M"), "The quick brown fox jumps over the lazy dog.");

                    Display.EndFrame();
                    Core.KeepAlive();
                }
            }
        }
示例#11
0
        public void Main(string[] args)
        {
            using (AgateSetup setup = new AgateSetup("Resource Tester", args))
            {
                setup.InitializeAll();
                if (setup.WasCanceled)
                {
                    return;
                }

                AgateFileProvider.Resources.Add(new AgateLib.Utility.FileSystemProvider("Data"));

                AgateResourceCollection resources = new AgateResourceCollection("TestResourceFile.xml");

                DisplayWindow wind   = new DisplayWindow(resources, "main_window");
                Surface       surf   = new Surface(resources, "sample_surf");
                ISprite       sprite = new Sprite(resources, "sample_sprite");
                FontSurface   font   = new FontSurface(resources, "sample_font");

                sprite.StartAnimation();

                while (wind.IsClosed == false)
                {
                    Display.BeginFrame();
                    Display.Clear(Color.Red);

                    font.DrawText(0, 0, "FPS: " + Display.FramesPerSecond.ToString());

                    surf.Draw(20, 20);

                    sprite.Update();
                    sprite.Draw(100, 100);

                    Display.EndFrame();
                    Core.KeepAlive();
                }
            }
        }
示例#12
0
        public void Main(string[] args)
        {
            using (AgateSetup setupDisplay = new AgateSetup())
            {
                setupDisplay.AskUser = true;
                setupDisplay.Initialize(true, false, false);

                if (setupDisplay.WasCanceled)
                {
                    return;
                }

                DisplayWindow wind = DisplayWindow.CreateWindowed("Font Tester", 800, 600);

                FontSurface font       = new FontSurface("Sans Serif", 12);
                FontSurface bitmapFont = FontSurface.BitmapMonospace("lotafont.png", new Size(16, 16));

                int frame = 0;


                while (wind.IsClosed == false)
                {
                    Display.BeginFrame();
                    Display.Clear(Color.DarkGray);


                    // test the color changing
                    font.Color = Color.LightGreen;
                    font.DrawText(20, 150, "This is regular green text.");
                    font.Color = Color.White;

                    // test display alignment property
                    Point  textPoint = new Point(100, 50);
                    string text      = string.Format("This text is centered on {0},{1}.", textPoint.X, textPoint.Y);
                    Size   textSize  = font.StringDisplaySize(text);

                    // draw a box around where the text should be displayed.
                    Display.DrawRect(new Rectangle(textPoint.X - textSize.Width / 2, textPoint.Y - textSize.Height / 2,
                                                   textSize.Width, textSize.Height), Color.Gray);

                    font.DisplayAlignment = OriginAlignment.Center;
                    font.DrawText(textPoint, text);
                    font.DisplayAlignment = OriginAlignment.TopLeft;

                    // test text scaling
                    font.SetScale(2.0, 2.0);
                    text      = "This text is twice as big.";
                    textPoint = new Point(50, 75);
                    textSize  = font.StringDisplaySize(text);

                    // draw a box with the same size the text should appear as
                    Display.DrawRect(new Rectangle(textPoint, textSize), Color.White);

                    font.DrawText(textPoint, text);
                    font.SetScale(1.0, 1.0);

                    // this draws a white background behind the text we want to Display.
                    text  = "F2: Toggle VSync   F5:  Toggle Windowed / Fullscreen      ";
                    text += "FPS: " + Display.FramesPerSecond.ToString("0.00") + "    ";

                    if (Core.IsActive)
                    {
                        text += "Active";
                    }
                    else
                    {
                        text += "Not Active";
                    }

                    // figure out how big the displayed text will be
                    textSize = font.StringDisplaySize(text);

                    // draw the white background
                    Display.FillRect(new Rectangle(new Point(0, 0), textSize), Color.White);

                    // draw the text on top of the background
                    font.Color = Color.Black;
                    font.DrawText(text);  // supplying no position arguments defaults to (0, 0)

                    // draw something which moves to let us know the program is running
                    Display.FillRect(new Rectangle(
                                         10, 200, 70 + (int)(50 * Math.Cos(frame / 10.0)), 50), Color.Red);

                    // do some bitmap font stuff
                    bitmapFont.DrawText(10, 350, "THIS IS BITMAP FONT TEXT.");

                    bitmapFont.Color = Color.Red;
                    bitmapFont.DrawText(10, 366, "THIS IS RED TEXT.");
                    bitmapFont.Color = Color.White;

                    bitmapFont.SetScale(3, 2);
                    bitmapFont.DrawText(10, 382, "THIS IS BIGG.");
                    bitmapFont.SetScale(1, 1);

                    Display.FillRect(new Rectangle(95, 425, 10, 10), Color.Blue);
                    bitmapFont.DisplayAlignment = OriginAlignment.Center;
                    bitmapFont.DrawText(100, 430, "CHECK");
                    bitmapFont.DisplayAlignment = OriginAlignment.TopLeft;

                    Display.FillRect(new Rectangle(-10, -10, 20, 20), Color.Green);

                    // and we're done.
                    Display.EndFrame();
                    Core.KeepAlive();

                    frame++;

                    // toggle full screen if the user pressed F5;
                    if (Keyboard.Keys[KeyCode.F5])
                    {
                        System.Diagnostics.Debug.Print("IsFullscreen: {0}", Display.CurrentWindow.IsFullScreen);

                        if (Display.CurrentWindow.IsFullScreen == false)
                        {
                            Display.CurrentWindow.SetFullScreen(800, 600, 32);
                        }
                        else
                        {
                            Display.CurrentWindow.SetWindowed();
                        }

                        System.Diagnostics.Debug.Print("IsFullscreen: {0}", Display.CurrentWindow.IsFullScreen);
                    }
                    else if (Keyboard.Keys[KeyCode.F2])
                    {
                        Display.VSync = !Display.VSync;
                        Keyboard.ReleaseKey(KeyCode.F2);
                    }
                    else if (Keyboard.Keys[KeyCode.Escape])
                    {
                        Display.Dispose();
                        return;
                    }
                }
            }
        }
示例#13
0
        public void Show()
        {
            if (Demo.mode != InputMode.Dialog || currentDialog == null)
            {
                return;
            }
            isHidden = false;
            Dictionary <char, char> mandrillDict = SimpleUI.mandrillDict;

            //string tx;

            /* = mandrillDict['┌'].ToString();
             * tx = tx.PadRight(maxWidth - 1, mandrillDict['─']);
             * tx += mandrillDict['┐'];*/
            //            for (int i = 1; i < maxWidth - 1; i++)
            //              tx += mandrillDict['─'];
            Display.FillRect(new Rectangle((int)currentDialog.renderX, (int)currentDialog.renderY + 14, 12 + (currentDialog.contentWidth * 6), (currentDialog.contentHeight + 5) * 14), Color.Black);
            int currentLine = 1;

            font.DrawText(currentDialog.renderX, currentDialog.renderY + (14 * currentLine), mandrillDict['┌'] + "".PadRight(currentDialog.contentWidth, mandrillDict['─']) + mandrillDict['┐']);

            currentLine++;
            font.DrawText(currentDialog.renderX, currentDialog.renderY + (14 * currentLine), mandrillDict['│'] + currentDialog.speaker.PadRight(currentDialog.contentWidth, ' ') + mandrillDict['│']);

            /*
             * tx = mandrillDict['╞'].ToString();
             * tx = tx.PadRight(maxWidth - 1, mandrillDict['═']);
             * tx += mandrillDict['╡'];*/
            currentLine++;
            font.DrawText(currentDialog.renderX, currentDialog.renderY + (14 * currentLine), mandrillDict['╞'] + "".PadRight(currentDialog.contentWidth, mandrillDict['═']) + mandrillDict['╡']);
            foreach (string s in currentDialog.lines)
            {
                currentLine++;
                font.DrawText(currentDialog.renderX, currentDialog.renderY + (14 * currentLine), mandrillDict['│'] + s.PadRight(currentDialog.contentWidth, ' ') + mandrillDict['│']);
            }

            /*
             * tx = mandrillDict['├'].ToString();
             * tx = tx.PadRight(maxWidth - 1, mandrillDict['─']);
             * tx += mandrillDict['┤'];*/
            currentLine++;
            font.DrawText(currentDialog.renderX, currentDialog.renderY + (14 * currentLine), mandrillDict['├'] + "".PadRight(currentDialog.contentWidth, mandrillDict['─']) + mandrillDict['┤']);



            //            if(currentDialog.options.Count > 15)
            List <DialogItem> shownItems = new List <DialogItem>();

            //(Math.Abs((currentDialog.currentOption - 8) * currentDialog.options.Count) + (currentDialog.currentOption - 8)) % currentDialog.options.Count;
            if (currentDialog.options.Count > 15)
            {
                shownItems.AddRange(currentDialog.options.GetRange((currentDialog.currentOption >= 15) ? currentDialog.currentOption - 14 : 0, 15));

                /*
                 * for (int i = (Math.Abs((currentDialog.currentOption) * currentDialog.options.Count) + (currentDialog.currentOption)) % currentDialog.options.Count
                 *  , t = 0; t < 15 && t < currentDialog.options.Count; i = (i + 1) % currentDialog.options.Count, t++)
                 * {
                 *  shownItems.Add(currentDialog.options[i]);
                 * }*/
            }
            else
            {
                shownItems = currentDialog.options;
            }

            /*
             *
             * if (counter + 4 > mb.skillList.Count)
             * {
             *  counter = 0;
             *  sw.Reset();
             * }
             */
            for (int i = 0; i < shownItems.Count; i++)
            {
                currentLine++;
                font.DrawText(currentDialog.renderX, currentDialog.renderY + (14 * currentLine), "" + mandrillDict['│']);
                if (shownItems[i] == currentDialog.options[currentDialog.currentOption])
                {
                    font.Color = Color.Red;
                }
                font.DrawText(currentDialog.renderX + 6, currentDialog.renderY + (14 * currentLine), shownItems[i].text.PadRight(currentDialog.contentWidth, ' '));
                font.Color = Color.White;
                font.DrawText(currentDialog.renderX + 6 + (6 * currentDialog.contentWidth), currentDialog.renderY + (14 * currentLine), "" + mandrillDict['│']);
            }

            currentLine++;
            font.DrawText(currentDialog.renderX, currentDialog.renderY + (14 * currentLine), mandrillDict['└'] + "".PadRight(currentDialog.contentWidth, mandrillDict['─']) + mandrillDict['┘']);
        }/*
示例#14
0
 public static void Show()
 {
     if (durations.Count + hintDurations.Count == 0 || messages.Count + hints.Count == 0)
     {
         return;
     }
     if (hintDurations.Count > 0)
     {
         if (stopwatch.TotalMilliseconds >= hintDurations[0])
         {
             hints.RemoveAt(0);
             hintDurations.RemoveAt(0);
             stopwatch.Reset();
             stopwatch.Pause();
         }
         if (durations.Count + hintDurations.Count == 0 || messages.Count + hints.Count == 0)
         {
             return;
         }
         stopwatch.Resume();
         if (hints.Count > 0)
         {
             font.DrawText(x, y, hints[0]);
         }
         if (hints.Count > 1)
         {
             font.DrawText(x, y + font.FontHeight, hints[1]);
             return;
         }
     }
     if (durations.Count > 0)
     {
         if (stopwatch.TotalMilliseconds >= durations[0])
         {
             messages.RemoveAt(0);
             durations.RemoveAt(0);
             stopwatch.Reset();
             stopwatch.Pause();
         }
         if (durations.Count + hintDurations.Count == 0 || messages.Count + hints.Count == 0)
         {
             return;
         }
         stopwatch.Resume();
         if (hints.Count >= 1)
         {
             if (messages.Count > 0)
             {
                 font.DrawText(x, y + font.FontHeight, messages[0]);
             }
         }
         else
         {
             if (messages.Count > 0)
             {
                 font.DrawText(x, y, messages[0]);
             }
             if (messages.Count > 1)
             {
                 font.DrawText(x, y + font.FontHeight, messages[1]);
             }
         }
     }
 }
示例#15
0
        public void Show()
        {
            //Display.Clear(Color.FromArgb(32, 32, 32));
            // (cursorY <= 10) (cursorY > mapHeight - 10)    if cursorY <= 10, (vals < 20);
            //minVisibleY = (cursorY < 20) ? 0 : (cursorY > mapHeight - 10) ? mapHeight - 20 : cursorY - 20;
            //maxVisibleY = minVisibleY;
            for (int row = (Demo.cursorY < 20) ? 0 : (Demo.cursorY > mapHeightBound - 10) ? mapHeightBound - 20 : Demo.cursorY - 20; row <= mapHeightBound && row <= Demo.cursorY + 20; row++)
            {
                // maxVisibleY++;
                var pY = tileVIncrease * ((Demo.cursorY <= 10) ? row : (Demo.cursorY > mapHeightBound - 10) ? row - (mapHeightBound - 19) : row - (Demo.cursorY - 10));
                var pX = tileHIncrease * (20 - 1 - ((Demo.cursorY <= 10) ? row : (Demo.cursorY > mapHeightBound - 10) ? row - (mapHeightBound - 19) : row - (Demo.cursorY - 10)));
                //   //(cursorY > mapHeight - 10) ? mapHeight - (cursorY - 10) : cursorY - 10)
                // +tileHIncrease; //row - (cursorY - 10)

                //minVisibleX = (cursorX <= 10) ? 0 : (cursorX > mapWidth - 10) ? mapWidth - 19 : cursorX - 10;
                //maxVisibleX = minVisibleX;
                for (int col = (Demo.cursorX <= 10) ? 0 : (Demo.cursorX > mapWidthBound - 10) ? mapWidthBound - 19 : Demo.cursorX - 10; col <= mapWidthBound && (col < Demo.cursorX + 10 || col < 20); col++)
                {
                    // maxVisibleX++;

                    /*
                     * if (visibleCells[col, row] <= 0 && seenCells[col, row] <= 0)
                     * {
                     *  pX += tileVIncrease;
                     *  continue;
                     * }
                     * else if (visibleCells[col, row] <= 0 && seenCells[col, row] > 0)
                     * {
                     *  var tile = map[row, col];
                     *  Rectangle src;
                     *
                     *  var dest = new Rectangle(pX, pY, tileWidth, tileHeight);
                     *  tileset.Color = Chroma.Blend(Color.Gray, mapColors[row, col], 0.2);
                     *  src = new Rectangle((tile % 38) * tileWidth, (tile / 38) * tileHeight, tileWidth, tileHeight);
                     *  tileset.Draw(src, dest);
                     *  tileset.Color = Color.White;
                     *  pX += tileVIncrease;
                     *  continue;
                     *
                     * }
                     */
                    if (map[row, col] == DungeonMap.gr)
                    {
                        //tileset.Color = mapColors[row, col];
                        tileset.Color = Chroma.Blend(mapColors[row, col], Color.Gray, 1.0 - visibleCells[row, col]);
                        if (Demo.highlightingOn)
                        {
                            if (highlightedTargetCells.ContainsKey(new Point(col, row)))
                            {
                                tileset.Color = Color.FromHsv(10.0, 0.7, 0.60 + (((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 3000 : (2000 - (Timing.TotalMilliseconds % 2000)) / 3000));
                            }
                            else if (highlightedCells.ContainsKey(new Point(col, row)) && !doNotStopCells.ContainsKey(new Point(col, row)))
                            {
                                tileset.Color = Color.FromHsv(230.0, 0.7, 0.80 + (((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 6000 : (2000 - (Timing.TotalMilliseconds % 2000)) / 6000));
                            }
                            else if (o_entities.ContainsKey(requestingMove))    // && o_entities[requestingMove].fov.sight[col, row] == 0)
                            {
                                tileset.Color = Chroma.Blend(mapColors[row, col], Color.Gray, 1.0 - o_entities[requestingMove].fov.sight[row, col]);
                            }
                        }
                        var dest = new Rectangle(pX, pY, tileWidth, tileHeight);
                        var tile = map[row, col];
                        var src  = new Rectangle((tile % 38) * tileWidth, (tile / 38) * tileHeight, tileWidth, tileHeight);
                        tileset.Draw(src, dest);
                        tileset.Color = Color.White;
                    }
                    pX += tileVIncrease;
                }
                pX = tileHIncrease * (20 - 1 - ((Demo.cursorY <= 10) ? row : (Demo.cursorY > mapHeightBound - 10) ? row - (mapHeightBound - 19) : row - (Demo.cursorY - 10)));
                for (var col = (Demo.cursorX <= 10) ? 0 : (Demo.cursorX > mapWidthBound - 10) ? mapWidthBound - 19 : Demo.cursorX - 10; col <= mapWidthBound && (col < Demo.cursorX + 10 || col < 20); col++)
                {
                    /*if (visibleCells[col, row] <= 0)
                     * {
                     *  pX += tileVIncrease;
                     *  continue;
                     * }*/
                    var dest    = new Rectangle(pX, pY, tileWidth, tileHeight);
                    var entity  = checkPos(col, row);
                    var fixture = checkFixture(col, row);
                    if (Demo.cursorX == col && Demo.cursorY == row && Demo.lockState && !Demo.lockForAnimation)
                    {
                        if (Demo.lockState)
                        {
                            tileset.Color = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 1.0, 1.0);
                        }
                        int offset = 0;
                        if (entity != null && entity.x == Demo.cursorX && entity.y == Demo.cursorY)
                        {
                            offset = (int)(((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 40 : (2000 - (Timing.TotalMilliseconds % 2000)) / 40);
                        }
                        int cursorTile = 1442;
                        if (entity != null)
                        {
                            cursorTile = 1441;
                        }
                        tileset.Draw(new Rectangle((cursorTile % 38) * tileWidth, (cursorTile / 38) * tileHeight, tileWidth, tileHeight), new Rectangle(pX, pY - offset, tileWidth, tileHeight));
                        tileset.Color = Color.White;
                    }
                    var       tile = map[row, col];
                    Rectangle src;
                    if (tile != DungeonMap.gr)
                    {
                        //tileset.Color = mapColors[row, col];
                        tileset.Color = Chroma.Blend(mapColors[row, col], Color.Gray, 1.0 - visibleCells[row, col]);
                        if (Demo.highlightingOn && o_entities.ContainsKey(requestingMove))    // && !o_entities[requestingMove].fov.sightSet.Contains(new Point(col, row)))
                        {
                            tileset.Color = Chroma.Blend(mapColors[row, col], Color.Gray, 1.0 - o_entities[requestingMove].fov.sight[row, col]);
                            //tileset.Color = Chroma.Blend(Color.Gray, mapColors[row, col], 0.2);
                        }
                        src = new Rectangle((tile % 38) * tileWidth, (tile / 38) * tileHeight, tileWidth, tileHeight);
                        tileset.Draw(src, dest);
                        tileset.Color = Color.White;
                    }
                    if (entity != null && visibleCells[row, col] > 0)
                    {
                        tile = entity.tile;
                        src  = new Rectangle((tile % 38) * tileWidth, (tile / 38) * tileHeight, tileWidth, tileHeight);
                        Color tsc;    // = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 0.5, 1.0);
                        if (Demo.lockState && entity.friendly && requestingMove.X == entity.o_pos.X && requestingMove.Y == entity.o_pos.Y)
                        {
                            //tileset.Color = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 0.5, 1.0);
                            tileset.Draw(src, dest);
                            tileset.Color = Color.White;
                        }
                        else
                        {
                            tileset.Draw(src, dest);
                        }

                        if (Demo.cursorX == col && Demo.cursorY == row && Demo.lockState && !Demo.lockForAnimation)
                        {
                            if (Demo.lockState)
                            {
                                tileset.Color = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 1.0, 1.0);
                            }
                            int offset = 0;
                            if (entity.x == Demo.cursorX && entity.y == Demo.cursorY)
                            {
                                offset = (int)(((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 40 : (2000 - (Timing.TotalMilliseconds % 2000)) / 40);
                            }
                            tileset.Draw(new Rectangle((1440 % 38) * tileWidth, (1440 / 38) * tileHeight, tileWidth, tileHeight), new Rectangle(pX, pY - offset, tileWidth, tileHeight));
                            tileset.Color = Color.White;
                        }
                        if (entity.friendly)
                        {
                            src = new Rectangle((1443 % 38) * tileWidth, (1443 / 38) * tileHeight, tileWidth, tileHeight);
                            tileset.Draw(src, dest);
                        }
                        if (Demo.showHealth)
                        {
                            if (entity.health < 10)
                            {
                                if (entity.friendly)
                                {
                                    tsc = Color.DarkBlue;
                                }
                                else
                                {
                                    tsc = Color.Black;    //Color.FromHsv((Timing.TotalMilliseconds % 3600) / 5.0, 0.8, 1.0);
                                }
                                mandrillFont.Color = tsc;
                                //     mandrillFont.Alpha = ((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 1000.0 : (2000 - (Timing.TotalMilliseconds % 2000)) / 1000;
                                mandrillFont.DrawText(pX + 18, pY + 16, "" + entity.health);
                            }
                            if (entity.health >= 10 && entity.health < 100)
                            {
                                if (entity.friendly)
                                {
                                    tsc = Color.DarkBlue;
                                }
                                else
                                {
                                    tsc = Color.Black;    //Color.FromHsv((Timing.TotalMilliseconds % 3600) / 5.0, 0.8, 1.0);
                                }
                                mandrillFont.Color = tsc;
                                //       mandrillFont.Alpha = ((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 1700.0 : (2000 - (Timing.TotalMilliseconds % 2000)) / 1700;
                                mandrillFont.DrawText(pX + 12, pY + 16, "" + entity.health);
                            }
                        }
                    }
                    else if (fixture != null)
                    {
                        int frontTile = 1437;
                        int backTile  = 1436;

                        if (Demo.cursorX == col && Demo.cursorY == row && Demo.lockState)
                        {
                            if (Demo.lockState)
                            {
                                tileset.Color = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 1.0, 1.0);
                            }
                            int offset = 0;
                            tileset.Draw(new Rectangle((backTile % 38) * tileWidth, (backTile / 38) * tileHeight, tileWidth, tileHeight), new Rectangle(pX, pY - offset, tileWidth, tileHeight));
                            tileset.Color = Color.White;
                        }
                        tileset.Color = Chroma.Blend(mapColors[row, col], Color.Gray, 1.0 - visibleCells[row, col]);
                        tile          = fixture.tile;
                        src           = new Rectangle((tile % 38) * tileWidth, (tile / 38) * tileHeight, tileWidth, tileHeight);
                        tileset.Draw(src, dest);
                        tileset.Color = Color.White;
                        if (Demo.cursorX == col && Demo.cursorY == row && Demo.lockState)
                        {
                            if (Demo.lockState)
                            {
                                tileset.Color = Color.FromHsv((Timing.TotalMilliseconds % 1800) / 5.0, 1.0, 1.0);
                            }
                            int offset = 0;
                            tileset.Draw(new Rectangle((frontTile % 38) * tileWidth, (frontTile / 38) * tileHeight, tileWidth, tileHeight), new Rectangle(pX, pY - offset, tileWidth, tileHeight));
                            tileset.Color = Color.White;
                        }
                    }
                    //     mandrillFont.Alpha = ((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 1000.0 : (2000 - (Timing.TotalMilliseconds % 2000)) / 1000;
                    //       mandrillFont.Alpha = ((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 1700.0 : (2000 - (Timing.TotalMilliseconds % 2000)) / 1700;
                    foreach (Point cl in displayDamage.Keys)
                    {
                        if (cl.Y == row && cl.X == col)
                        {
                            if (displayDamage[cl] < 10)
                            {
                                int offset = (int)(((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 50 : (2000 - (Timing.TotalMilliseconds % 2000)) / 50);
                                mandrillFont.Color = (Timing.TotalMilliseconds % 100 < 50) ? Color.Black : Color.White;
                                mandrillFont.DrawText(pX + 18, pY + 16 - offset, "" + displayDamage[cl]);
                                mandrillFont.Color = Color.White;
                            }
                            else if (displayDamage[cl] >= 10 && displayDamage[cl] < 100)
                            {
                                int offset = (int)(((Timing.TotalMilliseconds % 2000) < 1000) ? (Timing.TotalMilliseconds % 2000) / 40 : (2000 - (Timing.TotalMilliseconds % 2000)) / 40);
                                mandrillFont.Color = (Timing.TotalMilliseconds % 100 < 50) ? Color.Black : Color.White;     //Color.DarkRed;
                                mandrillFont.DrawText(pX + 12, pY + 16 - offset, "" + displayDamage[cl]);
                                mandrillFont.Color = Color.White;
                            }
                        }
                    }
                    foreach (Point cl in displayKills.Keys)
                    {
                        if (cl.Y == row && cl.X == col && displayKills[cl])
                        {
                            int offset = (int)(((Timing.TotalMilliseconds % 4000) < 2000) ? (Timing.TotalMilliseconds % 4000) / 100 : (4000 - (Timing.TotalMilliseconds % 4000)) / 100);
                            mandrillFont.Color = (Timing.TotalMilliseconds % 100 < 50) ? Color.Black : Color.White;
                            mandrillFont.DrawText(pX, pY + 16 - offset, "DEAD");
                            mandrillFont.Color = Color.White;
                        }
                    }

                    pX += tileVIncrease;
                }
                //pY += tileHIncrease;
            }

            /*ScreenBrowser.Show();
             * if (Demo.hoverActor != null)
             *  UnitInfo.ShowMobInfo(Demo.hoverActor);
             * else if (Demo.currentActor != null)
             *  UnitInfo.ShowMobInfo(Demo.currentActor);
             * Display.FillRect(new Rectangle(0, Demo.mapDisplayHeight, Demo.mapDisplayWidth, 32), (Color.Black));
             * DialogBrowser.Show();
             * MessageBrowser.Show();*/
            //mandrillFont.DrawText(32.0, 32.0, "FPS: " + (int)Display.FramesPerSecond);
        }