aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CREDITS.txt2
-rw-r--r--build.gradle4
-rw-r--r--gradle.properties8
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin59536 -> 61574 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties3
-rwxr-xr-xgradlew28
-rw-r--r--gradlew.bat181
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java24
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java17
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java12
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/client/MouseInputHandler.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/client/WidgetTextures.java56
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/mixin/client/PressableWidgetAccessor.java15
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/mixin/client/SliderWidgetAccessor.java25
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java33
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java33
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java43
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollPanel.java13
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java9
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/data/InputResult.java12
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/button_dark.pngbin0 -> 3228 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/button_dark.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/button_disabled_dark.pngbin0 -> 2107 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/button_disabled_dark.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/button_highlighted_dark.pngbin0 -> 3233 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/button_highlighted_dark.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/panel_dark.png (renamed from src/main/resources/assets/libgui/textures/widget/panel_dark.png)bin1644 -> 1644 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/panel_dark.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/panel_light.png (renamed from src/main/resources/assets/libgui/textures/widget/panel_light.png)bin650 -> 650 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/panel_light.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/background_dark.png (renamed from src/main/resources/assets/libgui/textures/widget/scroll_bar/background_dark.png)bin165 -> 165 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/background_dark.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/background_light.png (renamed from src/main/resources/assets/libgui/textures/widget/scroll_bar/background_light.png)bin159 -> 159 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/background_light.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/focus.png (renamed from src/main/resources/assets/libgui/textures/widget/scroll_bar/focus.png)bin156 -> 156 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/focus.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_dark.png (renamed from src/main/resources/assets/libgui/textures/widget/scroll_bar/scroll_bar_dark.png)bin164 -> 164 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_dark.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_hovered_dark.png (renamed from src/main/resources/assets/libgui/textures/widget/scroll_bar/scroll_bar_hovered_dark.png)bin164 -> 164 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_hovered_dark.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_hovered_light.png (renamed from src/main/resources/assets/libgui/textures/widget/scroll_bar/scroll_bar_hovered_light.png)bin164 -> 164 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_hovered_light.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_light.png (renamed from src/main/resources/assets/libgui/textures/widget/scroll_bar/scroll_bar_light.png)bin162 -> 162 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_light.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_pressed_dark.png (renamed from src/main/resources/assets/libgui/textures/widget/scroll_bar/scroll_bar_pressed_dark.png)bin164 -> 164 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_pressed_dark.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_pressed_light.png (renamed from src/main/resources/assets/libgui/textures/widget/scroll_bar/scroll_bar_pressed_light.png)bin161 -> 161 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/scroll_bar/thumb_pressed_light.png.mcmeta10
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/slider_handle_dark.pngbin0 -> 748 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/slider_handle_dark.png.mcmeta15
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/slider_handle_highlighted_dark.pngbin0 -> 748 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/gui/sprites/widget/slider_handle_highlighted_dark.png.mcmeta15
-rw-r--r--src/main/resources/assets/libgui/textures/widget/dark_widgets.pngbin5798 -> 0 bytes
-rw-r--r--src/main/resources/fabric.mod.json6
-rw-r--r--src/main/resources/mixins.libgui.json4
-rw-r--r--src/testMod/java/io/github/cottonmc/test/client/DarkModeTestGui.java1
58 files changed, 488 insertions, 225 deletions
diff --git a/CREDITS.txt b/CREDITS.txt
index a8bfbd8..439466e 100644
--- a/CREDITS.txt
+++ b/CREDITS.txt
@@ -1 +1 @@
-- Dark-mode button textures (dark_widgets.png) are adapted from Roughly Enough Items by shedaniel, licensed under MIT
+- Dark-mode button textures (button*_dark.png) are adapted from Roughly Enough Items by shedaniel, licensed under MIT
diff --git a/build.gradle b/build.gradle
index 24bc15c..6c4e13f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,6 @@
plugins {
- id 'fabric-loom' version '1.1.+'
- id 'io.github.juuxel.loom-quiltflower' version '1.8.0'
+ id 'fabric-loom' version '1.3.+'
+ id 'io.github.juuxel.loom-vineflower' version '1.11.0'
id 'maven-publish'
id 'checkstyle'
}
diff --git a/gradle.properties b/gradle.properties
index f2c6280..8d625e1 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/develop
- minecraft_version=1.20.1
- yarn_mappings=1.20.1+build.10
- loader_version=0.14.21
+ minecraft_version=1.20.2-pre2
+ yarn_mappings=1.20.2-pre2+build.3
+ loader_version=0.14.22
# Mod Properties
mod_version = 8.1.0
@@ -13,7 +13,7 @@ org.gradle.jvmargs=-Xmx1G
archives_base_name = LibGui
# Dependencies
- fabric_version=0.86.1+1.20.1
+ fabric_version=0.88.3+1.20.2
jankson_version=6.0.0+j1.2.3
modmenu_version=7.0.1
libninepatch_version=1.2.0
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 7454180..943f0cb 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 070cb70..c30b486 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
+networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index c53aefa..65dcd68 100755
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright © 2015-2021 the original authors.
+# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
-# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
-# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
-# * compound commands having a testable exit status, especially «case»;
-# * various built-in commands including «command», «set», and «ulimit».
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
esac
done
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-
-APP_NAME="Gradle"
+# This is normally unused
+# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
diff --git a/gradlew.bat b/gradlew.bat
index 107acd3..6689b85 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,89 +1,92 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java b/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java
index f3df523..52bd317 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java
@@ -10,6 +10,7 @@ import io.github.cottonmc.cotton.gui.widget.data.Texture;
import juuxel.libninepatch.NinePatch;
import juuxel.libninepatch.TextureRegion;
+import java.util.Objects;
import java.util.function.Consumer;
/**
@@ -31,8 +32,8 @@ public interface BackgroundPainter {
/**
* The {@code VANILLA} background painter draws a vanilla-like GUI panel using nine-patch textures.
*
- * <p>This background painter uses {@code libgui:textures/widget/panel_light.png} as the light texture and
- * {@code libgui:textures/widget/panel_dark.png} as the dark texture.
+ * <p>This background painter uses {@code libgui:textures/gui/sprites/widget/panel_light.png} as the light texture and
+ * {@code libgui:textures/gui/sprites/widget/panel_dark.png} as the dark texture.
*
* <p>This background painter is the default painter for root panels.
* * You can override {@link io.github.cottonmc.cotton.gui.GuiDescription#addPainters()} to customize the painter yourself.
@@ -40,8 +41,8 @@ public interface BackgroundPainter {
* @since 1.5.0
*/
public static BackgroundPainter VANILLA = createLightDarkVariants(
- createNinePatch(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/panel_light.png")),
- createNinePatch(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/panel_dark.png"))
+ createGuiSprite(new Identifier(LibGuiCommon.MOD_ID, "widget/panel_light")),
+ createGuiSprite(new Identifier(LibGuiCommon.MOD_ID, "widget/panel_dark"))
);
/**
@@ -158,4 +159,19 @@ public interface BackgroundPainter {
else light.paintBackground(context, left, top, panel);
};
}
+
+ /**
+ * Creates a background painter that uses a texture from the GUI atlas.
+ *
+ * <p>This method can be used to draw tiled or nine-slice GUI sprites from resource packs
+ * as a simpler and more data-driven alternative to {@link #createNinePatch(Identifier)}.
+ *
+ * @param texture the texture ID
+ * @return a new background painter that uses a GUI sprite
+ * @since 9.0.0
+ */
+ static BackgroundPainter createGuiSprite(Identifier texture) {
+ Objects.requireNonNull(texture, "Texture cannot be null");
+ return (context, left, top, panel) -> context.drawGuiTexture(texture, left, top, panel.getWidth(), panel.getHeight());
+ }
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
index 877528c..071bb39 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
@@ -123,10 +123,13 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl {
}
}
- private void paint(DrawContext context, int mouseX, int mouseY) {
- renderBackground(context);
+ private void paint(DrawContext context, int mouseX, int mouseY, float delta) {
+ renderBackground(context, mouseX, mouseY, delta);
if (description!=null) {
+ context.getMatrices().push();
+ context.getMatrices().translate(0f, 0f, 0.01f);
+
WPanel root = description.getRootPanel();
if (root!=null) {
GL11.glEnable(GL11.GL_SCISSOR_TEST);
@@ -140,12 +143,14 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl {
int width = description.getRootPanel().getWidth();
ScreenDrawing.drawString(context, getTitle().asOrderedText(), description.getTitleAlignment(), left + titleX, top + titleY, width - 2 * titleX, description.getTitleColor());
}
+
+ context.getMatrices().pop();
}
}
@Override
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
- paint(context, mouseX, mouseY);
+ paint(context, mouseX, mouseY, partialTicks);
super.render(context, mouseX, mouseY, partialTicks);
@@ -207,12 +212,12 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl {
}
@Override
- public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
- super.mouseScrolled(mouseX, mouseY, amount);
+ public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) {
+ super.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount);
int containerX = (int)mouseX-left;
int containerY = (int)mouseY-top;
- mouseInputHandler.onMouseScroll(containerX, containerY, amount);
+ mouseInputHandler.onMouseScroll(containerX, containerY, horizontalAmount, verticalAmount);
return true;
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
index b1ed4ce..3d807e0 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
@@ -223,12 +223,12 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl
}
@Override
- public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
- super.mouseScrolled(mouseX, mouseY, amount);
+ public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) {
+ super.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount);
int containerX = (int)mouseX-x;
int containerY = (int)mouseY-y;
- mouseInputHandler.onMouseScroll(containerX, containerY, amount);
+ mouseInputHandler.onMouseScroll(containerX, containerY, horizontalAmount, verticalAmount);
return true;
}
@@ -275,8 +275,8 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl
@Override
protected void drawBackground(DrawContext context, float partialTicks, int mouseX, int mouseY) {} //This is just an AbstractContainerScreen thing; most Screens don't work this way.
- private void paint(DrawContext context, int mouseX, int mouseY) {
- renderBackground(context);
+ private void paint(DrawContext context, int mouseX, int mouseY, float delta) {
+ renderBackground(context, mouseX, mouseY, delta);
if (description!=null) {
WPanel root = description.getRootPanel();
@@ -292,7 +292,7 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl
@Override
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
- paint(context, mouseX, mouseY);
+ paint(context, mouseX, mouseY, partialTicks);
super.render(context, mouseX, mouseY, partialTicks);
DiffuseLighting.disableGuiDepthLighting(); //Needed because super.render leaves dirty state
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/MouseInputHandler.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/MouseInputHandler.java
index 0814e16..15aa875 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/MouseInputHandler.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/MouseInputHandler.java
@@ -85,10 +85,10 @@ public final class MouseInputHandler<S extends Screen & CottonScreenImpl> {
}
}
- public void onMouseScroll(int containerX, int containerY, double amount) {
+ public void onMouseScroll(int containerX, int containerY, double horizontalAmount, double verticalAmount) {
runTree(
screen.getDescription().getRootPanel().hit(containerX, containerY),
- widget -> widget.onMouseScroll(containerX - widget.getAbsoluteX(), containerY - widget.getAbsoluteY(), amount)
+ widget -> widget.onMouseScroll(containerX - widget.getAbsoluteX(), containerY - widget.getAbsoluteY(), horizontalAmount, verticalAmount)
);
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/WidgetTextures.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/WidgetTextures.java
new file mode 100644
index 0000000..75975b2
--- /dev/null
+++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/WidgetTextures.java
@@ -0,0 +1,56 @@