Module: SDL2::TextInput

Defined in:
key.c,
key.c

Overview

This module provides Unicode text input support.

Normally, you can handle key inputs from key events and Key module. This module is required to input thousands kinds of symbols like CJK languages. Please see https://wiki.libsdl.org/Tutorials/TextInput to understand the concept of Unicode text input.

Class Method Summary collapse

Class Method Details

.active?Boolean

Return true if Unicode text input events are enabled.

Returns:

  • (Boolean)

See Also:



191
192
193
194
# File 'key.c', line 191

static VALUE TextInput_s_active_p(VALUE self)
{
    return INT2BOOL(SDL_IsTextInputActive());
}

.rect=(rect) ⇒ void

This method returns an undefined value.

Set the rectanlgle used to type Unicode text inputs.

Parameters:

  • rect (SDL2::Rect)

    the rectangle to receive text



227
228
229
230
231
232
# File 'key.c', line 227

static VALUE TextInput_s_set_rect(VALUE self, VALUE rect)
{
    SDL_Rect *r = Get_SDL_Rect(rect);
    SDL_SetTextInputRect(r);
    return rect;
}

.startnil

Enable Unicode input events.

Returns:

  • (nil)

See Also:



203
204
205
206
# File 'key.c', line 203

static VALUE TextInput_s_start(VALUE self)
{
    SDL_StartTextInput(); return Qnil;
}

.stopnil

Disable Unicode input events.

Returns:

  • (nil)

See Also:



215
216
217
218
# File 'key.c', line 215

static VALUE TextInput_s_stop(VALUE self)
{
    SDL_StopTextInput(); return Qnil;
}