public override void RealignElements() { base.RealignElements(); if (_parentMenu != null) { Vector2 bodyCharSize = BodyTextFont.MeasureString("("); Vector2 headingCharSize = HeadingTextFont.MeasureString(")"); width = (int)(Math.Max(_parentMenu.width, (bodyCharSize.X * 28) + Padding.X)); height = (int)((bodyCharSize.Y * 6) + (headingCharSize.Y * 1) + (Padding.Y * 3)); } }
private void DrawTileInfo(SpriteBatch b) { Vector2 targetPosition; //Tile tile = ModEntry.GetTileOnHighestLayer(location: Game1.currentLocation, x: (int)targetPosition.X, y: (int)targetPosition.Y); Vector2 position = Utility.PointToVector2(ContentSafeArea.Location); string text; text = ModEntry.Instance.i18n.Get("ui.tileinfo.heading"); this.DrawHeading(b, position: position, text: text, drawBackground: true); position.Y += ContentSafeArea.Height; targetPosition = new Vector2(Game1.viewport.X, Game1.viewport.Y); text = "View: " + targetPosition.ToString(); position.Y -= BodyTextFont.MeasureString(text: text).Y; this.DrawText(b, position: position, text: text); targetPosition = Utility.PointToVector2(Game1.getMousePosition()); text = "Screen: " + targetPosition.ToString(); position.Y -= BodyTextFont.MeasureString(text: text).Y; this.DrawText(b, position: position, text: text); targetPosition = new Vector2(Game1.viewport.X + Game1.getMouseX(), Game1.viewport.Y + Game1.getMouseY()); text = "World: " + targetPosition.ToString(); position.Y -= BodyTextFont.MeasureString(text: text).Y; this.DrawText(b, position: position, text: text); targetPosition = Game1.currentCursorTile; text = "Tile: " + targetPosition.ToString(); position.Y -= BodyTextFont.MeasureString(text: text).Y; this.DrawText(b, position: position, text: text); targetPosition = new Vector2(Game1.currentLocation.Map.DisplayWidth, Game1.currentLocation.Map.DisplayHeight) / Game1.tileSize; text = "Map: " + targetPosition.ToString(); position.Y -= BodyTextFont.MeasureString(text: text).Y; this.DrawText(b, position: position, text: text); targetPosition = Game1.player.Position; text = "Player: " + "(X:" + (int)targetPosition.X + " Y:" + (int)targetPosition.Y + ")"; position.Y -= BodyTextFont.MeasureString(text: text).Y; this.DrawText(b, position: position, text: text); }