Skip to content

Commit

Permalink
Merge pull request #157 from FenrirWolf/software-keyboard-shenanigans
Browse files Browse the repository at this point in the history
Get software keyboard input without max byte size parameter
  • Loading branch information
FenrirWolf authored Feb 20, 2024
2 parents 4dbe83e + 636c8d7 commit 0345f49
Show file tree
Hide file tree
Showing 5 changed files with 316 additions and 74 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
toolchain:
# Run against a "known good" nightly. Rustc version is 1 day behind the toolchain date
- nightly-2023-06-01
- nightly-2024-02-18
# Check for breakage on latest nightly
- nightly

Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
strategy:
matrix:
toolchain:
- nightly-2023-06-01
- nightly-2024-02-18
- nightly
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion ctru-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ categories = ["os", "api-bindings", "hardware-support"]
exclude = ["examples"]
license = "Zlib"
edition = "2021"
rust-version = "1.70"
rust-version = "1.73"

[lib]
crate-type = ["rlib"]
Expand All @@ -24,6 +24,7 @@ shim-3ds = { git = "https://github.com/rust3ds/shim-3ds.git" }
pthread-3ds = { git = "https://github.com/rust3ds/pthread-3ds.git" }
libc = "0.2.121"
bitflags = "2.3.3"
widestring = "1.0.2"

[build-dependencies]
toml = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion ctru-rs/examples/file-explorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl<'a> FileExplorer<'a> {
fn get_input_and_run(&mut self, action: impl FnOnce(&mut Self, String)) {
let mut keyboard = SoftwareKeyboard::default();

match keyboard.get_string(2048, self.apt, self.gfx) {
match keyboard.launch(self.apt, self.gfx) {
Ok((path, Button::Right)) => {
// Clicked "OK".
action(self, path);
Expand Down
4 changes: 2 additions & 2 deletions ctru-rs/examples/software-keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ fn main() {

// Check if the user request to write some input.
if hid.keys_down().contains(KeyPad::A) {
// Raise the software keyboard. You can perform different actions depending on which
// Launch the software keyboard. You can perform different actions depending on which
// software button the user pressed.
match keyboard.get_string(2048, &apt, &gfx) {
match keyboard.launch(&apt, &gfx) {
Ok((text, Button::Right)) => println!("You entered: {text}"),
Ok((_, Button::Left)) => println!("Cancelled"),
Ok((_, Button::Middle)) => println!("How did you even press this?"),
Expand Down
Loading

0 comments on commit 0345f49

Please sign in to comment.