Skip to content

Gum styling update 2025 8 #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

vchelaru
Copy link
Contributor

@vchelaru vchelaru commented Aug 3, 2025

This change does the following:

  1. Updates all Initialize calls to use the "V2" styling. This is the recommended approach for current Gum projects.
  2. Updates screenshots in tutorial 20 to use the new V2 styling appearances.
  3. Updates namespaces from MonoGameGum.Forms -> Gum.Forms to avoid warnings and future removal of old namespace.
  4. Updated link to new Gum Upgrading root page.
  5. Updates tutorial 21 to use the new ButtonVisual, cutting out ~10 lines of code and simplifying styling.

@vchelaru vchelaru marked this pull request as draft August 3, 2025 20:28
@vchelaru vchelaru marked this pull request as ready for review August 4, 2025 04:28
Copy link
Contributor

@AristurtleDev AristurtleDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor grammatical changes.


> [!NOTE]
> We only need to pass our [**Game**](xref:Microsoft.Xna.Framework.Game) instance since we are using Gum as a code-first approach. Gum also offers a visual editor that creates Gum project files. When using the editor, you will need to also pass the Gum Project file here.
> We only need to pass our [**Game**](xref:Microsoft.Xna.Framework.Game) instance and the visuals version since we are using Gum as a code-first approach. Gum also offers a visual editor that creates Gum project files. When using the editor, you will need to also pass the Gum Project file to `Initialize`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could link to the documentation or site for the Gum Editor here since it's mentioned in the node in case readers are curious.

Our first custom component will be an `AnimatedButton` that inherits from Gum's base `Button` class. This button will use the game's existing texture atlas for its visual appearance and provide animation when focused.
Our first custom component is an `AnimatedButton` that inherits from Gum's base `Button` class. This button uses the game's existing texture atlas for its visual appearance and animates when focused.

By default all Gum components provide a Visual property which can be casted to a type specific to the particular control. By convention the visual type is named the same as the component with the word `Visual` appened. For example, we will be casting the AnimatedButton's Visual property to `ButtonVisual` to access button-specific properties.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be which can be cast instead of casted?


Every customized control needs a top-level container to hold all visual elements. For our button, we create a `ContainerRuntime` that manages the button's size and contains all other visual elements:
As mentioned earlier, we first access the Visual object and cast it to a ButtonVisual. Doing so gives us access to button-specific proerpties including individual elements (such as the text and background visuals) as well as the states that are applied when the button is hovered or pressed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ButtonVisual" is missing the inline code block formatting so it's ButtonVisual

@SimonDarksideJ
Copy link
Collaborator

Some review comments @vchelaru which I agree with, if you can update please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants