From 4adcf7013c8a0fc471b117554f15c8038d7c4c31 Mon Sep 17 00:00:00 2001 From: Dav999-v Date: Mon, 3 Aug 2020 00:11:58 +0200 Subject: [PATCH] Reposition game time and trinket count in game save box The game time is moved a little to the left, and the trinket count a little to the right. To fix #376 for real, the trinket count is now positioned automatically based on its length. The trinket icon is now also displayed at the far right (instead of to the left of the count) for better symmetry, and so that switching between tele save and quick save doesn't make the trinket icon move if the trinket counts have different lengths. --- desktop_version/src/Render.cpp | 58 ++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 7f4a2371..faeea71f 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -632,6 +632,7 @@ void menurender() switch (game.currentmenuoption) { case 0: + { //Show teleporter save info graphics.drawpixeltextbox(17, 65-20, 286, 90, 36,12, 65, 185, 207,0,4); @@ -641,13 +642,16 @@ void menurender() { graphics.drawcrewman(169-(3*42)+(i*42), 95-20, i, game.tele_crewstats[i], true); } - graphics.Print(160 - 84, 132-20, game.tele_gametime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.Print(160 + 40, 132-20, help.number(game.tele_trinkets), 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + graphics.Print(59, 132-20, game.tele_gametime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + const std::string& trinketcount = help.number(game.tele_trinkets); + graphics.Print(262-graphics.len(trinketcount), 132-20, trinketcount, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.drawsprite(50, 126-20, 50, graphics.col_clock); - graphics.drawsprite(175, 126-20, 22, graphics.col_trinket); + graphics.drawsprite(34, 126-20, 50, graphics.col_clock); + graphics.drawsprite(270, 126-20, 22, graphics.col_trinket); break; + } case 1: + { //Show quick save info graphics.drawpixeltextbox(17, 65-20, 286, 90, 36,12, 65, 185, 207,0,4); @@ -657,13 +661,15 @@ void menurender() { graphics.drawcrewman(169-(3*42)+(i*42), 95-20, i, game.quick_crewstats[i], true); } - graphics.Print(160 - 84, 132-20, game.quick_gametime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.Print(160 + 40, 132-20, help.number(game.quick_trinkets), 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + graphics.Print(59, 132-20, game.quick_gametime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + const std::string& trinketcount = help.number(game.quick_trinkets); + graphics.Print(262-graphics.len(trinketcount), 132-20, trinketcount, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.drawsprite(50, 126-20, 50, graphics.col_clock); - graphics.drawsprite(175, 126-20, 22, graphics.col_trinket); + graphics.drawsprite(34, 126-20, 50, graphics.col_clock); + graphics.drawsprite(270, 126-20, 22, graphics.col_trinket); break; } + } break; case Menu::gameover: case Menu::gameover2: @@ -2220,20 +2226,22 @@ void maprender() if (graphics.flipmode) { graphics.Print(0, 122, game.customleveltitle, 25, 255 - (help.glow / 2), 255 - (help.glow / 2), true); - graphics.Print(160 - 84, 78, game.savetime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.Print(160 + 40, 78, help.number(game.savetrinkets), 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + graphics.Print(59, 78, game.savetime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + const std::string& trinketcount = help.number(game.savetrinkets); + graphics.Print(262-graphics.len(trinketcount), 78, trinketcount, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.drawsprite(50, 74, 50, graphics.col_clock); - graphics.drawsprite(175, 74, 22, graphics.col_trinket); + graphics.drawsprite(34, 74, 50, graphics.col_clock); + graphics.drawsprite(270, 74, 22, graphics.col_trinket); } else { graphics.Print(0, 90, game.customleveltitle, 25, 255 - (help.glow / 2), 255 - (help.glow / 2), true); - graphics.Print(160 - 84, 132, game.savetime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.Print(160 + 40, 132, help.number(game.savetrinkets), 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + graphics.Print(59, 132, game.savetime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + const std::string& trinketcount = help.number(game.savetrinkets); + graphics.Print(262-graphics.len(trinketcount), 132, trinketcount, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.drawsprite(50, 126, 50, graphics.col_clock); - graphics.drawsprite(175, 126, 22, graphics.col_trinket); + graphics.drawsprite(34, 126, 50, graphics.col_clock); + graphics.drawsprite(270, 126, 22, graphics.col_trinket); } } else @@ -2267,11 +2275,12 @@ void maprender() { graphics.drawcrewman(169-(3*42)+(i*42), 98, i, game.crewstats[i], true); } - graphics.Print(160 - 84, 78, game.savetime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.Print(160 + 40, 78, help.number(game.savetrinkets), 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + graphics.Print(59, 78, game.savetime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + const std::string& trinketcount = help.number(game.savetrinkets); + graphics.Print(262-graphics.len(trinketcount), 78, trinketcount, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.drawsprite(50, 74, 50, graphics.col_clock); - graphics.drawsprite(175, 74, 22, graphics.col_trinket); + graphics.drawsprite(34, 74, 50, graphics.col_clock); + graphics.drawsprite(270, 74, 22, graphics.col_trinket); } else { @@ -2280,11 +2289,12 @@ void maprender() { graphics.drawcrewman(169-(3*42)+(i*42), 95, i, game.crewstats[i], true); } - graphics.Print(160 - 84, 132, game.savetime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.Print(160 + 40, 132, help.number(game.savetrinkets), 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + graphics.Print(59, 132, game.savetime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); + const std::string& trinketcount = help.number(game.savetrinkets); + graphics.Print(262-graphics.len(trinketcount), 132, trinketcount, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)); - graphics.drawsprite(50, 126, 50, graphics.col_clock); - graphics.drawsprite(175, 126, 22, graphics.col_trinket); + graphics.drawsprite(34, 126, 50, graphics.col_clock); + graphics.drawsprite(270, 126, 22, graphics.col_trinket); } } else