multiple adjustements made for ui resizing
This commit is contained in:
parent
0cab95a3fb
commit
ca8e4c16d7
@ -55,13 +55,7 @@ public class ScrollText extends Widget {
|
|||||||
|
|
||||||
this.scrollOnHover = scrollOnHover;
|
this.scrollOnHover = scrollOnHover;
|
||||||
|
|
||||||
if (text1 == null) {
|
|
||||||
text1 = "";
|
|
||||||
}
|
|
||||||
setText(text1, text2);
|
|
||||||
|
|
||||||
coords = new Vector2();
|
coords = new Vector2();
|
||||||
|
|
||||||
addListener(new ClickListener() {
|
addListener(new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
|
||||||
@ -79,6 +73,9 @@ public class ScrollText extends Widget {
|
|||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setText(text1, text2);
|
||||||
|
layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getFontHeight() {
|
public float getFontHeight() {
|
||||||
@ -95,6 +92,8 @@ public class ScrollText extends Widget {
|
|||||||
setHeight(textHeight + 4);
|
setHeight(textHeight + 4);
|
||||||
}
|
}
|
||||||
clipBounds.setSize(getWidth()-2, getHeight()*1.5f);
|
clipBounds.setSize(getWidth()-2, getHeight()*1.5f);
|
||||||
|
|
||||||
|
text2Offset = clipBounds.getWidth();
|
||||||
super.layout();
|
super.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||||
|
|
||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
@ -15,6 +16,7 @@ public class KeybindOptionsPage extends Page {
|
|||||||
private KeyMap keyMap;
|
private KeyMap keyMap;
|
||||||
private TextButton backButton;
|
private TextButton backButton;
|
||||||
public KeybindOptionsPage(Skin skin, AssetManager assets, Vector3 cameraPosition) {
|
public KeybindOptionsPage(Skin skin, AssetManager assets, Vector3 cameraPosition) {
|
||||||
|
setTextureBackground(assets.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
|
||||||
keyMap = new KeyMap(assets);
|
keyMap = new KeyMap(assets);
|
||||||
controlTable = new ControlOptions(skin, keyMap);
|
controlTable = new ControlOptions(skin, keyMap);
|
||||||
|
|
||||||
|
@ -83,19 +83,17 @@ public class MainPage extends Page implements OnDifferentSongListener {
|
|||||||
table.add(quitButton).fillX();
|
table.add(quitButton).fillX();
|
||||||
|
|
||||||
musicControls = new MusicControls(core.getDefaultSkin(), sc);
|
musicControls = new MusicControls(core.getDefaultSkin(), sc);
|
||||||
musicControls.setPosition((getWidth()-musicControls.getMinWidth() - 20f), getHeight()-musicControls.getMinHeight());
|
musicControls.setPosition((getWidth()-musicControls.getMinWidth() - 20f), getHeight()-musicControls.getMinHeight()*0.8f);
|
||||||
musicControls.invalidate();
|
musicControls.invalidate();
|
||||||
addActor(musicControls);
|
addActor(musicControls);
|
||||||
|
|
||||||
scrollText = new ScrollText("...", "...", core.getDefaultSkin(), false, true);
|
scrollText = new ScrollText("...", "...", core.getDefaultSkin(), false, true);
|
||||||
scrollText.setWidth((0.4f * getWidth()));
|
scrollText.setWidth((0.4f * getWidth()));
|
||||||
scrollText.setHeight(musicControls.getMinHeight());
|
scrollText.setPosition(((getWidth() - scrollText.getWidth())/2f), getHeight() - scrollText.getHeight()*1.5f);
|
||||||
scrollText.setPosition(((getWidth() - scrollText.getWidth())/2f), getHeight() - scrollText.getFontHeight()*1.5f);
|
|
||||||
if (scrollText.getX() + scrollText.getWidth() > musicControls.getX()) {
|
if (scrollText.getX() + scrollText.getWidth() > musicControls.getX()) {
|
||||||
Gdx.app.debug("MainPage", "using minimal layout for scrolling text.");
|
Gdx.app.debug("MainPage", "using minimal layout for scrolling text.");
|
||||||
musicControls.setX(getWidth() - musicControls.getMinWidth() - 10f);
|
musicControls.setX(getWidth() - musicControls.getMinWidth() - 10f);
|
||||||
scrollText.setPosition(15, getHeight() - scrollText.getHeight() - 15f);
|
scrollText.setPosition(15, getHeight() - scrollText.getHeight() - 15f);
|
||||||
musicControls.setY(scrollText.getY() + 22f);
|
|
||||||
musicControls.invalidate();
|
musicControls.invalidate();
|
||||||
}
|
}
|
||||||
scrollText.invalidate();
|
scrollText.invalidate();
|
||||||
|
@ -2,6 +2,7 @@ package zero1hd.rhythmbullet.graphics.ui.pages;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input.Keys;
|
import com.badlogic.gdx.Input.Keys;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.Preferences;
|
import com.badlogic.gdx.Preferences;
|
||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
@ -31,7 +32,7 @@ public class OptionsPage extends Page {
|
|||||||
private float musicSearchTimer;
|
private float musicSearchTimer;
|
||||||
public OptionsPage(RhythmBullet core, Vector3 targetPosition, KeybindOptionsPage moreOptionsPage, SongListController sc) {
|
public OptionsPage(RhythmBullet core, Vector3 targetPosition, KeybindOptionsPage moreOptionsPage, SongListController sc) {
|
||||||
super("General", core.getDefaultSkin());
|
super("General", core.getDefaultSkin());
|
||||||
|
setTextureBackground(core.getAssetManager().get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
|
||||||
//Back button
|
//Back button
|
||||||
TextButton backButton = new TextButton("Back", core.getDefaultSkin());
|
TextButton backButton = new TextButton("Back", core.getDefaultSkin());
|
||||||
backButton.addListener(new ChangeListener() {
|
backButton.addListener(new ChangeListener() {
|
||||||
|
@ -38,7 +38,7 @@ public class Page extends Group implements Disposable {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Batch batch, float parentAlpha) {
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
if (background != null) {
|
if (background != null) {
|
||||||
batch.draw(background, 0, 0, getWidth(), getHeight());
|
batch.draw(background, getX(), getY(), getWidth(), getHeight());
|
||||||
}
|
}
|
||||||
super.draw(batch, parentAlpha);
|
super.draw(batch, parentAlpha);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||||
|
|
||||||
import com.badlogic.gdx.Preferences;
|
import com.badlogic.gdx.Preferences;
|
||||||
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
@ -16,7 +18,8 @@ public class VideoOptionsPage extends Page {
|
|||||||
private GraphicsOptions graphicsTable;
|
private GraphicsOptions graphicsTable;
|
||||||
private TextButton backButton;
|
private TextButton backButton;
|
||||||
|
|
||||||
public VideoOptionsPage(Skin skin, Preferences prefs, MainMenu menu) {
|
public VideoOptionsPage(Skin skin, Preferences prefs, MainMenu menu, AssetManager assets) {
|
||||||
|
setTextureBackground(assets.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
|
||||||
graphicsTable = new GraphicsOptions(menu, skin, prefs);
|
graphicsTable = new GraphicsOptions(menu, skin, prefs);
|
||||||
scrollPane = new ScrollPane(graphicsTable, skin);
|
scrollPane = new ScrollPane(graphicsTable, skin);
|
||||||
scrollPane.setFadeScrollBars(false);
|
scrollPane.setFadeScrollBars(false);
|
||||||
@ -27,7 +30,6 @@ public class VideoOptionsPage extends Page {
|
|||||||
backButton.setPosition(10, getHeight() - 10 - backButton.getHeight());
|
backButton.setPosition(10, getHeight() - 10 - backButton.getHeight());
|
||||||
backButton.setWidth(backButton.getWidth() + 20);
|
backButton.setWidth(backButton.getWidth() + 20);
|
||||||
backButton.addListener(new ChangeListener() {
|
backButton.addListener(new ChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changed(ChangeEvent event, Actor actor) {
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
menu.getCameraPosition().y = 0.5f*getHeight();
|
menu.getCameraPosition().y = 0.5f*getHeight();
|
||||||
|
@ -84,7 +84,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
keybindPage.setPosition(1f*Gdx.graphics.getWidth(), -1f*Gdx.graphics.getHeight());
|
keybindPage.setPosition(1f*Gdx.graphics.getWidth(), -1f*Gdx.graphics.getHeight());
|
||||||
stage.addActor(keybindPage);
|
stage.addActor(keybindPage);
|
||||||
|
|
||||||
graphicsPage = new VideoOptionsPage(core.getDefaultSkin(), core.getPrefs(), this);
|
graphicsPage = new VideoOptionsPage(core.getDefaultSkin(), core.getPrefs(), this, core.getAssetManager());
|
||||||
|
|
||||||
graphicsPage.setPosition(1f*Gdx.graphics.getWidth(), 1f*Gdx.graphics.getHeight());
|
graphicsPage.setPosition(1f*Gdx.graphics.getWidth(), 1f*Gdx.graphics.getHeight());
|
||||||
stage.addActor(graphicsPage);
|
stage.addActor(graphicsPage);
|
||||||
@ -169,9 +169,9 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
|
|
||||||
|
|
||||||
if (Gdx.graphics.getWidth() < 1024) {
|
if (Gdx.graphics.getWidth() < 1024) {
|
||||||
fboSize = 2048;
|
fboSize = 1024;
|
||||||
} else if (Gdx.graphics.getWidth() < 2048) {
|
} else if (Gdx.graphics.getWidth() < 2048) {
|
||||||
fboSize = 4096;
|
fboSize = 2048;
|
||||||
} else {
|
} else {
|
||||||
fboSize = 4096;
|
fboSize = 4096;
|
||||||
}
|
}
|
||||||
@ -198,14 +198,14 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0.2f, 0f, 0f, 1f);
|
Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
stage.act(delta);
|
stage.act(delta);
|
||||||
if (blurlvl > 0) {
|
if (blurlvl > 0) {
|
||||||
//Begin drawing a normal version of screen
|
//Begin drawing a normal version of screen
|
||||||
normalBuffer.begin();
|
normalBuffer.begin();
|
||||||
stage.getViewport().apply();
|
stage.getViewport().apply();
|
||||||
Gdx.gl.glClearColor(0.2f, 0f, 0f, 1f);
|
Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
stage.draw();
|
stage.draw();
|
||||||
normalBuffer.end();
|
normalBuffer.end();
|
||||||
|
Loading…
Reference in New Issue
Block a user