Exemplo n.º 1
0
        internal void Draw(SpriteBatch spriteBatch)
        {
            var originalViewport = spriteBatch.GraphicsDevice.Viewport;

            spriteBatch.GraphicsDevice.Viewport = Viewport;
            spriteBatch.Begin(samplerState: SamplerState.PointWrap, transformMatrix: ViewportAdapter.GetScaleMatrix());

            Controls.Draw(spriteBatch);

            var imgMinimap             = Controls["frmHudView.frmMinimap.imgMinimap"];
            var minimapViewedRectangle = MinimapHandler.GetViewedRectangle(WorldView, imgMinimap.Size);

            minimapViewedRectangle.X += imgMinimap.Left;
            minimapViewedRectangle.Y += imgMinimap.Top;

            spriteBatch.DrawRectangle(minimapViewedRectangle, Color.White);
            spriteBatch.DrawPoint(minimapViewedRectangle.Center.ToVector2(), Color.White);

            var font = AssetsManager.Instance.GetSpriteFont("CrimsonText-Regular-12");

            var frmUnits            = Controls["frmHudView.frmUnits"];
            var frmUnitsTopLeft     = frmUnits.TopLeft;
            var frmUnitsBottomRight = frmUnits.BottomRight;
            var hexPoint            = WorldView.Camera.ScreenPixelToWorldHex(Input.MousePosition); // get tile mouse is over

            DrawUnits(spriteBatch, StackViews, SelectedStackView, frmUnitsTopLeft, frmUnitsBottomRight, WorldView.GetActionButtons);
            DrawNotifications(spriteBatch, font, WorldView.NotificationList);
            DrawTileInfo(spriteBatch, font, 10.0f, Area.Height * 0.96f, WorldView.CellGrid, hexPoint);

            spriteBatch.End();
            spriteBatch.GraphicsDevice.Viewport = originalViewport;
        }
Exemplo n.º 2
0
        public void MinimapViewedRectangle_will_be_set__correctly_when_looking_at_cell_60_40_smaller_minimap()
        {
            _worldView.Camera.LookAtCell(new PointI(60, 40));

            var minimapSize            = new PointI(100, 100);
            var minimapViewedRectangle = MinimapHandler.GetViewedRectangle(_worldView, minimapSize);

            Assert.AreEqual(75, minimapViewedRectangle.X);
            Assert.AreEqual(73, minimapViewedRectangle.Y);
            Assert.AreEqual(25, minimapViewedRectangle.Width);
            Assert.AreEqual(27, minimapViewedRectangle.Height);
        }
Exemplo n.º 3
0
        public void MinimapViewedRectangle_will_be_set__correctly_when_looking_at_cell_60_40()
        {
            _worldView.Camera.LookAtCell(new PointI(60, 40));

            var minimapSize            = new PointI(200, 116);
            var minimapViewedRectangle = MinimapHandler.GetViewedRectangle(_worldView, minimapSize);

            Assert.AreEqual(149, minimapViewedRectangle.X);
            Assert.AreEqual(83, minimapViewedRectangle.Y);
            Assert.AreEqual(50, minimapViewedRectangle.Width);
            Assert.AreEqual(32, minimapViewedRectangle.Height);
        }