Search in sources :

Example 1 with Drawable

use of net.minecraft.client.gui.Drawable in project sodium-fabric by CaffeineMC.

the class SodiumOptionsGUI method rebuildGUI.

private void rebuildGUI() {
    this.controls.clear();
    this.children.clear();
    this.drawable.clear();
    if (this.currentPage == null) {
        if (this.pages.isEmpty()) {
            throw new IllegalStateException("No pages are available?!");
        }
        // Just use the first page for now
        this.currentPage = this.pages.get(0);
    }
    this.rebuildGUIPages();
    this.rebuildGUIOptions();
    this.applyButton = new FlatButtonWidget(new Rect2i(10, this.height - 30, 80, 20), "Apply", this::applyChanges);
    this.closeButton = new FlatButtonWidget(new Rect2i(96, this.height - 30, 80, 20), "Close", this::popScreen);
    this.children.add(this.applyButton);
    this.children.add(this.closeButton);
    this.resetButton = new FlatButtonWidget(new Rect2i(this.width - 96, this.height - 30, 80, 20), "Reset", this::resetChanges);
    this.children.add(this.resetButton);
    for (Element element : this.children) {
        if (element instanceof Drawable) {
            this.drawable.add((Drawable) element);
        }
    }
}
Also used : Rect2i(net.minecraft.client.util.Rect2i) ControlElement(me.jellysquid.mods.sodium.client.gui.options.control.ControlElement) Element(net.minecraft.client.gui.Element) Drawable(net.minecraft.client.gui.Drawable) FlatButtonWidget(me.jellysquid.mods.sodium.client.gui.widgets.FlatButtonWidget)

Example 2 with Drawable

use of net.minecraft.client.gui.Drawable in project sodium-fabric by CaffeineMC.

the class SodiumOptionsGUI method render.

@Override
public void render(int mouseX, int mouseY, float delta) {
    super.renderBackground();
    this.update(mouseX, mouseY, delta);
    for (Drawable drawable : this.drawable) {
        drawable.render(mouseX, mouseY, delta);
    }
}
Also used : Drawable(net.minecraft.client.gui.Drawable)

Aggregations

Drawable (net.minecraft.client.gui.Drawable)2 ControlElement (me.jellysquid.mods.sodium.client.gui.options.control.ControlElement)1 FlatButtonWidget (me.jellysquid.mods.sodium.client.gui.widgets.FlatButtonWidget)1 Element (net.minecraft.client.gui.Element)1 Rect2i (net.minecraft.client.util.Rect2i)1