v2.5.0: added icons to the title of each of the game's main scenes

This commit is contained in:
Evan Debenham
2024-07-04 19:57:09 -04:00
parent 53139c9e5c
commit 80abc8376d
8 changed files with 36 additions and 29 deletions

View File

@@ -15,8 +15,6 @@ scenes.amuletscene.exit=Let's call it a day
scenes.amuletscene.stay=I'm not done yet
scenes.amuletscene.text=You finally hold it in your hands, the Amulet of Yendor! With the power of this amulet nothing will be able to stand in your way! You have conquered the dungeon and succeeded in your quest!\n\nOr, perhaps you're not ready yet? You can also decide to just hold onto the amulet, stay a mere mortal a little longer, and perhaps leave the dungeon the old fashioned way...
scenes.badgesscene.title=Journal
scenes.changesscene.title=Change History
scenes.changesscene.new=New Content
scenes.changesscene.changes=Changes
@@ -82,6 +80,8 @@ scenes.interlevelscene$mode.reset=Resetting...
scenes.interlevelscene.file_not_found=Save file not found. If this error persists after restarting, it may mean this save game is corrupted. Sorry about that.
scenes.interlevelscene.io_error=Cannot read save file. If this error persists after restarting, it may mean this save game is corrupted. Sorry about that.
scenes.journalscene.title=Journal
scenes.newsscene.title=Game News
scenes.newsscene.read_more=Read More
scenes.newsscene$newsinfo.english_warn=News posts are written by the developer and are only available in English.

View File

@@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.ChangeInfo;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.WndChanges;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.WndChangesTabbed;
@@ -79,10 +78,10 @@ public class ChangesScene extends PixelScene {
int w = Camera.main.width;
int h = Camera.main.height;
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.get(this, "title"), 9 );
title.hardlight(Window.TITLE_COLOR);
IconTitle title = new IconTitle(Icons.CHANGES.get(), Messages.get(this, "title"));
title.setSize(200, 0);
title.setPos(
(w - title.width()) / 2f,
(w - title.reqWidth()) / 2f,
(20 - title.height()) / 2f
);
align(title);
@@ -100,7 +99,7 @@ public class ChangesScene extends PixelScene {
if (h >= PixelScene.MIN_HEIGHT_FULL && w >= PixelScene.MIN_WIDTH_FULL) {
panel.size( pw, ph );
panel.x = (w - pw) / 2f - pw/2 - 1;
panel.y = title.bottom() + 5;
panel.y = 20;
rightPanel = Chrome.get(Chrome.Type.TOAST);
rightPanel.size( pw, ph );
@@ -132,7 +131,7 @@ public class ChangesScene extends PixelScene {
} else {
panel.size( pw, ph );
panel.x = (w - pw) / 2f;
panel.y = title.bottom() + 5;
panel.y = 20;
}
align( panel );
add( panel );

View File

@@ -32,9 +32,10 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal;
import com.watabou.noosa.Camera;
import com.watabou.noosa.NinePatch;
@@ -68,11 +69,9 @@ public class JournalScene extends PixelScene {
float top = 20;
//TODO icon title?
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.get(this, "title"), 9 );
title.hardlight(Window.TITLE_COLOR);
IconTitle title = new IconTitle( Icons.JOURNAL.get(), Messages.get(this, "title") );
title.setPos(
(w - title.width()) / 2f,
(w - title.reqWidth()) / 2f,
(top - title.height()) / 2f
);
align(title);
@@ -85,7 +84,7 @@ public class JournalScene extends PixelScene {
panel.size(pw, ph);
panel.x = (w - pw) / 2f;
panel.y = title.bottom() + 5;
panel.y = top;
add(panel);
switch (lastIDX){

View File

@@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndTitledMessage;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Camera;
@@ -72,10 +73,10 @@ public class NewsScene extends PixelScene {
btnExit.setPos(w - btnExit.width(), 0);
add(btnExit);
RenderedTextBlock title = PixelScene.renderTextBlock(Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR);
IconTitle title = new IconTitle( Icons.NEWS.get(), Messages.get(this, "title"));
title.setSize(200, 0);
title.setPos(
(w - title.width()) / 2f,
(w - title.reqWidth()) / 2f,
(20 - title.height()) / 2f
);
align(title);

View File

@@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndDailies;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndRanking;
import com.watabou.noosa.BitmapText;
@@ -77,10 +78,10 @@ public class RankingsScene extends PixelScene {
Rankings.INSTANCE.load();
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR);
IconTitle title = new IconTitle( Icons.RANKINGS.get(), Messages.get(this, "title"));
title.setSize(200, 0);
title.setPos(
(w - title.width()) / 2f,
(w - title.reqWidth()) / 2f,
(20 - title.height()) / 2f
);
align(title);

View File

@@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndGameInProgress;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Camera;
@@ -67,10 +68,10 @@ public class StartScene extends PixelScene {
btnExit.setPos( w - btnExit.width(), 0 );
add( btnExit );
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR);
IconTitle title = new IconTitle( Icons.ENTER.get(), Messages.get(this, "title"));
title.setSize(200, 0);
title.setPos(
(w - title.width()) / 2f,
(w - title.reqWidth()) / 2f,
(20 - title.height()) / 2f
);
align(title);

View File

@@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Image;
import com.watabou.noosa.NinePatch;
@@ -60,10 +61,10 @@ public class SupporterScene extends PixelScene {
btnExit.setPos(w - btnExit.width(), 0);
add(btnExit);
RenderedTextBlock title = PixelScene.renderTextBlock(Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR);
IconTitle title = new IconTitle(Icons.GOLD.get(), Messages.get(this, "title"));
title.setSize(200, 0);
title.setPos(
(w - title.width()) / 2f,
(w - title.reqWidth()) / 2f,
(20 - title.height()) / 2f
);
align(title);

View File

@@ -53,6 +53,7 @@ public class IconTitle extends Component {
icon( icon );
label( Messages.titleCase( item.title() ) );
icon.view( item );
layout();
}
public IconTitle( Heap heap ){
@@ -60,13 +61,13 @@ public class IconTitle extends Component {
icon( icon );
label( Messages.titleCase( heap.title() ) );
icon.view( heap );
layout();
}
public IconTitle( Image icon, String label ) {
super();
icon( icon );
label( label );
layout();
}
@Override
@@ -108,6 +109,10 @@ public class IconTitle extends Component {
}
}
public float reqWidth(){
return imIcon.width() + tfLabel.width() + GAP;
}
public void icon( Image icon ) {
if (icon != null) {
remove(imIcon);