aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/elements/text
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-07-21 04:04:48 +0900
committerGitHub <noreply@github.com>2022-07-20 20:04:48 +0100
commitf06946c01b2c8f210b398a16610c260eca093a8b (patch)
tree22bda7a5e9b0a1e7370ff2b1e74fc7c9e4035379 /src/main/java/cc/polyfrost/oneconfig/gui/elements/text
parentff2ead62333e90b61e05c8cb6a91f692fcf30805 (diff)
downloadOneConfig-f06946c01b2c8f210b398a16610c260eca093a8b.tar.gz
OneConfig-f06946c01b2c8f210b398a16610c260eca093a8b.tar.bz2
OneConfig-f06946c01b2c8f210b398a16610c260eca093a8b.zip
HUD Improvements, 1.16 port, fix NanoVG with ARM (#52)
* egg 1 * separate Hud from background stuff * 1984 This reverts commit 9ae517d57bbd495d30d35cb1cbfe81a03556e6bd. * hitboxes woo!!!!! * Revert "hitboxes woo!!!!!" This reverts commit 405d32d17df3c83f2e79eddf0de853f7279767a6. * padding * allow position to go slightly off the screen * stop using ints for ABSOLUTELY EVERYTHING, DIAMOND ... fix vigilance compat not setting color * start on new pos system * some stuff * finish new position system * api momento * 1.16.2 fabric port * start on hud gui * temp remove 1.16.2 fabric since it doesn't compile * fix fabric build * hud gui stuff * apiDump * fix fabric build 2 * so true * selecting stuff * scaling + other small things * More protecting * fix nanovg not working with macOS ARM move OneConfig.preLaunch to OneConfigInit * clean up OneUIScreen make kotlin version of TestNanoVGGui * make keybinds have runnable by default * rollback keybind things * merge master into hud-improvements (#55) * Release workflow (#53) * release workflow * update normal version to hash * fix * fix naming * fix some stuff * fix version thing * switch to number from hash * Release workflow (#54) * release workflow * update normal version to hash * fix * fix naming * fix some stuff * fix version thing * switch to number from hash * Maybe epic fixo * gotta love those Java principles * Revert "gotta love those Java principles", wrong branch This reverts commit 333d8b2ad8941790c13c4bfe0777fbd203d463e5. * start on snapping * Finish snapping * stop including mixin by default on legacy versions this breaks builds if the mod itself does not use mixin * merge draw and drawExample * fix gradle publish * Some fixes * Api DUmpidy * Help subcommand impovments (#59) * Made the overall look of the "help" subcommand better + added the ability to change the colour for the command overall + each individual SubCommand * Made the alliases show batter + added support for to show subcommand aliasses * mr deliverer didnt reply but whatever, added a space between command/subcommand and alliasses Co-authored-by: pinkulu <pinkulumc@gmail.com> * fix file not overwriting toJavaColor * Fix full shadow not scaling correctly Co-authored-by: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Co-authored-by: nxtdaydelivery <12willettsh@gmail.com> Co-authored-by: pinkulu <56201697+pinkulu@users.noreply.github.com> Co-authored-by: pinkulu <pinkulumc@gmail.com>
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements/text')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java14
2 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java
index d7e29f5..5162ecb 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java
@@ -27,7 +27,7 @@ public class NumberInputField extends TextInputField {
}
@Override
- public void draw(long vg, int x, int y) {
+ public void draw(long vg, float x, float y) {
super.errored = false;
if(disabled) RenderManager.setAlpha(vg, 0.5f);
RenderManager.drawRoundedRect(vg, x + width + 4, y, 12, 28, Colors.GRAY_500, 6f);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
index 054915c..3c2cb1c 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
@@ -26,7 +26,7 @@ public class TextInputField extends BasicElement {
protected boolean password;
protected int caretPos;
- protected int x, y;
+ protected float x, y;
protected float start, end;
protected int startLine, endLine;
protected long vg;
@@ -95,7 +95,7 @@ public class TextInputField extends BasicElement {
}
@Override
- public void draw(long vg, int x, int y) {
+ public void draw(long vg, float x, float y) {
this.x = x;
this.y = y;
this.vg = vg;
@@ -206,12 +206,12 @@ public class TextInputField extends BasicElement {
if(disabled) RenderManager.setAlpha(vg, 0.5f);
if (toggled) {
if (multiLine) {
- int lineY = y + 20 + getCaretLine(caretPos) * 24;
+ float lineY = y + 20 + getCaretLine(caretPos) * 24;
RenderManager.drawLine(vg, x + width + 12, lineY - 10, x + width + 12, lineY + 10, 1, Colors.WHITE);
} else if (!centered) {
- RenderManager.drawLine(vg, x + width + 12, (float) y + height / 2f - 10, x + width + 12, (float) y + height / 2f + 10, 1, Colors.WHITE);
+ RenderManager.drawLine(vg, x + width + 12, y + height / 2f - 10, x + width + 12, y + height / 2f + 10, 1, Colors.WHITE);
} else {
- RenderManager.drawLine(vg, x + this.width / 2f - halfTextWidth + width, (float) y + height / 2f - 10, x + this.width / 2f - halfTextWidth + width, (float) y + height / 2f + 10, 1, Colors.WHITE);
+ RenderManager.drawLine(vg, x + this.width / 2f - halfTextWidth + width, y + height / 2f - 10, x + this.width / 2f - halfTextWidth + width, y + height / 2f + 10, 1, Colors.WHITE);
}
}
@@ -228,7 +228,7 @@ public class TextInputField extends BasicElement {
if (!password) {
if (multiLine) {
- int textY = y + 20;
+ float textY = y + 20;
for (String line : wrappedText) {
RenderManager.drawText(vg, line, x + 12, textY, color, 14f, Fonts.REGULAR);
textY += 24;
@@ -453,7 +453,7 @@ public class TextInputField extends BasicElement {
}
}
- private int calculatePos(int pos, String string) {
+ private int calculatePos(float pos, String string) {
if (centered) pos -= 12;
String s1 = "";
int i;