mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Start working on getting drop down menus to show down right side
This commit is contained in:
@@ -185,7 +185,6 @@ public abstract class FScreen extends FContainer {
|
|||||||
Forge.back();
|
Forge.back();
|
||||||
}
|
}
|
||||||
}).build());
|
}).build());
|
||||||
btnBack.setSize(HEIGHT, HEIGHT);
|
|
||||||
lblCaption = add(new FLabel.Builder().text(headerCaption).font(FONT).align(HAlignment.CENTER).build());
|
lblCaption = add(new FLabel.Builder().text(headerCaption).font(FONT).align(HAlignment.CENTER).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,43 +200,64 @@ public abstract class FScreen extends FContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(Graphics g) {
|
public void drawBackground(Graphics g) {
|
||||||
g.fillRect(BACK_COLOR, 0, 0, getWidth(), HEIGHT);
|
g.fillRect(BACK_COLOR, 0, 0, getWidth(), getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawOverlay(Graphics g) {
|
public void drawOverlay(Graphics g) {
|
||||||
|
if (Forge.isLandscapeMode()) {
|
||||||
|
//in landscape mode, draw left border for header
|
||||||
|
g.drawLine(LINE_THICKNESS, LINE_COLOR, 0, 0, 0, getHeight());
|
||||||
|
return;
|
||||||
|
}
|
||||||
float y = HEIGHT - LINE_THICKNESS / 2;
|
float y = HEIGHT - LINE_THICKNESS / 2;
|
||||||
g.drawLine(LINE_THICKNESS, LINE_COLOR, 0, y, getWidth(), y);
|
g.drawLine(LINE_THICKNESS, LINE_COLOR, 0, y, getWidth(), y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doLayout(float width, float height) {
|
protected void doLayout(float width, float height) {
|
||||||
|
if (Forge.isLandscapeMode()) {
|
||||||
|
//in landscape mode, don't show back button or caption
|
||||||
|
btnBack.setBounds(0, 0, 0, 0);
|
||||||
|
lblCaption.setBounds(0, 0, 0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
btnBack.setBounds(0, 0, height, height);
|
||||||
lblCaption.setBounds(height, 0, width - 2 * height, height);
|
lblCaption.setBounds(height, 0, width - 2 * height, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static class MenuHeader extends DefaultHeader {
|
private static class MenuHeader extends DefaultHeader {
|
||||||
private final FLabel btnMenu;
|
private final FLabel btnMenu;
|
||||||
|
private final FPopupMenu menu;
|
||||||
|
|
||||||
public MenuHeader(String headerCaption, final FPopupMenu menu) {
|
public MenuHeader(String headerCaption, FPopupMenu menu0) {
|
||||||
super(headerCaption);
|
super(headerCaption);
|
||||||
|
menu = menu0;
|
||||||
btnMenu = add(new FLabel.Builder().icon(new MenuIcon(HEIGHT, HEIGHT)).pressedColor(BTN_PRESSED_COLOR).align(HAlignment.CENTER).command(new FEventHandler() {
|
btnMenu = add(new FLabel.Builder().icon(new MenuIcon(HEIGHT, HEIGHT)).pressedColor(BTN_PRESSED_COLOR).align(HAlignment.CENTER).command(new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
menu.show(btnMenu, 0, HEIGHT);
|
menu.show(btnMenu, 0, HEIGHT);
|
||||||
}
|
}
|
||||||
}).build());
|
}).build());
|
||||||
btnMenu.setSize(HEIGHT, HEIGHT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doLayout(float width, float height) {
|
protected void doLayout(float width, float height) {
|
||||||
super.doLayout(width, height);
|
super.doLayout(width, height);
|
||||||
btnMenu.setLeft(width - height);
|
|
||||||
|
if (Forge.isLandscapeMode()) {
|
||||||
|
//for landscape mode, hide menu button and display menu
|
||||||
|
btnMenu.setBounds(0, 0, 0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
btnMenu.setBounds(width - height, 0, height, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float doLandscapeLayout(float screenWidth, float screenHeight) {
|
public float doLandscapeLayout(float screenWidth, float screenHeight) {
|
||||||
float width = screenHeight * HomeScreen.MAIN_MENU_WIDTH_FACTOR;
|
float width = screenHeight * HomeScreen.MAIN_MENU_WIDTH_FACTOR;
|
||||||
|
setBounds(screenWidth - width, 0, width, screenHeight);
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.badlogic.gdx.Gdx;
|
|||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
@@ -142,7 +143,7 @@ public class LoadQuestScreen extends LaunchScreen {
|
|||||||
@Override
|
@Override
|
||||||
protected void drawBackground(Graphics g) {
|
protected void drawBackground(Graphics g) {
|
||||||
super.drawBackground(g);
|
super.drawBackground(g);
|
||||||
float y = getHeader().getBottom();
|
float y = Forge.isLandscapeMode() ? 0 : getHeader().getBottom();
|
||||||
g.fillRect(OLD_QUESTS_BACK_COLOR, 0, y, lstQuests.getWidth(), lstQuests.getTop() - y);
|
g.fillRect(OLD_QUESTS_BACK_COLOR, 0, y, lstQuests.getWidth(), lstQuests.getTop() - y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user