code cleanup
This commit is contained in:
@@ -102,9 +102,29 @@ public class ScrollText extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void scroll(float delta) {
|
||||
if (text1Offset >= -text1Width) {
|
||||
text1Offset -= 60*delta;
|
||||
|
||||
|
||||
if ((text1Offset < - Math.abs((text1Width - clipBounds.getWidth())) - 50) || text2Offset != clipBounds.getWidth()) {
|
||||
text2Offset -= 60*delta;
|
||||
if (text2Offset <= -text2Width) {
|
||||
text2Offset = clipBounds.getWidth();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
text2Offset -= 60*delta;
|
||||
if (text2Offset < - Math.abs((text2Width - clipBounds.getWidth())) - 50) {
|
||||
text1Offset = clipBounds.getWidth();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
setSize(getWidth(), textHeight + 4);
|
||||
clipBounds.setSize(getWidth()-2, getHeight()*1.5f);
|
||||
if (dupFirstText) {
|
||||
if (text1Width > clipBounds.getWidth()) {
|
||||
@@ -130,26 +150,6 @@ public class ScrollText extends Widget {
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
public void scroll(float delta) {
|
||||
if (text1Offset >= -text1Width) {
|
||||
text1Offset -= 60*delta;
|
||||
|
||||
|
||||
if ((text1Offset < - Math.abs((text1Width - clipBounds.getWidth())) - 50) || text2Offset != clipBounds.getWidth()) {
|
||||
text2Offset -= 60*delta;
|
||||
if (text2Offset <= -text2Width) {
|
||||
text2Offset = clipBounds.getWidth();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
text2Offset -= 60*delta;
|
||||
if (text2Offset < - Math.abs((text2Width - clipBounds.getWidth())) - 50) {
|
||||
text1Offset = clipBounds.getWidth();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
if (background != null) {
|
||||
|
Reference in New Issue
Block a user