diff --git a/ctru-rs/examples/camera-image.rs b/ctru-rs/examples/camera-image.rs index 8f67b47..dcc92ff 100644 --- a/ctru-rs/examples/camera-image.rs +++ b/ctru-rs/examples/camera-image.rs @@ -23,7 +23,7 @@ fn main() { let mut top_screen = gfx.top_screen.borrow_mut(); top_screen.set_double_buffering(true); top_screen.set_framebuffer_format(FramebufferFormat::Rgb565); - + let _console = Console::new(gfx.bottom_screen.borrow_mut()); let mut keys_down; @@ -85,12 +85,7 @@ fn main() { cam.play_shutter_sound(ShutterSound::Normal) .expect("Failed to play shutter sound"); - rotate_image_to_screen( - &buf, - top_screen.raw_framebuffer().ptr, - WIDTH, - HEIGHT, - ); + rotate_image_to_screen(&buf, top_screen.raw_framebuffer().ptr, WIDTH, HEIGHT); // We will only flush the "camera" screen, since the other screen is handled by `Console` top_screen.flush_buffer(); diff --git a/ctru-rs/examples/gfx-wide-mode.rs b/ctru-rs/examples/gfx-wide-mode.rs index 0acf1b2..8036538 100644 --- a/ctru-rs/examples/gfx-wide-mode.rs +++ b/ctru-rs/examples/gfx-wide-mode.rs @@ -26,7 +26,7 @@ fn main() { console = Console::new(gfx.top_screen.borrow_mut()); println!("Press A to enable/disable wide screen mode."); } - + gfx.wait_for_vblank(); } } diff --git a/ctru-rs/examples/thread-info.rs b/ctru-rs/examples/thread-info.rs index 2316f16..28297ac 100644 --- a/ctru-rs/examples/thread-info.rs +++ b/ctru-rs/examples/thread-info.rs @@ -44,7 +44,7 @@ fn main() { if hid.keys_down().contains(KeyPad::KEY_START) { break; } - + gfx.wait_for_vblank(); } } diff --git a/ctru-rs/src/applets/mii_selector.rs b/ctru-rs/src/applets/mii_selector.rs index e7d0559..9d3b3ca 100644 --- a/ctru-rs/src/applets/mii_selector.rs +++ b/ctru-rs/src/applets/mii_selector.rs @@ -155,6 +155,12 @@ impl MiiSelector { } } +impl Default for MiiSelector { + fn default() -> Self { + Self::new() + } +} + impl From for SelectionResult { fn from(ret: ctru_sys::MiiSelectorReturn) -> Self { let raw_mii_data = ret.mii; diff --git a/ctru-rs/src/console.rs b/ctru-rs/src/console.rs index 1891492..e3ba62e 100644 --- a/ctru-rs/src/console.rs +++ b/ctru-rs/src/console.rs @@ -16,9 +16,9 @@ impl<'screen> Console<'screen> { /// Initialize a console on the chosen screen, overwriting whatever was on the screen /// previously (including other consoles). The new console is automatically selected for /// printing. - /// + /// /// # Notes - /// + /// /// [Console] automatically takes care of flushing and swapping buffers for its screen when printing. pub fn new(screen: RefMut<'screen, dyn Screen>) -> Self { let mut context = Box::::default(); diff --git a/ctru-rs/src/services/fs.rs b/ctru-rs/src/services/fs.rs index e1703c5..7788373 100644 --- a/ctru-rs/src/services/fs.rs +++ b/ctru-rs/src/services/fs.rs @@ -29,7 +29,7 @@ bitflags! { const FS_WRITE_FLUSH = 1; const FS_WRITE_UPDATE_TIME = 256; } - + #[derive(Default)] struct FsAttribute: u32 { const FS_ATTRIBUTE_DIRECTORY = 1; diff --git a/ctru-rs/src/services/gfx.rs b/ctru-rs/src/services/gfx.rs index 52638c2..1412bb7 100644 --- a/ctru-rs/src/services/gfx.rs +++ b/ctru-rs/src/services/gfx.rs @@ -56,17 +56,22 @@ pub trait Screen: private::Sealed { } /// Swaps the video buffers. - /// + /// /// This should be used even if double buffering is disabled. fn flush_buffer(&mut self) { let framebuffer = self.raw_framebuffer(); // Flush the data array. `self.raw_framebuffer` should get the correct parameters for all kinds of screens - unsafe { ctru_sys::GSPGPU_FlushDataCache(framebuffer.ptr.cast(), (framebuffer.height * framebuffer.width) as u32) }; + unsafe { + ctru_sys::GSPGPU_FlushDataCache( + framebuffer.ptr.cast(), + (framebuffer.height * framebuffer.width) as u32, + ) + }; } /// Swaps the video buffers. - /// + /// /// This should be used even if double buffering is disabled. fn swap_buffers(&mut self) { unsafe { ctru_sys::gfxScreenSwapBuffers(self.side().into(), true) };