Created
September 12, 2022 22:00
-
-
Save gitcrtn/75ae0094d70f7c923fd65b3591a75ff4 to your computer and use it in GitHub Desktop.
Minimal 3ds example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
cd /build | |
cargo 3ds build | |
cargo 3ds build --release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "trial3ds" | |
version = "0.1.0" | |
edition = "2021" | |
[dependencies] | |
ctru-rs = { git = "https://github.com/Meziu/ctru-rs" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Warning: This build took 1 hour with i3-6100T. | |
git clone https://github.com/ian-h-chamberlain/docker-rust-devkitarm.git | |
cd docker-rust-devkitarm | |
DOCKER_BUILDKIT=1 docker build -t rust-devkitarm . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate ctru; | |
use ctru::gfx::Gfx; | |
use ctru::console::Console; | |
use ctru::services::apt::Apt; | |
use ctru::services::hid::{Hid, KeyPad}; | |
fn main() { | |
let apt = Apt::init().unwrap(); | |
let hid = Hid::init().unwrap(); | |
let gfx = Gfx::init().unwrap(); | |
let _console = Console::init(gfx.top_screen.borrow_mut()); | |
println!("Hello, world!"); | |
println!("\x1b[29;16HPress Start to exit"); | |
while apt.main_loop() { | |
gfx.flush_buffers(); | |
gfx.swap_buffers(); | |
gfx.wait_for_vblank(); | |
hid.scan_input(); | |
if hid.keys_down().contains(KeyPad::KEY_START) { | |
break; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
docker run \ | |
--rm \ | |
--name 3ds-builder \ | |
-v /path/to/proj:/build \ | |
-v $PWD/build.sh:/build.sh \ | |
--entrypoint /build.sh \ | |
rust-devkitarm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment