day four: letter ui, scaling the ui, displaying collected letters and disabling input

6 Jun 2025 · Mania devlog

Date: 06.06.2025

Session Duration: 16:00 - 18:00

Progress

  1. Letter UI I list collected letters as UI elements on the top left of my screen. Later on, I will use their indices for player to re-read them. I also made a simple UI for the letter that displays the content and frames it with the color of the mood. I wrote very basic code, so there is a lot of duplication for the paddings.

When the player collects a letter, it is set as the active letter. For this, I added a new state to the player: PlayerStateReadingLetter. While in this state, the ui draws the letter

PlayerState :: union #no_nil {
    PlayerStateNormal,
    PlayerStateJumping,
    PlayerStateSmashing,
    PlayerStateDashing,
    PlayerStateReadingLetter,
}

PlayerStateReadingLetter :: struct {
    active_letter: Entity_Handle,
}
  1. Disabling Input I disabled all input except for Enter while reading letter. I did this very brutally for now
player := hm.get(&g_mem.entities, g_mem.player)
    player_data, _ := player.data.(Player_Data)
    if _, ok := player_data.state.(PlayerStateReadingLetter); ok {
        input = {
            enter = input.enter,
        }
    }
  1. Scaling the UI I had to do quite a bit of UI programming. The UI had to be scaled for the user's screen size, and things got messy in the beginning. But I figured it out.

Notes

Next Steps