Skip to content
New issue

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

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

Already on GitHub? # to your account

Update documentation to reflect the recommended way SDL_StorageReady() should be used #12400

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nightmareci
Copy link
Contributor

The example code had to get a bit bigger, since demonstrating the proper usage pattern for SDL_StorageReady() requires showing a main loop with the readiness checking inside.

* bool quit = false;
* while (!quit) {
* // This part is key: You must keep polling events when waiting on
* // storage to be ready (SDL_StorageReady() returns true). Events
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* // storage to be ready (SDL_StorageReady() returns true). Events
* // storage to be ready (SDL_StorageReady() returns true). Event

*
* // Game/graphics/sound/etc. logic here, only using data known to
* // already be valid right now. Logic would set readGameDataNow and/or
* // saveDataOp when needed, then could wait for them every logic tick
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's a tick?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A single step of updating the game logic. In classical 60 FPS games, it'd be a single frame.

@slouken slouken requested a review from icculus February 26, 2025 01:49
@slouken slouken added this to the 3.2.6 milestone Feb 26, 2025
@slouken
Copy link
Collaborator

slouken commented Feb 26, 2025

So this got much more complicated. We can create an article with the storage best practices, but is there a way to simplify this?

@icculus
Copy link
Collaborator

icculus commented Feb 26, 2025

Yeah, this needs to move to the wiki if it needs this much code.

@slouken slouken modified the milestones: 3.2.6, 3.4.0 Mar 1, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants