Skip to content

Graphics Engine Wrapper

Compare
Choose a tag to compare
@gomoritz gomoritz released this 04 Jun 20:15
· 868 commits to master since this release

In this release, a Graphics Engine Wrapper has been implemented supporting features like animations, widgets and text fields.

Graphics Engine

The Graphics Engine allows the developer to easily create UIs based on Widgets. These widgets can have a state and can be animated.

Primitive Widgets

There are 6 primitive Widgets:

  • Arc
  • Circle
  • Filled Circle (extends Circle)
  • Line
  • Rectangle
  • Text Renderer

Assembled Widgets

Multiple widgets can be assembled in order to create a new widget. These widgets are called Assembled Widgets. There are currently 2 of them:

  • Rounded Rectangle
  • Text Field

Structure

In order to provide type-safe implementations of different features and animations, all widgets are built up on a base structure. There are 7 interfaces that specify how the widget behaves:

  • Align
  • Color
  • Dimension
  • Draw (implemented in every widget)
  • Outline
  • Position
  • Size

Animations

Animations are grouped in three categories: in, out and alter. While the alter-animations only modify the state of the widget, the in- and out-animations change the visibility state of the widget. There are currently 3 animations:

  • [in] FloatAnimationIn
  • [out] FloatAnimationOut
  • [alter] MorphAnimation (provides a smooth transition between two widgets of the same type)

Sequences

In order to provide fluent transitions between two values of the same type, we introduced sequences. These sequences interpolate between two values and can even have easing functions. While the default sequence is not bound to a type, there are two implemented sequences:

  • DoubleSequence
  • WidgetColorSequence

Font

All stuff that is related to drawing text on the screen has been moved to the font package. A new class called WidgetFont has been introduced that holds a font that can be rendered.

Debug Mode

The graphics engine also contains a debug mode, that helps developers build UIs for the mod. It can be activated with Ctrl + Alt + Shift + ..

Features

  • Added multiple choice option entries to the Mod Options UI
  • Option sliders can now be controlled with the arrow keys

Design

  • Added an About Screen: it can be accessed from the Main and Ingame Menu

Development

  • Since Kotlin isn't interoperable with Lombok, it has been removed from the classpath.

Issues

  • Transitions are now thread-safe
  • Removed an offset appearing when using the borderless window mode
  • Enabled logging when launched from the Minecraft launcher
  • Fixed the about screen causing the game to crash when below a certain size
  • Fixed chat closing animation
  • Increased the delay between the firing of Discord Rich Presence Callbacks (to 10 seconds)