Fix CreditsLogic to word-wrap the text.

This allows the text to be word-wrapped automatically, rather than the current approach of manually wrapping the source text.
This commit is contained in:
RoosterDragon
2024-09-19 21:15:16 +01:00
committed by abcdefg30
parent 073ce4a718
commit 833e6bd652
4 changed files with 29 additions and 42 deletions

58
AUTHORS
View File

@@ -1,5 +1,4 @@
OpenRA wouldn't be where it is today without the OpenRA wouldn't be where it is today without the hard work of many contributors.
hard work of many contributors.
The OpenRA developers are: The OpenRA developers are:
* Gustas Kažukauskas (PunkPun) * Gustas Kažukauskas (PunkPun)
@@ -163,61 +162,42 @@ Also thanks to:
* Wojciech Walaszek (Voidwalker) * Wojciech Walaszek (Voidwalker)
* Wuschel * Wuschel
Using GNU FreeFont distributed under the GNU GPL Using GNU FreeFont distributed under the GNU GPL terms.
terms.
Using Simple DirectMedia Layer distributed under Using Simple DirectMedia Layer distributed under the terms of the zlib license.
the terms of the zlib license.
Using FreeType distributed under the terms of the Using FreeType distributed under the terms of the FreeType License.
FreeType License.
Using OpenAL Soft distributed under the GNU LGPL. Using OpenAL Soft distributed under the GNU LGPL.
Using SDL2-CS and OpenAL-CS created by Ethan Using SDL2-CS and OpenAL-CS created by Ethan Lee and released under the zlib license.
Lee and released under the zlib license.
Using Eluant created by Chris Howie and released Using Eluant created by Chris Howie and released under the MIT license.
under the MIT license.
Using FuzzyLogicLibrary (fuzzynet) by Dmitry Using FuzzyLogicLibrary (fuzzynet) by Dmitry Kaluzhny and released under the GNU GPL terms.
Kaluzhny and released under the GNU GPL terms.
Using Mono.Nat by Alan McGovern, Ben Motmans, Using Mono.Nat by Alan McGovern, Ben Motmans, Nicholas Terry distributed under the MIT license.
Nicholas Terry distributed under the MIT license.
Using MP3Sharp by Robert Bruke and Zane Wagner Using MP3Sharp by Robert Bruke and Zane Wagner licensed under the GNU LGPL Version 3.
licensed under the GNU LGPL Version 3.
Using TagLib# by Stephen Shaw licensed under the Using TagLib# by Stephen Shaw licensed under the GNU LGPL Version 2.1.
GNU LGPL Version 2.1.
Using NVorbis by Andrew Ward distributed under Using NVorbis by Andrew Ward distributed under the MIT license.
the MIT license.
Using ICSharpCode.SharpZipLib initially by Mike Using ICSharpCode.SharpZipLib initially by Mike Krueger and distributed under the GNU GPL terms.
Krueger and distributed under the GNU GPL terms.
Using rix0rrr.BeaconLib developed by Rico Huijbers Using rix0rrr.BeaconLib developed by Rico Huijbers distributed under MIT License.
distributed under MIT License.
Using DiscordRichPresence developed by Lachee Using DiscordRichPresence developed by Lachee distributed under MIT License.
distributed under MIT License.
Using Json.NET developed by James Newton-King Using Json.NET developed by James Newton-King distributed under MIT License.
distributed under MIT License.
Using ANGLE distributed under the BS3 3-Clause license. Using ANGLE distributed under the BS3 3-Clause license.
Using Pfim developed by Nick Babcock Using Pfim developed by Nick Babcock distributed under the MIT license.
distributed under the MIT license.
Using Linguini by the Space Station 14 team Using Linguini by the Space Station 14 team licensed under Apache and MIT terms.
licensed under Apache and MIT terms.
This site or product includes IP2Location LITE data This site or product includes IP2Location LITE data available from https://www.ip2location.com.
available from https://www.ip2location.com.
Finally, special thanks goes to the original teams Finally, special thanks goes to the original teams at Westwood Studios and EA for creating the classic games which OpenRA aims to reimagine.
at Westwood Studios and EA for creating the classic
games which OpenRA aims to reimagine.

View File

@@ -82,10 +82,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
isShowingModTab = modCredits; isShowingModTab = modCredits;
scrollPanel.RemoveChildren(); scrollPanel.RemoveChildren();
var font = Game.Renderer.Fonts[template.Font];
foreach (var line in modCredits ? modLines : engineLines) foreach (var line in modCredits ? modLines : engineLines)
{ {
var label = template.Clone() as LabelWidget; var label = (LabelWidget)template.Clone();
label.GetText = () => line; label.GetText = () => line;
var wrappedLine = line;
if (label.WordWrap)
wrappedLine = WidgetUtils.WrapText(line, label.Bounds.Width, font);
label.Bounds.Height = Math.Max(label.Bounds.Height, font.Measure(wrappedLine).Y);
scrollPanel.AddChild(label); scrollPanel.AddChild(label);
} }
} }

View File

@@ -42,9 +42,10 @@ Container@CREDITS_PANEL:
Children: Children:
Label@CREDITS_TEMPLATE: Label@CREDITS_TEMPLATE:
X: 8 X: 8
Width: PARENT_RIGHT - 25 Width: PARENT_RIGHT - 24 - 2 * 8
Height: 16 Height: 16
VAlign: Top VAlign: Top
WordWrap: true
Button@BACK_BUTTON: Button@BACK_BUTTON:
Y: PARENT_BOTTOM - 1 Y: PARENT_BOTTOM - 1
Width: 140 Width: 140

View File

@@ -38,9 +38,10 @@ Background@CREDITS_PANEL:
Children: Children:
Label@CREDITS_TEMPLATE: Label@CREDITS_TEMPLATE:
X: 8 X: 8
Width: PARENT_RIGHT - 25 Width: PARENT_RIGHT - 24 - 2 * 8
Height: 16 Height: 16
VAlign: Top VAlign: Top
WordWrap: true
Button@BACK_BUTTON: Button@BACK_BUTTON:
X: PARENT_RIGHT - 180 X: PARENT_RIGHT - 180
Y: PARENT_BOTTOM - 45 Y: PARENT_BOTTOM - 45