mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Improve layout of landscape mana pool
This commit is contained in:
@@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
|
|
||||||
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
@@ -58,12 +59,31 @@ public class VManaPool extends VDisplayArea {
|
|||||||
protected ScrollBounds layoutAndGetScrollBounds(float visibleWidth, float visibleHeight) {
|
protected ScrollBounds layoutAndGetScrollBounds(float visibleWidth, float visibleHeight) {
|
||||||
float x = 0;
|
float x = 0;
|
||||||
float y = 0;
|
float y = 0;
|
||||||
float labelWidth = visibleWidth / manaLabels.size();
|
|
||||||
float labelHeight = visibleHeight;
|
|
||||||
|
|
||||||
for (ManaLabel label : manaLabels) {
|
if (Forge.isLandscapeMode()) {
|
||||||
label.setBounds(x, y, labelWidth, labelHeight);
|
float labelWidth = visibleWidth / 2;
|
||||||
x += labelWidth;
|
float labelHeight = visibleHeight / 3;
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (ManaLabel label : manaLabels) {
|
||||||
|
label.setBounds(x, y, labelWidth, labelHeight);
|
||||||
|
if (++count % 2 == 0) {
|
||||||
|
x = 0;
|
||||||
|
y += labelHeight;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
x += labelWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
float labelWidth = visibleWidth / manaLabels.size();
|
||||||
|
float labelHeight = visibleHeight;
|
||||||
|
|
||||||
|
for (ManaLabel label : manaLabels) {
|
||||||
|
label.setBounds(x, y, labelWidth, labelHeight);
|
||||||
|
x += labelWidth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ScrollBounds(visibleWidth, visibleHeight);
|
return new ScrollBounds(visibleWidth, visibleHeight);
|
||||||
|
|||||||
Reference in New Issue
Block a user