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:



189
190
191
192
# File 'key.c', line 189

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

.rect=(rect) ⇒ rect

Set the rectanlgle used to type Unicode text inputs.

Parameters:

  • rect (SDL2::Rect)

    the rectangle to receive text

Returns:

  • (rect)


225
226
227
228
229
230
# File 'key.c', line 225

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:



201
202
203
204
# File 'key.c', line 201

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

.stopnil

Disable Unicode input events.

Returns:

  • (nil)

See Also:



213
214
215
216
# File 'key.c', line 213

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