v1.2.0: fixed errors with window offsetting and text input window
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.watabou.noosa.TextInput;
|
import com.watabou.noosa.TextInput;
|
||||||
@@ -33,6 +34,8 @@ public class WndTextInput extends Window {
|
|||||||
private static final int MARGIN = 2;
|
private static final int MARGIN = 2;
|
||||||
private static final int BUTTON_HEIGHT = 16;
|
private static final int BUTTON_HEIGHT = 16;
|
||||||
|
|
||||||
|
private TextInput textBox;
|
||||||
|
|
||||||
public WndTextInput(final String title, final String initialValue, final int maxLength,
|
public WndTextInput(final String title, final String initialValue, final int maxLength,
|
||||||
final boolean multiLine, final String posTxt, final String negTxt) {
|
final boolean multiLine, final String posTxt, final String negTxt) {
|
||||||
super();
|
super();
|
||||||
@@ -60,7 +63,7 @@ public class WndTextInput extends Window {
|
|||||||
add(txtTitle);
|
add(txtTitle);
|
||||||
|
|
||||||
int textSize = (int)PixelScene.uiCamera.zoom * (multiLine ? 6 : 9);
|
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
|
@Override
|
||||||
public void enterPressed() {
|
public void enterPressed() {
|
||||||
//triggers positive action on enter pressed, only with non-multiline though.
|
//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){ }
|
public void onSelect(boolean positive, String text){ }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user