-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Update documentation to reflect the recommended way SDL_StorageReady() should be used
#12400
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
Conversation
…()` should be used (addresses libsdl-org#12201)
| * 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * // 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's a tick?
There was a problem hiding this comment.
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.
|
So this got much more complicated. We can create an article with the storage best practices, but is there a way to simplify this? |
|
Yeah, this needs to move to the wiki if it needs this much code. |
flibitijibibo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the header can stay as a basic HelloWorld type sample, and the more verbose example should be in examples/? We can link directly to it in the header as well.
|
Was going to file a ticket about verifying Steam Storage on AArch64 but ultimately it ended up reading like a request for an example, so what I suggested earlier seems like the best way to solve both problems here. That said, I don't have hardware or client access to test both linuxarm64 and androidarm64 so that may have to come after 3.4...? |
|
Did a quick attempt at making this a standalone example and I think this is too complicated even on its own - it reads almost as if this is meant to be a developer's starting point for an entire engine rather than just showing off what the API can do on its own and letting developers use their imagination for how to integrate it into their own system. The externs in the Read/Write samples only seem to exist to assume maximum complexity, and the comments talk a lot about what a game might do, but doesn't really make it easy to transfer to an existing program without also copying a lot of the additional layering going on (such as the SaveDataOp_T enumeration). All that said, the point is well taken: I need to sit down and make a real standalone example, particularly one that leverages something like @slouken, if it's okay with you let's close this and make the new ticket an "early next milestone" task on my end. |
|
Sounds good. |
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.