v0.7.4: adjusted elements at scene corners to accommodate curved displays

This commit is contained in:
Evan Debenham 2019-07-08 02:35:48 -04:00
parent 3841f593f8
commit 1c4603d6e4
8 changed files with 30 additions and 27 deletions

View File

@ -117,7 +117,7 @@ public class AlchemyScene extends PixelScene {
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 ); RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
title.hardlight(Window.TITLE_COLOR); title.hardlight(Window.TITLE_COLOR);
title.x = (Camera.main.width - title.width()) / 2f; title.x = (Camera.main.width - title.width()) / 2f;
title.y = (16 - title.baseLine()) / 2f; title.y = (20 - title.baseLine()) / 2f;
align(title); align(title);
add(title); add(title);
@ -270,7 +270,7 @@ public class AlchemyScene extends PixelScene {
}); });
} }
}; };
btnGuide.setRect(0, 0, 16, 16); btnGuide.setRect(0, 0, 20, 20);
add(btnGuide); add(btnGuide);
energyLeft = PixelScene.renderText(Messages.get(AlchemyScene.class, "energy", availableEnergy()), 9); energyLeft = PixelScene.renderText(Messages.get(AlchemyScene.class, "energy", availableEnergy()), 9);

View File

@ -62,7 +62,7 @@ public class BadgesScene extends PixelScene {
add( archs ); add( archs );
float left = 5; float left = 5;
float top = 16; float top = 20;
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 ); RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
title.hardlight(Window.TITLE_COLOR); title.hardlight(Window.TITLE_COLOR);

View File

@ -58,7 +58,7 @@ public class ChangesScene extends PixelScene {
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 ); RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
title.hardlight(Window.TITLE_COLOR); title.hardlight(Window.TITLE_COLOR);
title.x = (w - title.width()) / 2f; title.x = (w - title.width()) / 2f;
title.y = (16 - title.baseLine()) / 2f; title.y = (20 - title.baseLine()) / 2f;
align(title); align(title);
add(title); add(title);
@ -69,7 +69,7 @@ public class ChangesScene extends PixelScene {
NinePatch panel = Chrome.get(Chrome.Type.TOAST); NinePatch panel = Chrome.get(Chrome.Type.TOAST);
int pw = 135 + panel.marginLeft() + panel.marginRight() - 2; int pw = 135 + panel.marginLeft() + panel.marginRight() - 2;
int ph = h - 32; int ph = h - 35;
panel.size( pw, ph ); panel.size( pw, ph );
panel.x = (w - pw) / 2f; panel.x = (w - pw) / 2f;

View File

@ -75,7 +75,7 @@ public class RankingsScene extends PixelScene {
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9); RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR); title.hardlight(Window.TITLE_COLOR);
title.x = (w - title.width()) / 2f; title.x = (w - title.width()) / 2f;
title.y = (16 - title.baseLine()) / 2f; title.y = (20 - title.baseLine()) / 2f;
align(title); align(title);
add(title); add(title);

View File

@ -72,7 +72,7 @@ public class StartScene extends PixelScene {
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9); RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR); title.hardlight(Window.TITLE_COLOR);
title.x = (w - title.width()) / 2f; title.x = (w - title.width()) / 2f;
title.y = (16 - title.baseLine()) / 2f; title.y = (20 - title.baseLine()) / 2f;
align(title); align(title);
add(title); add(title);

View File

@ -66,13 +66,14 @@ public class TitleScene extends PixelScene {
Image title = BannerSprites.get( BannerSprites.Type.PIXEL_DUNGEON ); Image title = BannerSprites.get( BannerSprites.Type.PIXEL_DUNGEON );
add( title ); add( title );
float topRegion = Math.max(95f, h*0.45f); float topRegion = Math.max(title.height, h*0.45f);
title.x = (w - title.width()) / 2f; title.x = (w - title.width()) / 2f;
if (SPDSettings.landscape()) if (SPDSettings.landscape()) {
title.y = (topRegion - title.height()) / 2f; title.y = (topRegion - title.height()) / 2f;
else } else {
title.y = 16 + (topRegion - title.height() - 16) / 2f; title.y = 20 + (topRegion - title.height() - 20) / 2f;
}
align(title); align(title);
@ -159,24 +160,25 @@ public class TitleScene extends PixelScene {
BitmapText version = new BitmapText( "v " + Game.version + "", pixelFont); BitmapText version = new BitmapText( "v " + Game.version + "", pixelFont);
version.measure(); version.measure();
version.hardlight( 0x888888 ); version.hardlight( 0x888888 );
version.x = w - version.width(); version.x = w - version.width() - 4;
version.y = h - version.height(); version.y = h - version.height() - 2;
add( version ); add( version );
Button changes = new ChangesButton(); Button changes = new ChangesButton();
changes.setPos( w-changes.width(), h - version.height() - changes.height()); changes.setPos( version.x + version.width() - changes.width(),
version.y - changes.height());
add( changes ); add( changes );
int pos = 0; int pos = 2;
PrefsButton btnPrefs = new PrefsButton(); PrefsButton btnPrefs = new PrefsButton();
btnPrefs.setRect( pos, 0, 16, 16 ); btnPrefs.setRect( pos, 0, 16, 20 );
add( btnPrefs ); add( btnPrefs );
pos += btnPrefs.width(); pos += btnPrefs.width();
LanguageButton btnLang = new LanguageButton(); LanguageButton btnLang = new LanguageButton();
btnLang.setRect(pos, 0, 14, 16); btnLang.setRect(pos, 0, 16, 20);
add( btnLang ); add( btnLang );
ExitButton btnExit = new ExitButton(); ExitButton btnExit = new ExitButton();

View File

@ -67,13 +67,14 @@ public class WelcomeScene extends PixelScene {
title.brightness(0.6f); title.brightness(0.6f);
add( title ); add( title );
float topRegion = Math.max(95f, h*0.45f); float topRegion = Math.max(title.height, h*0.45f);
title.x = (w - title.width()) / 2f; title.x = (w - title.width()) / 2f;
if (SPDSettings.landscape()) if (SPDSettings.landscape()) {
title.y = (topRegion - title.height()) / 2f; title.y = (topRegion - title.height()) / 2f;
else } else {
title.y = 16 + (topRegion - title.height() - 16) / 2f; title.y = 20 + (topRegion - title.height() - 20) / 2f;
}
align(title); align(title);

View File

@ -36,8 +36,8 @@ public class ExitButton extends Button {
public ExitButton() { public ExitButton() {
super(); super();
width = image.width; width = image.width+4;
height = image.height; height = image.height+4;
} }
@Override @Override
@ -52,8 +52,8 @@ public class ExitButton extends Button {
protected void layout() { protected void layout() {
super.layout(); super.layout();
image.x = x; image.x = x+2;
image.y = y; image.y = y+2;
} }
@Override @Override