Archived Legacy DynamicHUD
  • Dynamic HUD
  • Import using Gradle
  • Widgets
    • Adding Widgets
      • TextWidget
      • ItemWidget
      • ArmorWidget
    • Creating your own Widget class
    • Widget class
    • WidgetManager
    • WidgetBox
  • Saving and Loading
    • Saving and Loading
    • Changing save file name and directory
  • Moveable Screen
    • AbstractMoveableScreen
    • Default Moveable Screen
    • Using the default Moveable Screen
    • Creating and using your own MoveableScreen class
  • ContextMenu
    • ContextMenu class
    • ContextMenuOptionsProvider interface
    • DoubleInputScreen
    • DataInputScreen
  • Slider Widget
    • Slider
  • SliderWidgetBuilder
  • ColorPicker
    • ColorGradientPicker
      • ColorPickerButton
      • GradientBox
      • GradientSlider
  • Helpers
    • ColorHelper
    • DrawHelper
    • TextureHelper
Powered by GitBook
On this page
  • DrawHelper
  • Constructors
  • Methods
  1. Helpers

DrawHelper

Talks about DrawHelper class

DrawHelper

This class extends the DrawContext class and provides methods for drawing various shapes and text on the screen.

Constructors

DrawHelper(MinecraftClient client, VertexConsumerProvider.Immediate vertexConsumers)

Creates a new instance of the DrawHelper class.

Parameter
Description

client

The Minecraft client instance

vertexConsumers

The vertex consumer provider

Methods

drawBox(DrawContext drawContext, int x, int y, int width, int height, int color)

Fills a box on the screen with a specified color.

Parameter
Description

drawContext

The drawContext used for rendering

x

The x position of the rectangle

y

The y position of the rectangle

width

The width of the rectangle

height

The height of the rectangle

color

The color to fill the rectangle with

fill(DrawContext drawContext, int x1, int y1, int x2, int y2, int color)

Fills a rectangle on the screen with a specified color.

Parameter
Description

drawContext

The drawContext used for rendering

x1

The x position of the top left corner of the rectangle

y1

The y position of the top left corner of the rectangle

x2

The x position of the bottom right corner of the rectangle

y2

The y position of the bottom right corner of the rectangle

color

The color to fill the rectangle with

drawText(DrawContext drawContext, TextRenderer textRenderer, String text, int x, int y, int color, boolean shadow)

Draws text on screen.

Parameter
Description

drawContext

The drawContext used for rendering

textRenderer

The TextRenderer instance used for rendering.

text

The text to be drawn.

x

The x position to draw at.

y

The y position to draw at.

color

The color to draw with.

fillRoundedRect(Matrix4f matrix4f, int x1, int y1, int x2, int y2, int cornerRadius, int color)

Fills a rounded rectangle on screen with specified color.

Note: This method causes a lot of problems and for some reason does not work for ArmorWidget when used for contextMenu.

Parameter
Description

matrix4f

Matrix4f used for rendering.

x1

X position of top left corner of rectangle.

y1

Y position of top left corner of rectangle.

x2

X position of bottom right corner of rectangle.

y2

Y position of bottom right corner of rectangle.

cornerRadius

Radius of rounded corners.

fillRoundedRect(DrawContext drawContext, int left, int top, int right, int bottom, int color)

Fills a rounded rectangle on screen with specified color.

Parameter
Description

drawContext

The drawContext used for rendering

left

The x position of the top left corner of the rectangle

top

The y position of the top left corner of the rectangle

right

The x position of the bottom right corner of the rectangle

bottom

The y position of the bottom right corner of the rectangle

color

The color to fill the rectangle with

fillGradient(Matrix4f matrix4f, int x1, int y1, int x2, int y2, int topColor, int bottomColor)

Fills a gradient on screen with specified colors.

Parameter
Description

matrix4f

Matrix4f used for rendering.

x1

The x position of the top left corner of the gradient

y1

The y position of the top left corner of the gradient

x2

The x position of the bottom right corner of the gradient

y2

The y position of the bottom right corner of the gradient

topColor

The color at the top of the gradient

bottomColor

The color at the bottom of the gradient

drawOutlinedBox(DrawContext drawContext, int x1, int y1, int x2, int y2, int color)

Draws an outlined box on screen.

Parameter
Description

drawContext

The drawContext used for rendering

x1

The x position of the top left corner of the box

y1

The y position of the top left corner of the box

x2

The x position of the bottom right corner of the box

y2

The y position of the bottom right corner of the box

color

The color to draw the box with

PreviousColorHelperNextTextureHelper