Class RoundSpriteButton

java.lang.Object
com.pixelmonmod.pixelmon.client.gui.widgets.RoundSpriteButton

public class RoundSpriteButton extends Object
A button with rounded edges.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RoundSpriteButton(int leftOffset, int topOffset, net.minecraft.resources.ResourceLocation sprite)
    Creates a rounded button.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    drawButton(net.minecraft.client.gui.GuiGraphics graphics, int leftX, int topY, double mouseX, double mouseY, float zLevel)
    Draws the button on the screen.
    void
    drawButton(net.minecraft.client.gui.GuiGraphics graphics, int leftX, int topY, double mouseX, double mouseY, float zLevel, boolean forceOutline)
    Draws the button on the screen.
    boolean
    isMouseOver(int leftX, int topY, double mouseX, double mouseY)
    Checks if the cursor is over the button.
    void
    setBackgroundColor(Color backgroundColor)
     
    void
    setBackgroundHoverColor(Color backgroundHoverColor)
     
    setSize(int width, int height)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RoundSpriteButton

      public RoundSpriteButton(int leftOffset, int topOffset, net.minecraft.resources.ResourceLocation sprite)
      Creates a rounded button.
      Parameters:
      leftOffset - The x offset of the button from the left of the screen.
      topOffset - The y offset of the button from the top of the screen.
      sprite - The sprite to draw on the button.
  • Method Details

    • setBackgroundColor

      public void setBackgroundColor(Color backgroundColor)
    • setBackgroundHoverColor

      public void setBackgroundHoverColor(Color backgroundHoverColor)
    • setSize

      public RoundSpriteButton setSize(int width, int height)
    • drawButton

      public void drawButton(net.minecraft.client.gui.GuiGraphics graphics, int leftX, int topY, double mouseX, double mouseY, float zLevel)
      Draws the button on the screen.
      Parameters:
      leftX - The x coordinate of the left side of the screen.
      topY - The y coordinate of the top of the screen.
      mouseX - The x coordinate of the cursor.
      mouseY - The y coordinate of the cursor.
      zLevel - The z coordinate of the button.
    • drawButton

      public void drawButton(net.minecraft.client.gui.GuiGraphics graphics, int leftX, int topY, double mouseX, double mouseY, float zLevel, boolean forceOutline)
      Draws the button on the screen.
      Parameters:
      leftX - The x coordinate of the left side of the screen.
      topY - The y coordinate of the top of the screen.
      mouseX - The x coordinate of the cursor.
      mouseY - The y coordinate of the cursor.
      zLevel - The z coordinate of the button.
      forceOutline - Whether to force an outline to appear on the button regardless of mouseover.
    • isMouseOver

      public boolean isMouseOver(int leftX, int topY, double mouseX, double mouseY)
      Checks if the cursor is over the button.
      Parameters:
      leftX - The x coordinate of the left side of the screen.
      topY - The y coordinate of the top of the screen.
      mouseX - The x coordinate of the cursor.
      mouseY - The y coordinate of the cursor.
      Returns:
      Whether the cursor is over the button.