| 440 | } |
| 441 | |
| 442 | static void VirtualKeyboard_Open(struct OpenKeyboardArgs* args) { |
| 443 | VirtualKeyboard_Close(); |
| 444 | VirtualKeyboard_Init(); |
| 445 | DisplayInfo.ShowingSoftKeyboard = true; |
| 446 | |
| 447 | kb_needsHook = true; |
| 448 | kb_curX = -1; |
| 449 | kb_curY = 0; |
| 450 | kb_shift = false; |
| 451 | kb_yOffset = args->yOffset; |
| 452 | |
| 453 | int mode = args->type & 0xFF; |
| 454 | int num = mode == KEYBOARD_TYPE_INTEGER || mode == KEYBOARD_TYPE_NUMBER; |
| 455 | kb = num ? &numpad_layout : &normal_layout; |
| 456 | |
| 457 | kb_str.length = 0; |
| 458 | String_AppendString(&kb_str, args->text); |
| 459 | |
| 460 | if (Window_Main.Is3D) { |
| 461 | KB_MarkDirty = VirtualKeyboard_MarkDirty3D; |
| 462 | } else { |
| 463 | KB_MarkDirty = VirtualKeyboard_MarkDirty2D; |
| 464 | } |
| 465 | |
| 466 | Window_Main.SoftKeyboardFocus = true; |
| 467 | Input.DownHook = VirtualKeyboard_OnInputDown; |
| 468 | LBackend_Hooks[0] = VirtualKeyboard_Display2D; |
| 469 | Game.Draw2DHooks[0] = VirtualKeyboard_Display3D; |
| 470 | } |
| 471 | |
| 472 | static void VirtualKeyboard_SetText(const cc_string* text) { |
| 473 | if (!DisplayInfo.ShowingSoftKeyboard) return; |
no test coverage detected