DynamicHUD Dev Guide
DownloadNeed Support?
  • Dynamic HUD
  • Import using Gradle
  • Integrating DynamicHUD
    • Integrating DynamicHUD
    • Adding Widgets
    • Adding your own WidgetRenderer
    • Passing AbstractMoveableScreen instance
    • Changing default key bind
    • Changing save and load file
    • Registering Custom Widgets
  • Widget
    • Widget class
    • How to create a custom widget
    • Widget Renderer
    • WidgetData
    • DynamicValueRegistry
    • Scaling
  • Screens
    • AbstractMoveableScreen
  • ContextMenu
    • ContextMenu class
    • Using context menu
    • Option<T> class
      • Color Option
      • Boolean Option
      • Double Option
      • Runnable Option
      • Enum Option
      • List Option
      • SubMenu Option
Powered by GitBook
On this page
  • Class Variables
  • Constructor
  • Methods

Was this helpful?

  1. Screens

AbstractMoveableScreen

The AbstractMoveableScreen class is an abstract class that extends the Screen class. It provides a framework for creating screens that can contain movable widgets. This class is required for handling widget input and editor.

Class Variables

  • WidgetRenderer widgetRenderer: The WidgetRenderer object responsible for rendering the widgets on this screen.

  • int snapSize: Number of grids in which the screen should be divided to which the widgets will snap when moved. Default value is 100. Higher value == Smaller grid boxes.

  • boolean shouldPause: A flag indicating whether the game should pause when this screen is opened.

Constructor

The constructor takes a Text object representing the title of the screen and a WidgetRenderer object.

public AbstractMoveableScreen(Text title, WidgetRenderer renderer) {
    super(title);
    this.widgetRenderer = renderer;
}

Methods

  • void onDisplayed(): This method is called when the screen is displayed. It sets the isInEditor flag of the widgetRenderer to true.

  • void render(DrawContext drawContext, int mouseX, int mouseY, float delta): This method is responsible for rendering the screen and its widgets. It first checks if the client’s world is null, and if so, it renders the background texture. Then it calls the renderWidgets method of the widgetRenderer to render each widget.

  • void close(): This method is called when the screen is closed. It sets the isInEditor flag of the widgetRenderer to false and calls the onCloseScreen method of the widgetRenderer.

  • void setShouldPause(boolean shouldPause): This method sets the shouldPause flag to the given value.

  • boolean shouldPause(): This method returns the value of the shouldPause flag.

  • void setSnapSize(int size): This method sets the snapSize to the given value.

PreviousScalingNextContextMenu class

Last updated 1 year ago

Was this helpful?