mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-17 08:55:10 +01:00
✨ Add icons in controls menu.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright © 2019 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of LambdaControls.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package me.lambdaurora.lambdacontrols.gui;
|
||||
|
||||
import me.lambdaurora.lambdacontrols.ButtonBinding;
|
||||
import me.lambdaurora.lambdacontrols.LambdaControls;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents a controller button widget.
|
||||
*/
|
||||
public class ControllerButtonWidget extends AbstractIconButtonWidget
|
||||
{
|
||||
private ButtonBinding binding;
|
||||
|
||||
public ControllerButtonWidget(int x, int y, int width, @NotNull ButtonBinding button_binding, @NotNull PressAction on_press)
|
||||
{
|
||||
super(x, y, width, 20, ButtonBinding.get_localized_button_name(button_binding.get_button()), on_press);
|
||||
this.binding = button_binding;
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
this.setMessage(ButtonBinding.get_localized_button_name(binding.get_button()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int render_icon(int mouse_x, int mouse_y, float delta, int x, int y)
|
||||
{
|
||||
return LambdaControls.draw_button(x, y, this.binding, MinecraftClient.getInstance());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user