Skip to content

Pause#58

Merged
Sophon96 merged 53 commits into
jabacat:mainfrom
Sophon96:pause
Jun 3, 2026
Merged

Pause#58
Sophon96 merged 53 commits into
jabacat:mainfrom
Sophon96:pause

Conversation

@Sophon96

@Sophon96 Sophon96 commented May 27, 2026

Copy link
Copy Markdown
Member
  • handle escape key input
    • disable window close on escape
    • toggle menu on escape
  • draw pause menu when active
    • tint screen when pause menu active
    • pause menu interface
    • general layout engine
    • two-column video settings submenu
      • Back button in submenu
      • Fix fullscreen causing mouse position to report incorrectly and decor to disappear
  • Grand Refactor
    • Button actions should go in separate methods
    • Layout engine should be separated
    • Button generation should be separated
    • Layout engine should be able to handle another axis of layouts
    • GUI code should be in a separate module
      • GUI should be generic
        • Button should be generic
        • Layouts should be generic
  • camera exploding after disabling cursor following switch to SDL

@adamhutchings adamhutchings left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One change, one possible change

Comment thread src/main.rs Outdated
Comment thread src/render/pause_menu.rs
@Sophon96 Sophon96 requested a review from adamhutchings May 27, 2026 07:28
JakeRoggenbuck
JakeRoggenbuck previously approved these changes May 27, 2026

@JakeRoggenbuck JakeRoggenbuck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Works!

Image

Would you be able to make the menu pop up for both escape and a letter key (maybe m or p)? I have esc rebound loll and it messes with my caps lock.

@adamhutchings adamhutchings left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some minor code organization.

Comment thread src/render/pause_menu.rs Outdated
QUIT,
}

impl ButtonType {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I feel like this needs to be a callback instead of an enum. Allows much more easily for the creation of one-time buttons should we ever need them. Example from the near future: list of worlds to load

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

nah i disagree, rust enums are crazy OP and they can pretty much do whatever the heck you want

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rust enums can contain a string value like:

#[derive(Clone, Copy, PartialEq)]
enum ButtonType {
    BTG,
    QUIT,
    WORLD(String)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Possibly, but I still think it should be neater than a match statement to raw blocks of code. At least have back_to_game() and quit() functions defined that can be called by a match statement

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah that seems reasonable; ill probably do a refactor once this pr is ready to review / feature complete

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you could always add an enum variant with a callback function as a parameter if you want to support callback functions

Comment thread src/render/pause_menu.rs Outdated
Comment thread src/render/pause_menu.rs Outdated
@JakeRoggenbuck

Copy link
Copy Markdown
Member
image

Crazy merge conflict

@adamhutchings

Copy link
Copy Markdown
Contributor

In terms of functionality, this is great though

@Sophon96

Copy link
Copy Markdown
Member Author

The fullscreen toggle breaks hovering and clicking buttons on my machine; not sure if this is specific to my setup. Would appreciate test results!

@adamhutchings adamhutchings left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull from main with the new tests to make sure that CI isn't broken (I know how much you love that!)

Comment thread src/render/pause_menu.rs Outdated
Comment thread src/render/pause_menu.rs Outdated

@adamhutchings adamhutchings left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some small changes.

Also, on a more serious note, this has a bug on macOS -- when I test and press "back to game", I snap to looking directly vertically.

Comment thread src/render/pause_menu.rs Outdated
Comment thread src/render/pause_menu.rs
Comment thread src/render/pause_menu.rs Outdated
@Sophon96

Copy link
Copy Markdown
Member Author

Yeah, the camera snapping is an issue for me too. Something with the way SDL handles mouse position.

@adamhutchings

Copy link
Copy Markdown
Contributor

Re: the camera snapping, isn't this exactly why we got rid of GLFW?

@Sophon96

Copy link
Copy Markdown
Member Author

Re: the camera snapping, isn't this exactly why we got rid of GLFW?

We got rid of GLFW because it had some weird bugs with exiting fullscreen; I think switching to SDL now brings some quirks when locking the cursor

@Sophon96

Copy link
Copy Markdown
Member Author

No doubt this is the culprit
image

We should be tracking our own last mouse position and computing delta based on that

@JakeRoggenbuck

Copy link
Copy Markdown
Member
image

Still having the same issue

mileskerr
mileskerr previously approved these changes May 31, 2026

@mileskerr mileskerr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we have to merge this for the sake of future generations

@mileskerr

Copy link
Copy Markdown
Contributor

sdl is obviously a bust lets merge this and then i'll start work on getting glfw to work again

@Sophon96 Sophon96 mentioned this pull request May 31, 2026
6 tasks
@JakeRoggenbuck

Copy link
Copy Markdown
Member

Still build errors with:

jake@Jakes-MacBook-Neo minecrab % source scripts/macos-setup.sh
jake@Jakes-MacBook-Neo minecrab % RUSTFLAGS= LIBRARY_PATH="$(brew --prefix)/lib" cargo r

JakeRoggenbuck
JakeRoggenbuck previously approved these changes Jun 2, 2026

@JakeRoggenbuck JakeRoggenbuck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Works after installing pkg-config! No issue with window size either

@JakeRoggenbuck

Copy link
Copy Markdown
Member
image

@JakeRoggenbuck JakeRoggenbuck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Works!

mileskerr
mileskerr approved these changes Jun 3, 2026
Comment thread src/render/pause_menu.rs
@Sophon96 Sophon96 merged commit f565203 into jabacat:main Jun 3, 2026
8 checks passed
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.

4 participants