resize doesn't switch back to main page now
This commit is contained in:
parent
75387661d2
commit
d07ecc32f8
@ -20,6 +20,7 @@ public class Page extends Group implements Disposable {
|
|||||||
setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
setTouchable(Touchable.childrenOnly);
|
setTouchable(Touchable.childrenOnly);
|
||||||
setToBasePosition();
|
setToBasePosition();
|
||||||
|
setName(getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page(int baseXPos, int baseYPos, String titleText, Skin skin) {
|
public Page(int baseXPos, int baseYPos, String titleText, Skin skin) {
|
||||||
|
@ -25,7 +25,7 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
private Stage stage;
|
private Stage stage;
|
||||||
private Vector3 cameraPosition;
|
private Vector3 cameraPosition;
|
||||||
private PageChangeListeners listeners;
|
private PageChangeListeners listeners;
|
||||||
|
private String selectedPage;
|
||||||
private MainPage mainPage;
|
private MainPage mainPage;
|
||||||
private OptionsPage optionsPage;
|
private OptionsPage optionsPage;
|
||||||
private KeybindPage keybindPage;
|
private KeybindPage keybindPage;
|
||||||
@ -75,11 +75,10 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
} else {
|
} else {
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (stage.getCamera().position.x != cameraPosition.x || stage.getCamera().position.y != cameraPosition.y) {
|
if (stage.getCamera().position.x != cameraPosition.x || stage.getCamera().position.y != cameraPosition.y) {
|
||||||
stage.getCamera().position.lerp(cameraPosition, 0.15f);
|
stage.getCamera().position.lerp(cameraPosition, 0.15f);
|
||||||
stage.getViewport().apply();
|
stage.getViewport().apply();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
super.render(delta);
|
super.render(delta);
|
||||||
}
|
}
|
||||||
@ -135,6 +134,15 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
stage.addActor(analysisPage);
|
stage.addActor(analysisPage);
|
||||||
|
|
||||||
musicController.getMusicList().attemptAsyncSearch(false);
|
musicController.getMusicList().attemptAsyncSearch(false);
|
||||||
|
|
||||||
|
if (selectedPage != null) {
|
||||||
|
for (Actor actor : stage.getActors().items) {
|
||||||
|
if (actor.getName().equals(selectedPage)) {
|
||||||
|
setDisplayedPage((Page) actor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -159,8 +167,6 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
@Override
|
@Override
|
||||||
public void resize(int width, int height) {
|
public void resize(int width, int height) {
|
||||||
stage.getViewport().update(width, height, false);
|
stage.getViewport().update(width, height, false);
|
||||||
cameraPosition.x = width/2;
|
|
||||||
cameraPosition.y = height/2;
|
|
||||||
super.resize(width, height);
|
super.resize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +180,9 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setDisplayedPage(Page page) {
|
public void setDisplayedPage(Page page) {
|
||||||
|
Gdx.app.debug("Mainscreen", "Switching to " + page.getName());
|
||||||
page.setCameraPositionToPage(cameraPosition);
|
page.setCameraPositionToPage(cameraPosition);
|
||||||
|
this.selectedPage = page.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PageChangeListeners {
|
private class PageChangeListeners {
|
||||||
|
Loading…
Reference in New Issue
Block a user