From 8d8ef15ce46feee29819d9347fd682ae5adfedf2 Mon Sep 17 00:00:00 2001 From: Recrown Date: Thu, 26 Oct 2017 22:38:23 -0500 Subject: [PATCH] mainpage ui improved --- .../graphics/ui/components/MusicControls.java | 3 --- .../graphics/ui/components/ScrollText.java | 13 +++++++------ .../rhythmbullet/graphics/ui/pages/MainPage.java | 7 ++----- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicControls.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicControls.java index 2860bfb..d6ceb87 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicControls.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicControls.java @@ -90,9 +90,6 @@ public class MusicControls extends HorizontalGroup { space(15); invalidate(); - - debugAll(); - debug(); } @Override diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java index 4fee9c7..e720cc2 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java @@ -94,13 +94,15 @@ public class ScrollText extends Widget { clipBounds.setSize(getWidth()-2, getHeight()*1.5f); text2Offset = clipBounds.getWidth(); + if (text1Width < clipBounds.getWidth()) { + text1Offset = (clipBounds.getWidth()-text1Width)/2f; + } super.layout(); } @Override public void act(float delta) { - validate(); - setSize(getMinWidth(), textHeight + 4); + setSize(getWidth(), textHeight + 4); clipBounds.setSize(getWidth()-2, getHeight()*1.5f); if (text1Width + text2Width > clipBounds.getWidth()) { if (scrollOnHover) { @@ -171,10 +173,7 @@ public class ScrollText extends Widget { gLayout = new GlyphLayout(font, text1); text1Width = gLayout.width; textHeight = gLayout.height; - text2Offset = clipBounds.getWidth(); - if (text1Width < clipBounds.getWidth()) { - text1Offset = (clipBounds.getWidth()-text1Width)/2f; - } + if (text2 != null) { this.text2 = text2; gLayout = new GlyphLayout(font, text2); @@ -183,5 +182,7 @@ public class ScrollText extends Widget { this.text2 = text1; this.text2Width = text1Width; } + + layout(); } } diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java index 02ca857..dcb2d6f 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java @@ -85,15 +85,12 @@ public class MainPage extends Page implements Observer { musicControls = new MusicControls(core.getDefaultSkin(), sc); musicControls.setPosition((getWidth()-musicControls.getMinWidth() - 20f), getHeight()-musicControls.getMinHeight()-15f); - musicControls.invalidate(); addActor(musicControls); scrollText = new ScrollText("...", "...", core.getDefaultSkin(), false, true); - scrollText.setWidth(Gdx.graphics.getWidth() - musicControls.getWidth() - 30f); - scrollText.setPosition(musicControls.getX() - scrollText.getWidth() - 20f, Gdx.graphics.getHeight() - 15f); - scrollText.invalidate(); + scrollText.setWidth(0.5f*getWidth()); + scrollText.setPosition(15, getHeight() - scrollText.getHeight()-15f); addActor(scrollText); - } @Override