main page ui changes, working on song name scroll text

This commit is contained in:
Harrison Deng 2017-10-24 20:11:49 -05:00
parent 92d122616f
commit a1278eed9b
3 changed files with 9 additions and 11 deletions

View File

@ -1,6 +1,5 @@
package zero1hd.rhythmbullet.graphics.ui.components;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
@ -93,10 +92,14 @@ public class MusicControls extends HorizontalGroup {
invalidate();
debugAll();
debug();
}
@Override
public void act(float delta) {
setWidth(getMinWidth());
setHeight(getMinHeight());
if (disableTimer > 0) {
disableTimer -= delta;
if (disableTimer <= 0) {

View File

@ -100,6 +100,8 @@ public class ScrollText extends Widget {
@Override
public void act(float delta) {
validate();
setSize(getMinWidth(), textHeight + 4);
clipBounds.setSize(getWidth()-2, getHeight()*1.5f);
if (text1Width + text2Width > clipBounds.getWidth()) {
if (scrollOnHover) {
if (scroll || text1Offset < 0 || text1Offset > 5) {

View File

@ -84,20 +84,13 @@ public class MainPage extends Page implements Observer {
table.add(quitButton).fillX();
musicControls = new MusicControls(core.getDefaultSkin(), sc);
musicControls.setPosition((getWidth()-musicControls.getMinWidth() - 20f), getHeight()-musicControls.getMinHeight()*1.5f -15f);
musicControls.setPosition((getWidth()-musicControls.getMinWidth() - 20f), getHeight()-musicControls.getMinHeight()-15f);
musicControls.invalidate();
addActor(musicControls);
scrollText = new ScrollText("...", "...", core.getDefaultSkin(), false, true);
scrollText.setWidth((0.4f * getWidth()));
scrollText.setPosition(((getWidth() - scrollText.getWidth())/2f), 0.8f*Gdx.graphics.getHeight());
if (scrollText.getX() + scrollText.getWidth() > musicControls.getX()) {
Gdx.app.debug("MainPage", "using minimal layout for scrolling text.");
musicControls.setX(getWidth() - musicControls.getMinWidth() - 10f);
musicControls.setY(Gdx.graphics.getHeight() - 45f);
scrollText.setPosition(15, getHeight() - scrollText.getHeight() - 15f);
musicControls.invalidate();
}
scrollText.setWidth(Gdx.graphics.getWidth() - musicControls.getWidth() - 30f);
scrollText.setPosition(musicControls.getX() - scrollText.getWidth() - 20f, Gdx.graphics.getHeight() - 15f);
scrollText.invalidate();
addActor(scrollText);