Skip to content

offalynne/input-string

Repository files navigation

input-string

Multiplatform GMS2 text entry utility
Robust alternative to keyboard_string

Frontend Features
- Reliable getters and setters
- Callback for text submission
- Easier async dialog handling
- Realtime array search filter

Backend Features
- Safe handling at string length limit
- Filter errant keyboard control codes
- Normalized Backspace repeat behavior
- Prevent Android off-by-one text bugs
- Prevent dropping any user keystrokes
- Prevent input falling through dialog
- Maintained value for keyboard_string
- Steamworks virtual onscreen keyboard

Quick Start
1 input_string_callback_set(aFunction)
2 Once a frame, do input_string_tick()
3 Upon focus, input_string_set(oldVal)
4 Focused, newVal = input_string_get()

input_string_get()
  function: Get managed text
  returned: String

input_string_set([string])
  function: Set managed text
  argument: String (Optional)
  returned: None

input_string_callback_set([function])
  function: Set submission callback
  argument: Function (Optional)
  returned: None

input_string_search_set([array])
  function: Set search corpus
  argument: Array (Optional)
  returned: None

input_string_search_results()
  function: Get search results
  returned: Array of indexes

input_string_force_submit()
  function: Force submission callback
  returned: None

input_string_max_length_set(value)
  function: Set string limit
  argument: Value (Integer)
  returned: None

input_string_platform_hint()
  function: Get entry method hint
  returned: String (Hint)
  possible: keyboard, virtual, async

input_string_submit_get()
  function: Momentary return status
  returned: Boolean
  
input_string_keyboard_show([type])
  function: Show virtual keyboard
  argument: Keyboard type (Optional)
  returned: Undefined or Boolean
  
input_string_keyboard_hide()
  function: Hide virtual keyboard
  returned: None

input_string_tick()
  function: Update state
  in event: Begin Step (Optional)
  returned: None

input_string_async_active()
  function: Get dialog status
  returned: Boolean

input_string_async_get([caption])
  function: Issue dialog prompt
  requires: input_​string_​async_​event
  argument: Caption (String, Optional)
  returned: None

input_string_async_event()
  function: Manage dialog submission
  in event: Dialog Async (Optional)
  returned: None

For configuration options, see scripts

s/o @JujuAdams @tabularelf @nkrapivin
Community: discord.gg/8krYCqr

@offalynne, 2022
MIT licensed, use as you please

About

Crossplatform text input for GMS2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published