Skip to content
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

Second wave of API changes #116

Merged
merged 40 commits into from
May 4, 2023
Merged

Second wave of API changes #116

merged 40 commits into from
May 4, 2023

Conversation

Meziu
Copy link
Member

@Meziu Meziu commented Apr 6, 2023

Related to #102

This is a second wave of breaking API changes based on the official guidelines (I can hear you cry from here).

Most notable changes:

  • All service init functions have been renamed to new (it's standard for any constructor).
  • Types derive as many traits as possible (each was thought out for the type's specific purpose, of course)
  • Small renames
  • Gfx::swap_buffers and Gfx::flush_buffers have been moved to the Screen trait. Originally, those functions modified a global state. Now each Screen can flush its own buffers. Also, Console handles flushing and swapping by itself, so most examples don't even mention those functions anymore.

This is one of the last PRs in preparation to the docs PR.

Copy link
Member

@ian-h-chamberlain ian-h-chamberlain left a comment

Choose a reason for hiding this comment

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

Mostly looks good! I had some questions about the Gfx changes but I think everything else looks good.

Also you may want to merge master back into this branch to make the diff a bit simpler (without displaying the changes from #115 )

ctru-rs/src/services/gfx.rs Outdated Show resolved Hide resolved
ctru-rs/src/services/gfx.rs Show resolved Hide resolved
ctru-rs/src/services/gfx.rs Outdated Show resolved Hide resolved
ctru-rs/src/services/cfgu.rs Outdated Show resolved Hide resolved
ctru-rs/src/applets/swkbd.rs Show resolved Hide resolved
ctru-rs/src/applets/mii_selector.rs Outdated Show resolved Hide resolved
ctru-rs/examples/hello-world.rs Show resolved Hide resolved
ctru-rs/examples/gfx-3d-mode.rs Outdated Show resolved Hide resolved
Meziu and others added 2 commits April 11, 2023 20:21
Oops! The argument to `gfxScreenSwapBuffers` is gfxScreen_t, not
gfx3dSide_t ! Unfortunately they are both alias to libc::c_uint so we
didn't get any help from the Rust compiler when passing the screen side
into this function.
Rename to flush_buffers, and just have TopScreen3D's impl do both. This
still allows individual flushing of left and right if needed but most
people would probably just use `TopScreen3D::flush_buffers`.
Clarify the behavior of `swap_buffers` for single buffering mode and
update bitmap example to prove that this is actually how it works.
@Meziu Meziu mentioned this pull request May 2, 2023
@Meziu Meziu merged commit ca8f13d into master May 4, 2023
@Meziu Meziu mentioned this pull request May 5, 2023
@Meziu Meziu deleted the improve/api branch May 30, 2023 17:27
@Meziu Meziu restored the improve/api branch May 30, 2023 17:28
@Meziu Meziu deleted the improve/api branch May 30, 2023 17:28
@Meziu Meziu restored the improve/api branch May 30, 2023 17:28
@Meziu Meziu deleted the improve/api branch November 27, 2023 15:43
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