From ca8e4c16d7a1fd3fdfe26a0633679fe9a44cd114 Mon Sep 17 00:00:00 2001 From: Recrown Date: Mon, 16 Oct 2017 15:32:41 -0500 Subject: [PATCH] multiple adjustements made for ui resizing --- .../graphics/ui/components/ScrollText.java | 11 +++++------ .../graphics/ui/pages/KeybindOptionsPage.java | 2 ++ .../rhythmbullet/graphics/ui/pages/MainPage.java | 6 ++---- .../rhythmbullet/graphics/ui/pages/OptionsPage.java | 3 ++- .../zero1hd/rhythmbullet/graphics/ui/pages/Page.java | 2 +- .../graphics/ui/pages/VideoOptionsPage.java | 6 ++++-- core/src/zero1hd/rhythmbullet/screens/MainMenu.java | 10 +++++----- 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java index b5469c6..26cf674 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java @@ -55,13 +55,7 @@ public class ScrollText extends Widget { this.scrollOnHover = scrollOnHover; - if (text1 == null) { - text1 = ""; - } - setText(text1, text2); - coords = new Vector2(); - addListener(new ClickListener() { @Override 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) { } }); + + setText(text1, text2); + layout(); } public float getFontHeight() { @@ -95,6 +92,8 @@ public class ScrollText extends Widget { setHeight(textHeight + 4); } clipBounds.setSize(getWidth()-2, getHeight()*1.5f); + + text2Offset = clipBounds.getWidth(); super.layout(); } diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/KeybindOptionsPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/KeybindOptionsPage.java index 15801a5..f751c03 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/KeybindOptionsPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/KeybindOptionsPage.java @@ -1,6 +1,7 @@ package zero1hd.rhythmbullet.graphics.ui.pages; import com.badlogic.gdx.assets.AssetManager; +import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.Skin; @@ -15,6 +16,7 @@ public class KeybindOptionsPage extends Page { private KeyMap keyMap; private TextButton backButton; public KeybindOptionsPage(Skin skin, AssetManager assets, Vector3 cameraPosition) { + setTextureBackground(assets.get("gradients.atlas", TextureAtlas.class).findRegion("red-round")); keyMap = new KeyMap(assets); controlTable = new ControlOptions(skin, keyMap); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java index d4968a7..9e963c0 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java @@ -83,19 +83,17 @@ public class MainPage extends Page implements OnDifferentSongListener { table.add(quitButton).fillX(); 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(); addActor(musicControls); scrollText = new ScrollText("...", "...", core.getDefaultSkin(), false, true); scrollText.setWidth((0.4f * getWidth())); - scrollText.setHeight(musicControls.getMinHeight()); - scrollText.setPosition(((getWidth() - scrollText.getWidth())/2f), getHeight() - scrollText.getFontHeight()*1.5f); + scrollText.setPosition(((getWidth() - scrollText.getWidth())/2f), getHeight() - scrollText.getHeight()*1.5f); if (scrollText.getX() + scrollText.getWidth() > musicControls.getX()) { Gdx.app.debug("MainPage", "using minimal layout for scrolling text."); musicControls.setX(getWidth() - musicControls.getMinWidth() - 10f); scrollText.setPosition(15, getHeight() - scrollText.getHeight() - 15f); - musicControls.setY(scrollText.getY() + 22f); musicControls.invalidate(); } scrollText.invalidate(); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java index 371da2b..f8012f8 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java @@ -2,6 +2,7 @@ package zero1hd.rhythmbullet.graphics.ui.pages; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.Preferences; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector3; @@ -31,7 +32,7 @@ public class OptionsPage extends Page { private float musicSearchTimer; public OptionsPage(RhythmBullet core, Vector3 targetPosition, KeybindOptionsPage moreOptionsPage, SongListController sc) { super("General", core.getDefaultSkin()); - + setTextureBackground(core.getAssetManager().get("gradients.atlas", TextureAtlas.class).findRegion("red-round")); //Back button TextButton backButton = new TextButton("Back", core.getDefaultSkin()); backButton.addListener(new ChangeListener() { diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/Page.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/Page.java index 283184d..00fc30a 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/Page.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/Page.java @@ -38,7 +38,7 @@ public class Page extends Group implements Disposable { @Override public void draw(Batch batch, float parentAlpha) { if (background != null) { - batch.draw(background, 0, 0, getWidth(), getHeight()); + batch.draw(background, getX(), getY(), getWidth(), getHeight()); } super.draw(batch, parentAlpha); } diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/VideoOptionsPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/VideoOptionsPage.java index bf29fcc..0427ad8 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/VideoOptionsPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/VideoOptionsPage.java @@ -1,7 +1,9 @@ package zero1hd.rhythmbullet.graphics.ui.pages; import com.badlogic.gdx.Preferences; +import com.badlogic.gdx.assets.AssetManager; 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.ui.ScrollPane; import com.badlogic.gdx.scenes.scene2d.ui.Skin; @@ -16,7 +18,8 @@ public class VideoOptionsPage extends Page { private GraphicsOptions graphicsTable; 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); scrollPane = new ScrollPane(graphicsTable, skin); scrollPane.setFadeScrollBars(false); @@ -27,7 +30,6 @@ public class VideoOptionsPage extends Page { backButton.setPosition(10, getHeight() - 10 - backButton.getHeight()); backButton.setWidth(backButton.getWidth() + 20); backButton.addListener(new ChangeListener() { - @Override public void changed(ChangeEvent event, Actor actor) { menu.getCameraPosition().y = 0.5f*getHeight(); diff --git a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java index 095c67f..678c828 100755 --- a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java +++ b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java @@ -84,7 +84,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { keybindPage.setPosition(1f*Gdx.graphics.getWidth(), -1f*Gdx.graphics.getHeight()); 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()); stage.addActor(graphicsPage); @@ -169,9 +169,9 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { if (Gdx.graphics.getWidth() < 1024) { - fboSize = 2048; + fboSize = 1024; } else if (Gdx.graphics.getWidth() < 2048) { - fboSize = 4096; + fboSize = 2048; } else { fboSize = 4096; } @@ -198,14 +198,14 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { @Override 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); stage.act(delta); if (blurlvl > 0) { //Begin drawing a normal version of screen normalBuffer.begin(); 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); stage.draw(); normalBuffer.end();