Skip to content

Commit

Permalink
SoftwareKeyboard::get_string -> SoftwareKeyboard::launch
Browse files Browse the repository at this point in the history
  • Loading branch information
FenrirWolf committed Feb 19, 2024
1 parent 0576e34 commit cb67d92
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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(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(&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
8 changes: 4 additions & 4 deletions ctru-rs/src/applets/swkbd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub enum ButtonConfig {
LeftMiddleRight = 3,
}

/// Error returned by an unsuccessful [`SoftwareKeyboard::get_string()`].
/// Error returned by an unsuccessful [`SoftwareKeyboard::launch()`].
#[doc(alias = "SwkbdResult")]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(i32)]
Expand Down Expand Up @@ -266,13 +266,13 @@ impl SoftwareKeyboard {
/// use ctru::applets::swkbd::SoftwareKeyboard;
/// let mut keyboard = SoftwareKeyboard::default();
///
/// let (text, button) = keyboard.get_string(&apt, &gfx)?;
/// let (text, button) = keyboard.launch(&apt, &gfx)?;
/// #
/// # Ok(())
/// # }
/// ```
#[doc(alias = "swkbdInputText")]
pub fn get_string(&mut self, _apt: &Apt, _gfx: &Gfx) -> Result<(String, Button), Error> {
pub fn launch(&mut self, _apt: &Apt, _gfx: &Gfx) -> Result<(String, Button), Error> {
let mut output = String::new();

unsafe {
Expand Down Expand Up @@ -608,7 +608,7 @@ impl SoftwareKeyboard {
///
/// Keyboard input is converted from UTF-16 to UTF-8 before being handed to Rust,
/// so this code point limit does not necessarily equal the max number of UTF-8 code points
/// receivable by [`SoftwareKeyboard::get_string()`].
/// receivable by [`SoftwareKeyboard::launch()`].
///
/// # Example
///
Expand Down

0 comments on commit cb67d92

Please sign in to comment.