[Scummvm-git-logs] scummvm master -> dcf27268f4abd9de312ffc20fa5b901421b716a7

sev- noreply at scummvm.org
Sun Jan 22 14:46:34 UTC 2023


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e457a45027 GUI: Show complete strings in Achievements tab
dcf27268f4 GUI: Also fix achievements strings for lowres


Commit: e457a45027c5742c038d65926eb71d567674323a
    https://github.com/scummvm/scummvm/commit/e457a45027c5742c038d65926eb71d567674323a
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-01-22T15:46:30+01:00

Commit Message:
GUI: Show complete strings in Achievements tab

Changed paths:
    gui/options.cpp


diff --git a/gui/options.cpp b/gui/options.cpp
index 7e81aebbba1..8589a2f4c8b 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1432,14 +1432,21 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 	uint16 nAchieved = 0;
 	uint16 nHidden = 0;
 	uint16 nMax = AchMan.getAchievementCount();
-
 	uint16 lineHeight = g_gui.xmlEval()->getVar("Globals.Line.Height");
 	uint16 yStep = lineHeight;
 	uint16 ySmallStep = yStep / 3;
 	uint16 yPos = lineHeight + yStep * 3;
+
+	uint16 commentDelta = g_system->getOverlayWidth() <= 320 ? 25 : 30; // textline left tabbing
 	uint16 progressBarWidth = 240;
-	uint16 width = g_system->getOverlayWidth() <= 320 ? 240 : 410;
-	uint16 commentDelta = g_system->getOverlayWidth() <= 320 ? 25 : 30;
+	float scale_factor = g_gui.getScaleFactor();
+
+	uint16 width = 440 + 800 * (scale_factor - 1);
+	uint16 textline_numchars = 70 + 80 * (scale_factor - 1);
+	commentDelta *= scale_factor;
+
+	if (g_system->getOverlayWidth() - width < 100)
+		width = g_system->getOverlayWidth() - 100 * scale_factor; // clamp width to at least 100px smaller than overlay to prevent glitchy scrollbars
 
 	for (int16 viewAchieved = 1; viewAchieved >= 0; viewAchieved--) {
 		// run this twice, first view all achieved, then view all non-hidden & non-achieved
@@ -1467,11 +1474,20 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 			checkBox->setState(isAchieved);
 			yPos += yStep;
 
-	        if (!descr->comment.empty()) {
-				new StaticTextWidget(scrollContainer, lineHeight + commentDelta, yPos, width - commentDelta, yStep, Common::U32String(descr->comment), Graphics::kTextAlignStart, Common::U32String(), ThemeEngine::kFontStyleNormal);
+			if (!descr->comment.empty()) {
+				uint16 str_chars = descr->comment.size(), printed_chars = 0, i = 0;
+				Common::U32String comment_line(descr->comment);
+				while ((str_chars - printed_chars) > textline_numchars) { // check if string needs to go on multiple lines
+					for (i = (printed_chars + textline_numchars - 1); comment_line[i] != ' ' && i > 0; i--)
+						; // find a space to avoid breaking words
+					new StaticTextWidget(scrollContainer, lineHeight + commentDelta, yPos, width - commentDelta, yStep, Common::U32String(comment_line.begin() + (!printed_chars ? 0 : (printed_chars + 1)), comment_line.begin() + i), Graphics::kTextAlignStart, Common::U32String(), ThemeEngine::kFontStyleNormal);
+					yPos += yStep;
+					printed_chars = i;
+					i++; // to skip trailing space when leaving the loop
+				}
+				new StaticTextWidget(scrollContainer, lineHeight + commentDelta, yPos, width - commentDelta, yStep, Common::U32String(comment_line.begin() + i, comment_line.end()), Graphics::kTextAlignStart, Common::U32String(), ThemeEngine::kFontStyleNormal);
 				yPos += yStep;
 			}
-
 			yPos += ySmallStep;
 		}
 	}


Commit: dcf27268f4abd9de312ffc20fa5b901421b716a7
    https://github.com/scummvm/scummvm/commit/dcf27268f4abd9de312ffc20fa5b901421b716a7
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-01-22T15:46:30+01:00

Commit Message:
GUI: Also fix achievements strings for lowres

Changed paths:
    gui/options.cpp


diff --git a/gui/options.cpp b/gui/options.cpp
index 8589a2f4c8b..11a4a267f41 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1437,16 +1437,25 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 	uint16 ySmallStep = yStep / 3;
 	uint16 yPos = lineHeight + yStep * 3;
 
-	uint16 commentDelta = g_system->getOverlayWidth() <= 320 ? 25 : 30; // textline left tabbing
-	uint16 progressBarWidth = 240;
+	uint16 width;
+	uint16 textline_numchars;  // max number of chars in textline
+	uint16 progressBarWidth;
+	uint16 commentDelta = g_system->getOverlayWidth() <= 320 ? 20 : 30; // textline left tabbing
 	float scale_factor = g_gui.getScaleFactor();
 
-	uint16 width = 440 + 800 * (scale_factor - 1);
-	uint16 textline_numchars = 70 + 80 * (scale_factor - 1);
-	commentDelta *= scale_factor;
-
-	if (g_system->getOverlayWidth() - width < 100)
-		width = g_system->getOverlayWidth() - 100 * scale_factor; // clamp width to at least 100px smaller than overlay to prevent glitchy scrollbars
+	if (g_system->getOverlayWidth() > 320) { // hires
+		width = 440 + 800 * (scale_factor - 1);
+		textline_numchars = 70 + 80 * (scale_factor - 1);
+		progressBarWidth = 240;
+		commentDelta *= scale_factor;
+		if (g_system->getOverlayWidth() - width < 100) {
+			width = g_system->getOverlayWidth() - 100 * scale_factor; // clamp width to at least 100px smaller than overlay to prevent glitchy scrollbars
+		}
+	} else { // lores
+		width = 250 + 480 * (scale_factor - 1);
+		textline_numchars = 40 + 60 * (scale_factor - 1);
+		progressBarWidth = 130;
+	}
 
 	for (int16 viewAchieved = 1; viewAchieved >= 0; viewAchieved--) {
 		// run this twice, first view all achieved, then view all non-hidden & non-achieved
@@ -1478,8 +1487,7 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 				uint16 str_chars = descr->comment.size(), printed_chars = 0, i = 0;
 				Common::U32String comment_line(descr->comment);
 				while ((str_chars - printed_chars) > textline_numchars) { // check if string needs to go on multiple lines
-					for (i = (printed_chars + textline_numchars - 1); comment_line[i] != ' ' && i > 0; i--)
-						; // find a space to avoid breaking words
+					for (i = (printed_chars + textline_numchars - 1); comment_line[i] != ' ' && i > 0; i--) {}; // find a space to avoid breaking words
 					new StaticTextWidget(scrollContainer, lineHeight + commentDelta, yPos, width - commentDelta, yStep, Common::U32String(comment_line.begin() + (!printed_chars ? 0 : (printed_chars + 1)), comment_line.begin() + i), Graphics::kTextAlignStart, Common::U32String(), ThemeEngine::kFontStyleNormal);
 					yPos += yStep;
 					printed_chars = i;




More information about the Scummvm-git-logs mailing list