Skip to content

feat: Text input system for DCSS webtiles protocol - #7

Open
willthehuman wants to merge 1 commit into
mainfrom
feature/text-input-system
Open

feat: Text input system for DCSS webtiles protocol#7
willthehuman wants to merge 1 commit into
mainfrom
feature/text-input-system

Conversation

@willthehuman

Copy link
Copy Markdown
Owner

Summary

  • Fixed protocol message: sendTextInput now sends {"msg": "input", "text": "..."} instead of the incorrect {"msg": "text_input", "text": "..."}, matching the DCSS webtiles specification for text input submission
  • Added keyboard type switching: Shows numeric keyboard with digits-only filter for number input type; standard keyboard for text and seed/seed-selection types
  • Repositioned overlay: Changed from a centered full-screen overlay to a bottom-aligned floating panel that sits above the software keyboard using MediaQuery.viewInsets.bottom, allowing partial game view visibility through a reduced-opacity backdrop

Context

The DCSS server sends init_input/close_input/update_input messages for free-text entry (character naming, chat, menu search, drop counts). The protocol parsing, game state management (TextInputState), and game screen wiring were already implemented. This PR fixes the outgoing message format and improves the overlay UX for mobile.

Test plan

  • Connect to a DCSS server and start a new game — verify the character naming prompt appears as a bottom-aligned panel
  • Enter a character name and submit — verify the name is accepted by the server
  • Press Cancel on the overlay — verify it sends ESC (keycode 27) and dismisses
  • Trigger a "drop how many?" prompt — verify numeric keyboard appears
  • Verify update_input from server updates the text field content
  • Verify the overlay positions correctly above the software keyboard on both iOS and Android

🤖 Generated with Claude Code

Fix the text input overlay to properly handle init_input/close_input/update_input
server messages for character naming, chat, search, and drop count prompts.

Changes:
- Fix sendTextInput to use correct protocol message (msg: "input" instead of
  msg: "text_input") matching the DCSS webtiles spec
- Add keyboard type switching: numeric keyboard for "number" input type with
  digits-only filter, standard keyboard for "text" and "seed" types
- Reposition overlay as a bottom-aligned floating panel that sits above the
  software keyboard using MediaQuery.viewInsets.bottom
- Reduce backdrop opacity for partial game view visibility

The protocol parsing (InitInputMessage, CloseInputMessage, UpdateInputMessage),
game state management (TextInputState), and game screen wiring were already in
place from the initial implementation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants