Browse Source

Fixed examples for latest Console changes

pull/19/head
Andrea Ciliberti 3 years ago
parent
commit
d021da0c6f
  1. 4
      .gitignore
  2. 2
      ctru-rs/examples/buttons.rs
  3. 2
      ctru-rs/examples/gfx_wide_mode.rs
  4. 4
      ctru-rs/examples/hello-both-screens.rs
  5. 3
      ctru-rs/examples/hello-world.rs
  6. 2
      ctru-rs/examples/software-keyboard.rs

4
.gitignore vendored

@ -1,5 +1,3 @@
target target
Cargo.lock Cargo.lock
.cargo
.idea/

2
ctru-rs/examples/buttons.rs

@ -9,7 +9,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::default(); let console = Console::init(&gfx, ctru::gfx::Screen::Top);
println!("Hi there! Try pressing a button"); println!("Hi there! Try pressing a button");
println!("\x1b[29;16HPress Start to exit"); println!("\x1b[29;16HPress Start to exit");

2
ctru-rs/examples/gfx_wide_mode.rs

@ -11,7 +11,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(Screen::Top); let _console = Console::init(&gfx, ctru::gfx::Screen::Top);
println!("Press A to enable/disable wide screen mode."); println!("Press A to enable/disable wide screen mode.");

4
ctru-rs/examples/hello-both-screens.rs

@ -11,11 +11,11 @@ fn main() {
let gfx = Gfx::default(); let gfx = Gfx::default();
// Start a console on the top screen // Start a console on the top screen
let top_screen = Console::init(Screen::Top); let top_screen = Console::init(&gfx, ctru::gfx::Screen::Top);
// Start a console on the bottom screen. // Start a console on the bottom screen.
// The most recently initialized console will be active by default // The most recently initialized console will be active by default
let bottom_screen = Console::init(Screen::Bottom); let bottom_screen = Console::init(&gfx, ctru::gfx::Screen::Bottom);
// Let's print on the top screen first // Let's print on the top screen first
top_screen.select(); top_screen.select();

3
ctru-rs/examples/hello-world.rs

@ -21,8 +21,7 @@ fn main() {
// Initialize a ctrulib console and direct standard output to it. // Initialize a ctrulib console and direct standard output to it.
// Consoles can be initialized on both the top and bottom screens. // Consoles can be initialized on both the top and bottom screens.
// The top screen is initialized by default. let _console = Console::init(&gfx, ctru::gfx::Screen::Top);
let _console = Console::default();
// Now we can print to stdout! // Now we can print to stdout!
println!("Hello, world!"); println!("Hello, world!");

2
ctru-rs/examples/software-keyboard.rs

@ -9,7 +9,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::default(); let _console = Console::init(&gfx, ctru::gfx::Screen::Top);
println!("Press A to enter some text or press Start to quit"); println!("Press A to enter some text or press Start to quit");

Loading…
Cancel
Save