|
|
@ -541,15 +541,18 @@ impl SoftwareKeyboard { |
|
|
|
/// # }
|
|
|
|
/// # }
|
|
|
|
#[doc(alias = "swkbdSetButton")] |
|
|
|
#[doc(alias = "swkbdSetButton")] |
|
|
|
pub fn configure_button(&mut self, button: Button, text: &str, submit: bool) { |
|
|
|
pub fn configure_button(&mut self, button: Button, text: &str, submit: bool) { |
|
|
|
unsafe { |
|
|
|
let button_text = &mut self.state.button_text[button as usize]; |
|
|
|
let nul_terminated: String = text.chars().chain(once('\0')).collect(); |
|
|
|
|
|
|
|
ctru_sys::swkbdSetButton( |
|
|
|
for (idx, code_unit) in text |
|
|
|
self.state.as_mut(), |
|
|
|
.encode_utf16() |
|
|
|
button.into(), |
|
|
|
.take(ctru_sys::SWKBD_MAX_BUTTON_TEXT_LEN as _) |
|
|
|
nul_terminated.as_ptr(), |
|
|
|
.chain(once(0)) |
|
|
|
submit, |
|
|
|
.enumerate() |
|
|
|
); |
|
|
|
{ |
|
|
|
|
|
|
|
button_text[idx] = code_unit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.state.button_submits_text[button as usize] = submit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Configure the maximum number of UTF-16 code units that can be entered into the software
|
|
|
|
/// Configure the maximum number of UTF-16 code units that can be entered into the software
|
|
|
|