v0.9.4: fixed iOS text input errors
This commit is contained in:
parent
603f91d10f
commit
285dd374b3
|
@ -122,6 +122,7 @@ public class Game implements ApplicationListener {
|
|||
Vertexbuffer.refreshAllBuffers();
|
||||
}
|
||||
|
||||
height -= bottomInset;
|
||||
if (height != Game.height || width != Game.width) {
|
||||
|
||||
Game.width = width;
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.watabou.noosa;
|
|||
|
||||
import com.badlogic.gdx.Files;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
|
@ -12,6 +13,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextField;
|
|||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
||||
import com.watabou.glscripts.Script;
|
||||
import com.watabou.glwrap.Blending;
|
||||
import com.watabou.glwrap.Quad;
|
||||
|
@ -36,7 +38,12 @@ public class TextInput extends Component {
|
|||
this.bg = bg;
|
||||
add(bg);
|
||||
|
||||
stage = new Stage(new ScreenViewport());
|
||||
//use a custom viewport here to ensure stage camera matches game camera
|
||||
Viewport viewport = new Viewport() {};
|
||||
viewport.setWorldSize(Game.width, Game.height);
|
||||
viewport.setScreenBounds(0, Game.bottomInset, Game.width, Game.height);
|
||||
viewport.setCamera(new OrthographicCamera());
|
||||
stage = new Stage(viewport);
|
||||
Game.inputHandler.addInputProcessor(stage);
|
||||
|
||||
container = new Container<TextField>();
|
||||
|
|
|
@ -33,8 +33,9 @@ public class IOSPlatformSupport extends PlatformSupport {
|
|||
}
|
||||
|
||||
if (!SPDSettings.fullscreen()) {
|
||||
int insetChange = Gdx.graphics.getSafeInsetBottom() - Game.bottomInset;
|
||||
Game.bottomInset = Gdx.graphics.getSafeInsetBottom();
|
||||
Game.height -= Game.bottomInset;
|
||||
Game.height -= insetChange;
|
||||
Game.dispHeight = Game.height;
|
||||
} else {
|
||||
Game.height += Game.bottomInset;
|
||||
|
@ -46,8 +47,11 @@ public class IOSPlatformSupport extends PlatformSupport {
|
|||
|
||||
@Override
|
||||
public void updateSystemUI() {
|
||||
int prevInset = Game.bottomInset;
|
||||
updateDisplaySize();
|
||||
ShatteredPixelDungeon.seamlessResetScene();
|
||||
if (prevInset != Game.bottomInset) {
|
||||
ShatteredPixelDungeon.seamlessResetScene();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user