Example #1
0
 /// <summary>
 /// Event handler for rendering the button sprite to the screen.
 /// Only renders if 1: There is no menu active.
 ///                 2: The toolbar is set to be pinned in the game options.
 ///                 3: The mod option for toolbar toggle is enabled.
 /// </summary>
 ///
 /// <remarks>
 /// Done before the HUD rendering instead of after to allow the button to be hidden behind tool-tips.
 /// </remarks>
 /// <param name="sender">The object from which the event originated.</param>
 /// <param name="e">These are the arguments sent along with the event from SMAPI, contains the Sprite-batch</param>
 private void Display_RenderingHud(object sender, StardewModdingAPI.Events.RenderingHudEventArgs e)
 {
     if (Game1.activeClickableMenu == null && Game1.options.pinToolbarToggle && this.ToolbarOption.IsActive)
     {
         e.SpriteBatch.Draw(this.texture, new Vector2(this.Bounds.X, this.Bounds.Y), Color.White);
     }
 }
        private void Display_RenderingHud(object sender, StardewModdingAPI.Events.RenderingHudEventArgs e)
        {
            if (this.dist != -1 && this.config.ShowInGame)
            {
                Vector2 pos  = Game1.player.getLocalPosition(Game1.viewport) + new Vector2(0, 64);
                Vector2 pos2 = pos + new Vector2(0, 64);

                e.SpriteBatch.DrawString(Game1.dialogueFont, $"#Tiles from land: {this.dist}", pos, this.color);
                e.SpriteBatch.DrawString(Game1.dialogueFont, $"Pixels from player: {this.dist2}", pos2, this.color);
            }
        }
Example #3
0
 void Display_RenderingHud(object sender, StardewModdingAPI.Events.RenderingHudEventArgs e)
 {
     Pests.DrawPests(e.SpriteBatch);
 }