Package org.rusherhack.client.api.ui.hud
Class HudHandlerBase
java.lang.Object
org.rusherhack.client.api.ui.ElementHandlerBase<HudElement>
org.rusherhack.client.api.ui.hud.HudHandlerBase
- All Implemented Interfaces:
Globals
,IRenderable2D
,org.rusherhack.core.interfaces.IClickable
,org.rusherhack.core.interfaces.IDraggable
,org.rusherhack.core.interfaces.IHoverable
,org.rusherhack.core.interfaces.IScrollable
,org.rusherhack.core.interfaces.ITickable
,org.rusherhack.core.interfaces.ITypeable
,org.rusherhack.core.serialize.ISerializable<com.google.gson.JsonElement>
,org.rusherhack.core.serialize.JsonSerializable
Handler for hud elements
-
Field Summary
Fields inherited from class org.rusherhack.client.api.ui.ElementHandlerBase
positionsInitialized
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
charTyped
(char character) protected boolean
consumeElementMouseClick
(HudElement element, double mouseX, double mouseY, int button) protected Color
getBackgroundColor
(HudElement hudElement, double mouseX, double mouseY) void
Initialize all of the elementsboolean
isElementHovered
(HudElement element, double mouseX, double mouseY) Checks if an element is hovered.boolean
keyTyped
(int key, int scanCode, int modifiers) boolean
mouseClicked
(double mouseX, double mouseY, int button) void
mouseMoved
(double mouseX, double mouseY) void
mouseReleased
(double mouseX, double mouseY, int button) boolean
mouseScrolled
(double mouseX, double mouseY, double delta) void
moveElementToTop
(HudElement element) Moves the element to the topvoid
render
(RenderContext context, double mouseX, double mouseY) void
renderElements
(RenderContext renderContext, double mouseX, double mouseY) void
renderHudElement
(HudElement hudElement, RenderContext renderContext, double mouseX, double mouseY) protected void
renderHudElementBackground
(HudElement hudElement, RenderContext renderContext, IRenderer2D renderer, double width, double height, int color) Renders the background of a hud elementprotected void
renderPrimitiveHudElement
(HudElement hudElement, RenderContext renderContext, double mouseX, double mouseY) void
Sets the default positions of the elementsvoid
tick()
Methods inherited from class org.rusherhack.client.api.ui.ElementHandlerBase
consumeElementCharTyped, consumeElementKeyTyped, consumeElementMouseMove, consumeElementMouseRelease, consumeElementMouseScroll, consumeMouseClick, consumeMouseMove, consumeMouseRelease, consumeMouseScroll, deserialize, getElement, getScale, isEnabled, isHovered, serialize, shouldSerialize
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.rusherhack.core.interfaces.IDraggable
isDragging
Methods inherited from interface org.rusherhack.client.api.render.IRenderable2D
getRenderer, render
Methods inherited from interface org.rusherhack.core.serialize.ISerializable
shouldAutoSave
-
Constructor Details
-
HudHandlerBase
public HudHandlerBase(boolean scaledWithMinecraftGui) - Parameters:
scaledWithMinecraftGui
- sets whether elements should be scaled with the minecraft gui
-
-
Method Details
-
getElements
- Specified by:
getElements
in classElementHandlerBase<HudElement>
- Returns:
- elements to be handled by this handler
-
moveElementToTop
Description copied from class:ElementHandlerBase
Moves the element to the top- Specified by:
moveElementToTop
in classElementHandlerBase<HudElement>
- Parameters:
element
- element to move to the top
-
render
- Specified by:
render
in interfaceIRenderable2D
- Overrides:
render
in classElementHandlerBase<HudElement>
-
initialize
public void initialize()Description copied from class:ElementHandlerBase
Initialize all of the elements- Specified by:
initialize
in classElementHandlerBase<HudElement>
-
setDefaultPositions
public void setDefaultPositions()Description copied from class:ElementHandlerBase
Sets the default positions of the elements- Specified by:
setDefaultPositions
in classElementHandlerBase<HudElement>
-
tick
public void tick()- Specified by:
tick
in interfaceorg.rusherhack.core.interfaces.ITickable
- Overrides:
tick
in classElementHandlerBase<HudElement>
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) - Specified by:
mouseClicked
in interfaceorg.rusherhack.core.interfaces.IClickable
- Overrides:
mouseClicked
in classElementHandlerBase<HudElement>
-
consumeElementMouseClick
protected boolean consumeElementMouseClick(HudElement element, double mouseX, double mouseY, int button) - Overrides:
consumeElementMouseClick
in classElementHandlerBase<HudElement>
-
mouseReleased
public void mouseReleased(double mouseX, double mouseY, int button) - Specified by:
mouseReleased
in interfaceorg.rusherhack.core.interfaces.IClickable
- Overrides:
mouseReleased
in classElementHandlerBase<HudElement>
-
mouseMoved
public void mouseMoved(double mouseX, double mouseY) - Specified by:
mouseMoved
in interfaceorg.rusherhack.core.interfaces.IDraggable
- Overrides:
mouseMoved
in classElementHandlerBase<HudElement>
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double delta) - Specified by:
mouseScrolled
in interfaceorg.rusherhack.core.interfaces.IScrollable
- Overrides:
mouseScrolled
in classElementHandlerBase<HudElement>
-
charTyped
public boolean charTyped(char character) - Specified by:
charTyped
in interfaceorg.rusherhack.core.interfaces.ITypeable
- Overrides:
charTyped
in classElementHandlerBase<HudElement>
-
keyTyped
public boolean keyTyped(int key, int scanCode, int modifiers) - Specified by:
keyTyped
in interfaceorg.rusherhack.core.interfaces.ITypeable
- Overrides:
keyTyped
in classElementHandlerBase<HudElement>
-
renderElements
- Overrides:
renderElements
in classElementHandlerBase<HudElement>
-
renderHudElement
public void renderHudElement(HudElement hudElement, RenderContext renderContext, double mouseX, double mouseY) -
renderPrimitiveHudElement
protected void renderPrimitiveHudElement(HudElement hudElement, RenderContext renderContext, double mouseX, double mouseY) -
getBackgroundColor
-
renderHudElementBackground
protected void renderHudElementBackground(HudElement hudElement, RenderContext renderContext, IRenderer2D renderer, double width, double height, int color) Renders the background of a hud element -
getHudManagerPanel
-
isElementHovered
Description copied from class:ElementHandlerBase
Checks if an element is hovered. Can be overridden to change the hover behavior.- Overrides:
isElementHovered
in classElementHandlerBase<HudElement>
- Parameters:
element
- the elementmouseX
- the x-coordinate of the mousemouseY
- the y-coordinate of the mouse- Returns:
- true if the window is hovered
-
getFontRenderer
-