Class HudDrawer

java.lang.Object
dev.boze.api.render.HudDrawer

public class HudDrawer extends Object
HUD rendering API for drawing 2D shapes on the screen
Provides methods for rendering lines and quads in 2D screen space
All drawing operations must be wrapped between start() and draw() calls
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Renders the current drawing session to the screen
    Throws RuntimeException if start() was not called first
    static float
    Gets the current global HUD scale (the Hud module's Scale setting).
    static void
    line(ColorOption.Value colorOption, double x1, double y1, double x2, double y2)
    Renders a line using ColorOption.Value
    Throws RuntimeException if start() was not called first
    static void
    line(ClientColor color, float opacity, double x1, double y1, double x2, double y2)
    Renders a line
    Throws RuntimeException if start() was not called first
    static void
    quad(ColorOption.Value colorOption, double x, double y, double width, double height)
    Renders a quad/filled rectangle using ColorOption.Value
    Throws RuntimeException if start() was not called first
    static void
    quad(ClientColor color, float opacity, double x, double y, double width, double height)
    Renders a quad/filled rectangle
    Throws RuntimeException if start() was not called first
    static void
    Starts a new HUD drawing session
    Must be called before any drawing operations.

    Methods inherited from class Object

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

    • HudDrawer

      public HudDrawer()
  • Method Details

    • start

      public static void start()
      Starts a new HUD drawing session
      Must be called before any drawing operations. Throws RuntimeException if already started
    • getScale

      public static float getScale()
      Gets the current global HUD scale (the Hud module's Scale setting).
      Returns:
      The HUD scale, defaulting to 1.0
    • draw

      public static void draw()
      Renders the current drawing session to the screen
      Throws RuntimeException if start() was not called first
    • line

      public static void line(ClientColor color, float opacity, double x1, double y1, double x2, double y2)
      Renders a line
      Throws RuntimeException if start() was not called first
      Parameters:
      color - The color to use
      opacity - The opacity value
      x1 - Starting X coordinate
      y1 - Starting Y coordinate
      x2 - Ending X coordinate
      y2 - Ending Y coordinate
    • quad

      public static void quad(ClientColor color, float opacity, double x, double y, double width, double height)
      Renders a quad/filled rectangle
      Throws RuntimeException if start() was not called first
      Parameters:
      color - The color to use
      opacity - The opacity value
      x - X coordinate
      y - Y coordinate
      width - Width of the quad
      height - Height of the quad
    • line

      public static void line(ColorOption.Value colorOption, double x1, double y1, double x2, double y2)
      Renders a line using ColorOption.Value
      Throws RuntimeException if start() was not called first
      Parameters:
      colorOption - The color option value containing color and opacity settings
      x1 - Starting X coordinate
      y1 - Starting Y coordinate
      x2 - Ending X coordinate
      y2 - Ending Y coordinate
    • quad

      public static void quad(ColorOption.Value colorOption, double x, double y, double width, double height)
      Renders a quad/filled rectangle using ColorOption.Value
      Throws RuntimeException if start() was not called first
      Parameters:
      colorOption - The color option value containing color and opacity settings
      x - X coordinate
      y - Y coordinate
      width - Width of the quad
      height - Height of the quad