Repository navigation
Scenify the credits screen - #1027
Merged
Merged
Conversation
The credits screen was an empty Node2D; the background, credits label and exit button were all built in ShowCredits(). Move the layout into Credits.tscn so it can be seen and edited in the scene editor, leaving only the runtime bits in code: the Civ3/standalone artwork, the credits text and the exit button signal. The credits label now sits in a VBoxContainer inside a ScrollContainer, so the column scrolls as one continuous block and further credit sources can be added as sibling nodes instead of being concatenated into a single label. The column also scrolls itself slowly, and pauses for a few seconds if the player scrolls up, so manual scrolling still works. The fonts are theme overrides on the label rather than a Theme built in code, preserving the intended size of 14 that the old fixed_size calls asked for. Finally, move the screen into UIElements/Credits/ alongside the other UI screens, and read credits.txt via the project directory / GamePaths rather than a cwd-relative "./Text/credits.txt", so it loads from an export too.
Member
|
Thanks! I'll check out the scene later but at a glance this looks good. As far as coordinating with 1016, we had talked offline about keeping the credit sources in separate labels which is what prompted my request for the vertical container. I think we'll load credits.txt into the default label, my notice.md from #1017 into a MarkdownLabel, and the compiled assets credits into another. This could merge first and we can tweak the script to target the new nodes. |
…s-screen # Conflicts: # C7/Credits.cs # C7/Credits.tscn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1020
What changed
The credits screen was an empty
Node2D—ShowCredits()built the background,label, fonts and exit button in code. The layout now lives in
C7/UIElements/Credits/Credits.tscn:Positions and sizes are unchanged from the previous code, so this should be a
pure layout refactor visually.
Code now only handles what cannot live in the scene:
TextureLoader.Load(...)for the background and exit textures, which comefrom the game mode / Lua so the editor cannot resolve them.
Pressedsignal.The label sits in a
VBoxContainerinside aScrollContainer, so the columnscrolls as one continuous block and further credit sources can be added as
sibling nodes.
fit_contentis on so the label grows to its content, and itsown scrolling is off so the outer
ScrollContainerowns the scroll — the labelalso needs
horizontal_scroll_modedisabled on the container so the text wrapsto the column width instead of scrolling sideways.
Auto-scroll advances ~24 px/s, accumulating fractional pixels (at 60fps one
frame is 0.4px, which would truncate to zero and never move), and pauses for 3s
whenever the player scrolls up so manual scrolling still works.
Fonts moved from a
Themebuilt in code totheme_override_fonts/theme_override_font_sizes, the patternmain_menu.tscnalready uses. The sizestays 14, which is what the old
FixedSize = 14calls intended.Also moved the screen into
UIElements/Credits/alongside the other UI screens,and fixed the credits text path: it was
"./Text/credits.txt", relative to theworking directory, which fails in an export (a Finder-launched macOS app has
/as its working directory). It now uses the project directory in the editor and
GamePaths.BaseDirin an export.Testing
node types and parents, that all five exported node paths resolve, the label
flags, and that all four theme font slots resolve to Noto Sans at size 14.
Run both in a working tree and in a fresh worktree with a cold Godot import
cache, to confirm the committed
.uidfiles are correct after the move.scroll_verticaladvanced over 180 frames.OpenCiv3.applogsCredits: Now rolling the credits!with no errors, i.e.both textures loaded and credits.txt was found through the export layout.
dotnet test— 111 passed, 1 skipped.dotnet format C7/C7.sln whitespace --verify-no-changespasses.Coordination with #1016
#1016 ("Asset credits") also edits
C7/Credits.cs, to readasset_credits.txtand
licences.txtand concatenate all three into a single label:That is the same file, so the two will conflict textually. This change is
compatible with that goal though: instead of concatenating, each text can be its
own
RichTextLabelchild ofCreditsColumnand it will still scroll as onecolumn. Happy to rebase on #1016, or rework it into sibling labels if that lands
first — whichever is preferred.