forked from Clones/Controlify
compound binds, complete vanilla compat, better vmouse screen handling, controller uuid, beta notice screen, configurable movement keys, vmouse shift key, icon, optimize controller save/load
This commit is contained in:
@ -9,10 +9,12 @@ import net.minecraft.client.gui.GuiComponent;
|
||||
public class ButtonRenderer {
|
||||
public static final int BUTTON_SIZE = 22;
|
||||
|
||||
public static void drawButton(Bind button, Controller controller, PoseStack poseStack, int x, int y, int size) {
|
||||
public static void drawButton(Bind button, Controller controller, PoseStack poseStack, int x, int centerY) {
|
||||
RenderSystem.setShaderTexture(0, button.textureLocation(controller));
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
GuiComponent.blit(poseStack, x - size / 2, y - size / 2, 0, 0, BUTTON_SIZE, BUTTON_SIZE, BUTTON_SIZE, BUTTON_SIZE);
|
||||
GuiComponent.blit(poseStack, x, centerY - BUTTON_SIZE / 2, 0, 0, BUTTON_SIZE, BUTTON_SIZE, BUTTON_SIZE, BUTTON_SIZE);
|
||||
}
|
||||
|
||||
public record DrawSize(int width, int height) { }
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
package dev.isxander.controlify.gui.screen;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.gui.components.AccessibilityOnboardingTextWidget;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.MultiLineTextWidget;
|
||||
import net.minecraft.client.gui.layouts.FrameLayout;
|
||||
import net.minecraft.client.gui.layouts.GridLayout;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public class BetaNoticeScreen extends Screen {
|
||||
private MultiLineTextWidget textWidget;
|
||||
|
||||
public BetaNoticeScreen() {
|
||||
super(Component.translatable("controlify.beta.title"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
textWidget = new AccessibilityOnboardingTextWidget(
|
||||
font,
|
||||
Component.translatable("controlify.beta.message",
|
||||
Component.translatable("controlify.beta.message.link")
|
||||
.withStyle(ChatFormatting.AQUA)
|
||||
),
|
||||
this.width - 10
|
||||
);
|
||||
textWidget.setX(this.width / 2 - textWidget.getWidth() / 2);
|
||||
textWidget.setY(30);
|
||||
addRenderableWidget(textWidget);
|
||||
|
||||
addRenderableWidget(
|
||||
Button.builder(
|
||||
Component.translatable("controlify.beta.button"),
|
||||
btn -> Util.getPlatform().openUri("https://github.com/isXander/controlify/issues")
|
||||
)
|
||||
.pos(this.width / 2 - 75, this.height - 8 - 20 - 20 - 4)
|
||||
.width(150)
|
||||
.build()
|
||||
);
|
||||
addRenderableWidget(
|
||||
Button.builder(
|
||||
CommonComponents.GUI_CONTINUE,
|
||||
btn -> minecraft.setScreen(new TitleScreen())
|
||||
)
|
||||
.pos(this.width / 2 - 75, this.height - 8 - 20)
|
||||
.width(150)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user