Standardize lines separating list items

This commit is contained in:
drdev
2014-07-18 01:22:53 +00:00
parent 4d15ca850e
commit a6bf55f3a0
3 changed files with 35 additions and 15 deletions

View File

@@ -14,7 +14,6 @@ import forge.LobbyPlayer;
import forge.assets.FSkin;
import forge.assets.FSkinColor;
import forge.assets.FSkinFont;
import forge.assets.FSkinColor.Colors;
import forge.assets.FSkinImage;
import forge.assets.FTextureRegionImage;
import forge.deck.CardPool;
@@ -52,7 +51,6 @@ import forge.util.NameGenerator;
import forge.util.Utils;
public class ConstructedScreen extends LaunchScreen {
private static final FSkinColor PLAYER_BORDER_COLOR = FSkinColor.get(Colors.CLR_BORDERS).alphaColor(0.8f);
private static final ForgePreferences prefs = FModel.getPreferences();
private static final float PADDING = Utils.scaleMin(5);
private static final int MAX_PLAYERS = 2; //8; //TODO: Support multiplayer
@@ -85,9 +83,10 @@ public class ConstructedScreen extends LaunchScreen {
}
@Override
protected void drawOverlay(Graphics g) {
super.drawOverlay(g);
g.drawLine(1.5f, PLAYER_BORDER_COLOR, 0, 0, getWidth(), 0);
public void drawOnContainer(Graphics g) {
//draw top border above items
float y = playersScroll.getTop() - FList.LINE_THICKNESS / 2;
g.drawLine(FList.LINE_THICKNESS, FList.LINE_COLOR, 0, y, getWidth(), y);
}
};
@@ -554,8 +553,8 @@ public class ConstructedScreen extends LaunchScreen {
@Override
protected void drawOverlay(Graphics g) {
float y = getHeight();
g.drawLine(1, PLAYER_BORDER_COLOR, 0, y, getWidth(), y);
float y = getHeight() - FList.LINE_THICKNESS / 2;
g.drawLine(FList.LINE_THICKNESS, FList.LINE_COLOR, 0, y, getWidth(), y);
}
private final FEventHandler humanAiSwitched = new FEventHandler() {

View File

@@ -5,6 +5,7 @@ import java.util.Set;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import forge.Graphics;
import forge.assets.FImage;
import forge.assets.FSkinFont;
import forge.assets.FSkinImage;
@@ -18,6 +19,7 @@ import forge.screens.TabPageScreen;
import forge.toolbox.FContainer;
import forge.toolbox.FDisplayObject;
import forge.toolbox.FLabel;
import forge.toolbox.FList;
import forge.toolbox.FScrollPane;
import forge.toolbox.FTextArea;
import forge.util.Utils;
@@ -48,18 +50,25 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
.text("The merchant does not have anything useful for sale.")
.align(HAlignment.CENTER).build());
private final FLabel lblCredits = add(new FLabel.Builder().font(FSkinFont.get(15)).icon(FSkinImage.QUEST_COINSTACK).iconScaleFactor(1f).build());
private final FLabel lblLife = add(new FLabel.Builder().font(lblCredits.getFont()).icon(FSkinImage.QUEST_HEART).iconScaleFactor(1f).align(HAlignment.RIGHT).build());
private final FLabel lblLife = add(new FLabel.Builder().font(lblCredits.getFont()).icon(FSkinImage.QUEST_LIFE).iconScaleFactor(1f).align(HAlignment.RIGHT).build());
private final FTextArea lblFluff = add(new FTextArea());
private final FScrollPane scroller = add(new FScrollPane() {
@Override
protected ScrollBounds layoutAndGetScrollBounds(float visibleWidth, float visibleHeight) {
float y = 0;
for (FDisplayObject child : getChildren()) {
child.setBounds(0, y, visibleWidth, child.getHeight());
child.setBounds(0, y, visibleWidth, BazaarItemDisplay.HEIGHT);
y += child.getHeight();
}
return new ScrollBounds(visibleWidth, y);
}
@Override
public void drawOnContainer(Graphics g) {
//draw top border above items
float y = scroller.getTop() - FList.LINE_THICKNESS / 2;
g.drawLine(FList.LINE_THICKNESS, FList.LINE_COLOR, 0, y, getWidth(), y);
}
});
private BazaarPage(QuestStallDefinition stallDef0) {
@@ -119,16 +128,17 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
lblCredits.setBounds(x, y, w / 2, lblCredits.getAutoSizeBounds().height);
lblLife.setBounds(x + w / 2, y, w / 2, lblCredits.getHeight());
y += lblCredits.getHeight() + PADDING;
scroller.setBounds(0, y, width, height - y);
if (lblEmpty.isVisible()) {
lblEmpty.setBounds(x, y, w, lblEmpty.getAutoSizeBounds().height);
}
else {
scroller.setBounds(x, y, w, height - PADDING - y);
}
}
}
private static class BazaarItemDisplay extends FContainer {
private static final float HEIGHT = Utils.AVG_FINGER_HEIGHT * 2;
private final FLabel btnBuy = add(new FLabel.ButtonBuilder().text("Buy").font(FSkinFont.get(20)).build());
private final IQuestBazaarItem item;
private BazaarItemDisplay(IQuestBazaarItem item0) {
@@ -136,9 +146,18 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
}
@Override
protected void doLayout(float width, float height) {
// TODO Auto-generated method stub
public void drawBackground(Graphics g) {
float y;
y = getHeight() - FList.LINE_THICKNESS / 2;
g.drawLine(FList.LINE_THICKNESS, FList.LINE_COLOR, 0, y, getWidth(), y);
}
@Override
protected void doLayout(float width, float height) {
float padding = BazaarPage.PADDING;
float buttonSize = height - 2 * padding;
btnBuy.setBounds(width - padding - buttonSize, padding, buttonSize, buttonSize);
}
}
}

View File

@@ -19,6 +19,7 @@ public class FList<E> extends FScrollPane implements Iterable<E> {
public static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT);
public static final FSkinColor PRESSED_COLOR = FSkinColor.get(Colors.CLR_ACTIVE).alphaColor(0.9f);
public static final FSkinColor LINE_COLOR = FORE_COLOR.alphaColor(0.5f);
public static final float LINE_THICKNESS = Utils.scaleY(1);
private final List<E> items = new ArrayList<E>();
private FSkinFont font;
@@ -207,7 +208,8 @@ public class FList<E> extends FScrollPane implements Iterable<E> {
y += itemHeight;
if (drawSeparators) {
g.drawLine(1, LINE_COLOR, 0, y, w, y);
y -= LINE_THICKNESS / 2;
g.drawLine(LINE_THICKNESS, LINE_COLOR, 0, y, w, y);
}
}
}