Skip to content

Commit c7e9538

Browse files
Merge pull request MonoGame#43 from AristurtleDev/fix/only-show-title-when-title-is-visible
code hightlight and explination
2 parents 75a9709 + a75db6c commit c7e9538

File tree

1 file changed

+7
-2
lines changed
  • articles/tutorials/building_2d_games/20_implementing_ui_with_gum

1 file changed

+7
-2
lines changed

articles/tutorials/building_2d_games/20_implementing_ui_with_gum/index.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,14 @@ Next update the `Update` method to include Gum's update logic:
478478

479479
[!code[](./snippets/titlescene/update.cs?highlight=14)]
480480

481-
Finally, add Gum's drawing call to the end of the `Draw` method:
481+
Finally, the `Draw` method needs to be updated to:
482482

483-
[!code[](./snippets/titlescene/draw.cs?highlight=36)]
483+
1. Only show the text for the game title when the title panel is visible
484+
2. Add Gum's drawing call to draw the user interface
485+
486+
Update the `Draw` method to the following:
487+
488+
[!code[](./snippets/titlescene/draw.cs?highlight=10-34,36)]
484489
485490
With these changes, our UI system is now fully integrated into the scene's game loop. Gum updates its controls in the `Update` method and draws them in the `Draw` method. This produces a fully functional title screen with buttons that allows players to start the game or adjust audio settings.
486491

0 commit comments

Comments
 (0)