diff --git a/ctru-rs/examples/system-language-region-model.rs b/ctru-rs/examples/system-language-region-model.rs new file mode 100644 index 0000000..e2a9eae --- /dev/null +++ b/ctru-rs/examples/system-language-region-model.rs @@ -0,0 +1,34 @@ +use ctru::console::Console; +use ctru::gfx::Gfx; +use ctru::services::apt::Apt; +use ctru::services::hid::{Hid, KeyPad}; +use ctru::services::cfgu::Cfgu; + +fn main() { + ctru::init(); + let gfx = Gfx::init().expect("Couldn't obtain GFX controller"); + let hid = Hid::init().expect("Couldn't obtain HID controller"); + let apt = Apt::init().expect("Couldn't obtain APT controller"); + let cfgu = Cfgu::init().expect("Couldn't obtain CFGU controller"); + let _console = Console::init(gfx.top_screen.borrow_mut()); + + println!("\x1b[0;0H{}", format!("Region: {:?}", cfgu.get_region().unwrap())); + println!("\x1b[0;10H{}", format!("Language: {:?}", cfgu.get_language().unwrap())); + println!("\x1b[0;20H{}", format!("Model: {:?}", cfgu.get_model().unwrap())); + + // Main loop + while apt.main_loop() { + //Scan all the inputs. This should be done once for each frame + hid.scan_input(); + + if hid.keys_down().contains(KeyPad::KEY_START) { + break; + } + // Flush and swap framebuffers + gfx.flush_buffers(); + gfx.swap_buffers(); + + //Wait for VBlank + gfx.wait_for_vblank(); + } +}