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; }
private void NewCellSeen(object sender, EventArgs e) { var cellGrid = (CellGrid)sender; var createdImage = MinimapHandler.Create(cellGrid); AssetsManager.Instance.AddTexture("MapImage", createdImage); var mapImage = (Image)Controls["frmHudView.frmMinimap.imgMinimap"]; mapImage.TextureNormal = "MapImage"; }
internal void LoadContent(ContentManager content) { Controls.LoadContent(content, true); var createdImage = MinimapHandler.Create(WorldView.CellGrid); AssetsManager.Instance.AddTexture("MapImage", createdImage); var mapImage = (Image)Controls["frmHudView.frmMinimap.imgMinimap"]; mapImage.TextureNormal = "MapImage"; }
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); }
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); }