Browse Source

gfx-wide-mode example working

pull/22/head
Andrea Ciliberti 3 years ago
parent
commit
4a48926ee6
  1. 11
      ctru-rs/examples/gfx-wide-mode.rs

11
ctru-rs/examples/gfx_wide_mode.rs → ctru-rs/examples/gfx-wide-mode.rs

@ -1,7 +1,6 @@
extern crate ctru; extern crate ctru;
use ctru::console::Console; use ctru::console::Console;
use ctru::gfx::Screen;
use ctru::services::hid::KeyPad; use ctru::services::hid::KeyPad;
use ctru::services::{Apt, Hid}; use ctru::services::{Apt, Hid};
use ctru::Gfx; use ctru::Gfx;
@ -11,7 +10,7 @@ fn main() {
let apt = Apt::init().unwrap(); let apt = Apt::init().unwrap();
let hid = Hid::init().unwrap(); let hid = Hid::init().unwrap();
let gfx = Gfx::default(); let gfx = Gfx::default();
let _console = Console::init(&gfx, Screen::Top); let mut _console = Console::init(gfx.top_screen.borrow_mut());
println!("Press A to enable/disable wide screen mode."); println!("Press A to enable/disable wide screen mode.");
@ -23,7 +22,13 @@ fn main() {
} }
if hid.keys_down().contains(KeyPad::KEY_A) { if hid.keys_down().contains(KeyPad::KEY_A) {
gfx.set_wide_mode(!gfx.get_wide_mode()); drop(_console);
let wide_mode = gfx.top_screen.borrow().get_wide_mode();
gfx.top_screen.borrow_mut().set_wide_mode(!wide_mode);
_console = Console::init(gfx.top_screen.borrow_mut());
println!("Press A to enable/disable wide screen mode.");
} }
gfx.flush_buffers(); gfx.flush_buffers();
Loading…
Cancel
Save