Skip to content

Commit

Permalink
change: Fix minor visual bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
FlashyReese committed Aug 12, 2021
1 parent a354192 commit ef9f07e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.1
yarn_mappings=1.17.1+build.37
loader_version=0.11.6
# Mod Properties
mod_version=1.1.3
mod_version=1.1.5
maven_group=me.flashyreese.mods
archives_base_name=reeses_sodium_options

# Dependency
sodium_version=0d47105006
sodium_version=e339c28981
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ private void renderSlider(MatrixStack matrixStack) {
int sliderWidth = this.sliderBounds.getWidth();
int sliderHeight = this.sliderBounds.getHeight();

int thumbOffset = (int) Math.floor((double) (this.getIntValue() - this.min) / this.range * sliderWidth);
this.thumbPosition = this.getThumbPositionForValue(option.getValue());

double thumbOffset = MathHelper.clamp((double) (this.getIntValue() - this.min) / this.range * sliderWidth, 0, sliderWidth);

int thumbX = sliderX + thumbOffset - THUMB_WIDTH;
int trackY = sliderY + (sliderHeight / 2) - TRACK_HEIGHT;
double thumbX = sliderX + thumbOffset - THUMB_WIDTH;
double trackY = sliderY + (sliderHeight / 2D) - ((double) TRACK_HEIGHT / 2);

this.drawRect(thumbX, sliderY, thumbX + (THUMB_WIDTH * 2), sliderY + sliderHeight, 0xFFFFFFFF);
this.drawRect(sliderX, trackY, sliderX + sliderWidth, trackY + TRACK_HEIGHT, 0xFFFFFFFF);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void init() {
protected BasicFrame.Builder parentFrameBuilder() {
BasicFrame.Builder basicFrameBuilder;

Dim2i basicFrameDim = new Dim2i(0, 0, this.width, this.height);
Dim2i basicFrameDim = new Dim2i(0, 0, this.client.getWindow().getScaledWidth(), this.client.getWindow().getScaledHeight());
Dim2i tabFrameDim = new Dim2i(basicFrameDim.width() / 4 / 2, basicFrameDim.height() / 4 / 2, basicFrameDim.width() / 4 * 3, basicFrameDim.height() / 4 * 3);

Dim2i undoButtonDim = new Dim2i(tabFrameDim.getLimitX() - 203, tabFrameDim.getLimitY() + 5, 65, 20);
Expand Down Expand Up @@ -110,7 +110,7 @@ protected BasicFrame.Builder parentFrameBuilder() {
try {
Class<? extends Screen> screen = (Class<? extends Screen>) Class.forName("net.coderbot.iris.gui.screen.ShaderPackScreen");
Screen instance = screen.getDeclaredConstructor(Screen.class).newInstance(this);
this.client.openScreen(instance);
this.client.setScreen(instance);
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -214,7 +214,7 @@ private void undoChanges() {
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (keyCode == GLFW.GLFW_KEY_P && (modifiers & GLFW.GLFW_MOD_SHIFT) != 0) {
MinecraftClient.getInstance().openScreen(new VideoOptionsScreen(this.prevScreen, MinecraftClient.getInstance().options));
MinecraftClient.getInstance().setScreen(new VideoOptionsScreen(this.prevScreen, MinecraftClient.getInstance().options));

return true;
}
Expand All @@ -229,6 +229,6 @@ public boolean shouldCloseOnEsc() {

@Override
public void onClose() {
this.client.openScreen(this.prevScreen);
this.client.setScreen(this.prevScreen);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package me.flashyreese.mods.reeses_sodium_options.mixin.sodium;

import me.flashyreese.mods.reeses_sodium_options.client.gui.SodiumVideoOptionsScreen;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.OptionsScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
Expand All @@ -21,7 +20,7 @@ protected MixinOptionsScreen(Text title) {
@Dynamic
@Inject(method = "method_19828(Lnet/minecraft/client/gui/widget/ButtonWidget;)V", at = @At("HEAD"), cancellable = true)
private void open(ButtonWidget widget, CallbackInfo ci) {
this.client.openScreen(new SodiumVideoOptionsScreen(this));
this.client.setScreen(new SodiumVideoOptionsScreen(this));

ci.cancel();
}
Expand Down

0 comments on commit ef9f07e

Please sign in to comment.