TextInput instances are invisible objects that build a text string from input, using the current operating system‘s keyboard layout.

At its most basic form, you only need to create a new TextInput instance and pass it to your window via text_input=. Until you call this function again, passing nil, the TextInput object will build a text that can be accessed via TextInput#text.

A TextInput object is purely abstract, though; drawing the input field is left to the user. As with most of Gosu, how this is handled is completely left open.

TextInput only aims to provide enough code for your own GUIs to build upon.

Attributes

NameRead/write?
caret_pos R
selection_start R
text RW

Public Instance Methods


filter (text_in)

Overridable filter that is applied to all new text that is entered. Allows for context-sensitive filtering/extending/… of the text. The text will be inserted at caretPos afterwards.

# File reference/gosu.rb, line 350
    def filter text_in
      text_in
    end