Ian Chamberlain
3 years ago
3 changed files with 74 additions and 3 deletions
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
use ctru::gfx::Gfx; |
||||
use ctru::services::apt::Apt; |
||||
use ctru::services::hid::{Hid, KeyPad}; |
||||
use ctru::services::soc::Soc; |
||||
|
||||
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 mut soc = Soc::init().expect("Couldn't obtain SOC controller"); |
||||
|
||||
soc.redirect_to_3dslink(true, true) |
||||
.expect("unable to redirect stdout/err to 3dslink server"); |
||||
|
||||
println!("Hello 3dslink!"); |
||||
eprintln!("Press Start on the device to disconnect and exit."); |
||||
|
||||
// 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(); |
||||
} |
||||
} |
Loading…
Reference in new issue