Class HudElement

All Implemented Interfaces:
IHudElement, Globals, IRenderable2D, org.rusherhack.core.bind.IBindable, org.rusherhack.core.event.listener.EventListener, org.rusherhack.core.feature.IFeature, org.rusherhack.core.feature.IFeatureConfigurable, org.rusherhack.core.interfaces.IClickable, org.rusherhack.core.interfaces.IDraggable, org.rusherhack.core.interfaces.IHoverable, org.rusherhack.core.interfaces.INamed, org.rusherhack.core.interfaces.ITickable, org.rusherhack.core.interfaces.IToggleable, org.rusherhack.core.logging.ILoggable, org.rusherhack.core.serialize.ISerializable<com.google.gson.JsonElement>, org.rusherhack.core.serialize.JsonSerializable
Direct Known Subclasses:
ListHudElement, ResizeableHudElement, ShortListHudElement, TextHudElement

public abstract class HudElement extends ScaledElementBase implements IHudElement, org.rusherhack.core.bind.IBindable, org.rusherhack.core.event.listener.EventListener, org.rusherhack.core.logging.ILoggable, Globals
A hud element is a draggable ElementBase that can be rendered on the screen.
  • Field Details

    • alignment

      protected HudElement.Alignment alignment
      Alignment of this hud element
    • logger

      protected final org.rusherhack.core.logging.ILogger logger
      Logger for this hud element
  • Constructor Details

    • HudElement

      public HudElement(String name)
  • Method Details

    • render

      public void render(RenderContext context, double mouseX, double mouseY)
      Specified by:
      render in interface IRenderable2D
    • correctPosition

      protected void correctPosition(HudElement.Alignment old, HudElement.Alignment newAlignment)
    • postRender

      public void postRender(RenderContext context, double mouseX, double mouseY)
      Some stuff shouldn't be rendered in nanovg context
    • getName

      public String getName()
      Specified by:
      getName in interface org.rusherhack.core.interfaces.INamed
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface org.rusherhack.core.feature.IFeature
    • setDescription

      public void setDescription(String description)
    • getSettings

      public List<org.rusherhack.core.setting.Setting<?>> getSettings()
      Specified by:
      getSettings in interface org.rusherhack.core.feature.IFeatureConfigurable
    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int button)
      Specified by:
      mouseClicked in interface org.rusherhack.core.interfaces.IClickable
    • mouseReleased

      public void mouseReleased(double mouseX, double mouseY, int button)
      Specified by:
      mouseReleased in interface org.rusherhack.core.interfaces.IClickable
    • mouseMoved

      public void mouseMoved(double mouseX, double mouseY)
      Specified by:
      mouseMoved in interface org.rusherhack.core.interfaces.IDraggable
    • isDragging

      public boolean isDragging()
      Specified by:
      isDragging in interface org.rusherhack.core.interfaces.IDraggable
    • isHovered

      public boolean isHovered(double mouseX, double mouseY)
      Specified by:
      isHovered in interface org.rusherhack.core.interfaces.IHoverable
    • toggle

      public void toggle()
      Specified by:
      toggle in interface org.rusherhack.core.interfaces.IToggleable
    • onEnable

      public void onEnable()
      Specified by:
      onEnable in interface org.rusherhack.core.interfaces.IToggleable
    • onDisable

      public void onDisable()
      Specified by:
      onDisable in interface org.rusherhack.core.interfaces.IToggleable
    • getBindReference

      public String getBindReference()
      Specified by:
      getBindReference in interface org.rusherhack.core.bind.IBindable
    • onKeybindEvent

      public void onKeybindEvent()
      Specified by:
      onKeybindEvent in interface org.rusherhack.core.bind.IBindable
    • getLogger

      public org.rusherhack.core.logging.ILogger getLogger()
      Specified by:
      getLogger in interface org.rusherhack.core.logging.ILoggable
    • isToggled

      public boolean isToggled()
      Specified by:
      isToggled in interface org.rusherhack.core.interfaces.IToggleable
    • setToggled

      public void setToggled(boolean toggled)
      Specified by:
      setToggled in interface org.rusherhack.core.interfaces.IToggleable
    • isListening

      public boolean isListening()
      Specified by:
      isListening in interface org.rusherhack.core.event.listener.EventListener
    • setX

      public void setX(double x)
      Overrides:
      setX in class ElementBase
    • setY

      public void setY(double y)
      Overrides:
      setY in class ElementBase
    • getX

      public double getX()
      Overrides:
      getX in class ElementBase
    • getY

      public double getY()
      Overrides:
      getY in class ElementBase
    • getStartX

      public double getStartX()
    • getStartY

      public double getStartY()
    • setStartX

      public void setStartX(double x)
    • setStartY

      public void setStartY(double y)
    • getScale

      public double getScale()
      Overrides:
      getScale in class ScaledElementBase
      Returns:
      The scale of this element
    • getFontRenderer

      public IFontRenderer getFontRenderer()
      Specified by:
      getFontRenderer in interface IRenderable2D
    • getSnapPoint

      public HudElement.SnapPoint getSnapPoint()
    • setSnapPoint

      public void setSnapPoint(HudElement.SnapPoint snapPoint)
    • serialize

      public com.google.gson.JsonElement serialize()
      Specified by:
      serialize in interface org.rusherhack.core.serialize.ISerializable<com.google.gson.JsonElement>
    • deserialize

      public boolean deserialize(com.google.gson.JsonElement jsonElement)
      Specified by:
      deserialize in interface org.rusherhack.core.serialize.ISerializable<com.google.gson.JsonElement>
    • shouldUpdateAlignment

      public boolean shouldUpdateAlignment()
    • getAlignment

      public HudElement.Alignment getAlignment()
    • calculateAlignment

      public static HudElement.Alignment calculateAlignment(HudElement element)
    • calculateAlignment

      public static HudElement.Alignment calculateAlignment(double x, double y)