Skip to content

Instantly share code, notes, and snippets.

@gitcrtn
Created September 12, 2022 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitcrtn/75ae0094d70f7c923fd65b3591a75ff4 to your computer and use it in GitHub Desktop.
Save gitcrtn/75ae0094d70f7c923fd65b3591a75ff4 to your computer and use it in GitHub Desktop.
Minimal 3ds example
#!/usr/bin/env bash
cd /build
cargo 3ds build
cargo 3ds build --release
[package]
name = "trial3ds"
version = "0.1.0"
edition = "2021"
[dependencies]
ctru-rs = { git = "https://github.com/Meziu/ctru-rs" }
#!/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 .
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;
}
}
}
#!/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