From 0ef780c2c2fb41d782a03b5e0b35df67a8837e45 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 4 Feb 2022 15:36:51 -0500 Subject: [PATCH] v1.2.0: fixed errors with window offsetting and text input window --- .../shatteredpixeldungeon/ui/WndTextInput.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/WndTextInput.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/WndTextInput.java index 4f2f69caf..9e312a198 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/WndTextInput.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/WndTextInput.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.ui; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.shatteredpixel.shatteredpixeldungeon.Chrome; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.watabou.noosa.TextInput; @@ -33,6 +34,8 @@ public class WndTextInput extends Window { private static final int MARGIN = 2; private static final int BUTTON_HEIGHT = 16; + private TextInput textBox; + public WndTextInput(final String title, final String initialValue, final int maxLength, final boolean multiLine, final String posTxt, final String negTxt) { super(); @@ -60,7 +63,7 @@ public class WndTextInput extends Window { add(txtTitle); int textSize = (int)PixelScene.uiCamera.zoom * (multiLine ? 6 : 9); - final TextInput textBox = new TextInput(Chrome.get(Chrome.Type.TOAST_WHITE), multiLine, textSize){ + textBox = new TextInput(Chrome.get(Chrome.Type.TOAST_WHITE), multiLine, textSize){ @Override public void enterPressed() { //triggers positive action on enter pressed, only with non-multiline though. @@ -125,6 +128,12 @@ public class WndTextInput extends Window { } + @Override + public void offset(int xOffset, int yOffset) { + super.offset(xOffset, yOffset); + textBox.setRect(textBox.left(), textBox.top(), textBox.width(), textBox.height()); + } + public void onSelect(boolean positive, String text){ } @Override