placement adjustement

This commit is contained in:
Harrison Deng 2017-10-15 14:44:58 -05:00
parent 160f87b801
commit 879921e5aa
3 changed files with 13 additions and 6 deletions

View File

@ -95,7 +95,7 @@ public class ScrollText extends Widget {
if (getHeight() < (textHeight+4)) {
setHeight(textHeight + 4);
}
clipBounds.setSize(getWidth()-1, getHeight()*1.5f);
clipBounds.setSize(getWidth()-2, getHeight()*1.5f);
super.layout();
}
@ -149,8 +149,8 @@ public class ScrollText extends Widget {
batch.flush();
if (ScissorStack.pushScissors(scissors)) {
font.draw(batch, text1, coords.x + text1Offset, coords.y + getFontHeight() + getHeight()/4f);
font.draw(batch, text2, coords.x + text2Offset, coords.y + getFontHeight() + getHeight()/4f);
font.draw(batch, text1, coords.x + text1Offset, coords.y + getFontHeight() + 4);
font.draw(batch, text2, coords.x + text2Offset, coords.y + getFontHeight() + 4);
batch.flush();
ScissorStack.popScissors();
};

View File

@ -68,7 +68,7 @@ public class TitleBarVisualizer extends Group implements Disposable {
if (titleImage.getWidth() > 0.8f*getWidth()) {
titleImage.setScale((bg.getWidth()-(0.2f*Gdx.graphics.getWidth()))/titleImage.getWidth());
}
titleImage.setPosition((getWidth() - titleImage.getWidth())/2f, (getHeight() - titleImage.getHeight())/2f -10);
titleImage.setPosition((getWidth() - titleImage.getWidth()*titleImage.getScaleX())/2f, (getHeight() - titleImage.getHeight()*titleImage.getScaleY())/2f -5);
titleImage.setColor(Color.WHITE);
addActor(titleImage);

View File

@ -86,9 +86,16 @@ public class MainPage extends Page implements OnDifferentSongListener {
addActor(musicControls);
scrollText = new ScrollText("...", "...", core.getDefaultSkin(), false, true);
scrollText.setWidth(0.5f*getWidth());
scrollText.setWidth((0.4f * getWidth()));
scrollText.setHeight(musicControls.getMinHeight());
scrollText.setPosition((getWidth() - scrollText.getWidth())/2f, musicControls.getY() - 22f);
scrollText.setPosition(((getWidth() - scrollText.getWidth())/2f), getHeight() - scrollText.getFontHeight()*1.5f);
if (scrollText.getX() + scrollText.getWidth() > musicControls.getX()) {
Gdx.app.debug("MainPage", "using minimal layout for scrolling text.");
musicControls.setX(getWidth() - musicControls.getMinWidth() - 5f);
scrollText.setPosition(15, getHeight() - scrollText.getHeight() - 15f);
musicControls.setY(scrollText.getY() + 22f);
musicControls.invalidate();
}
scrollText.invalidate();
addActor(scrollText);