ruby-sdl2 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +5 -1
- data/joystick.c +34 -11
- data/joystick.c.m4 +339 -0
- data/key.c.m4 +33 -0
- data/lib/sdl2/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3117676fab3bf728061ced8e70ae5854d6b2ac9e
|
4
|
+
data.tar.gz: aa03377e9a9c236dee4e850b9e47a4f897e33672
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa5917cb8bf99824a3019735cb24fd984a5e2d0ac1846f8bbeb62b6c2f1cc6972b00c906478474dc92ae3e916bcf223d2314d1d5b204fe6558391d7835c38f44
|
7
|
+
data.tar.gz: 961679df11d15cc1e03055e3566480eb1a681227a54eadbb5a6bfce3a67d1cb8b21ce24923ddcd9a00aa8d30bb50cc16e6e0251aaf7846e4ba06bafdece517fd
|
data/.gitignore
CHANGED
data/README.md
CHANGED
data/joystick.c
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
/* -*- mode: C -*- */
|
1
2
|
#include "rubysdl2_internal.h"
|
2
3
|
#include <SDL_joystick.h>
|
3
4
|
#include <SDL_gamecontroller.h>
|
4
5
|
|
5
6
|
static VALUE cJoystick;
|
6
7
|
static VALUE cDeviceInfo;
|
8
|
+
static VALUE mHat;
|
7
9
|
|
8
10
|
typedef struct Joystick {
|
9
11
|
SDL_Joystick* joystick;
|
@@ -266,6 +268,16 @@ static VALUE Joystick_hat(VALUE self, VALUE which)
|
|
266
268
|
*
|
267
269
|
* You can get the information with {SDL2::Joystick.devices}.
|
268
270
|
*/
|
271
|
+
|
272
|
+
/*
|
273
|
+
* Document-module: SDL2::Joystick::Hat
|
274
|
+
*
|
275
|
+
* This module provides constants of joysticks's hat positions used by {SDL2::Joystick} class.
|
276
|
+
* The position of the hat is represented by OR'd bits of {RIGHT}, {LEFT}, {UP}, and {DOWN}.
|
277
|
+
* This means the center position ({CENTERED}) is represeted by 0 and
|
278
|
+
* the left up position {LEFTUP} is represeted by ({LEFT}|{UP}).
|
279
|
+
*/
|
280
|
+
|
269
281
|
void rubysdl2_init_joystick(void)
|
270
282
|
{
|
271
283
|
cJoystick = rb_define_class_under(mSDL2, "Joystick", rb_cObject);
|
@@ -293,17 +305,28 @@ void rubysdl2_init_joystick(void)
|
|
293
305
|
rb_define_method(cJoystick, "ball", Joystick_ball, 1);
|
294
306
|
rb_define_method(cJoystick, "button", Joystick_button, 1);
|
295
307
|
rb_define_method(cJoystick, "hat", Joystick_hat, 1);
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
308
|
+
|
309
|
+
mHat = rb_define_module_under(cJoystick, "Hat");
|
310
|
+
|
311
|
+
/* */
|
312
|
+
/* Center position. Equal to 0. */
|
313
|
+
rb_define_const(mHat, "CENTERED", INT2NUM(SDL_HAT_CENTERED));
|
314
|
+
/* Up position. */
|
315
|
+
rb_define_const(mHat, "UP", INT2NUM(SDL_HAT_UP));
|
316
|
+
/* Right position. */
|
317
|
+
rb_define_const(mHat, "RIGHT", INT2NUM(SDL_HAT_RIGHT));
|
318
|
+
/* Down position. */
|
319
|
+
rb_define_const(mHat, "DOWN", INT2NUM(SDL_HAT_DOWN));
|
320
|
+
/* Left position. */
|
321
|
+
rb_define_const(mHat, "LEFT", INT2NUM(SDL_HAT_LEFT));
|
322
|
+
/* Right Up position. Equal to ({RIGHT} | {UP}) */
|
323
|
+
rb_define_const(mHat, "RIGHTUP", INT2NUM(SDL_HAT_RIGHTUP));
|
324
|
+
/* Right Down position. Equal to ({RIGHT} | {DOWN}) */
|
325
|
+
rb_define_const(mHat, "RIGHTDOWN", INT2NUM(SDL_HAT_RIGHTDOWN));
|
326
|
+
/* Left Up position. Equal to ({LEFT} | {UP}) */
|
327
|
+
rb_define_const(mHat, "LEFTUP", INT2NUM(SDL_HAT_LEFTUP));
|
328
|
+
/* Left Down position. Equal to ({LEFT} | {DOWN}) */
|
329
|
+
rb_define_const(mHat, "LEFTDOWN", INT2NUM(SDL_HAT_LEFTDOWN));
|
307
330
|
|
308
331
|
/* Device GUID
|
309
332
|
* @return [String] */
|
data/joystick.c.m4
ADDED
@@ -0,0 +1,339 @@
|
|
1
|
+
/* -*- mode: C -*- */
|
2
|
+
#include "rubysdl2_internal.h"
|
3
|
+
#include <SDL_joystick.h>
|
4
|
+
#include <SDL_gamecontroller.h>
|
5
|
+
|
6
|
+
static VALUE cJoystick;
|
7
|
+
static VALUE cDeviceInfo;
|
8
|
+
static VALUE mHat;
|
9
|
+
|
10
|
+
typedef struct Joystick {
|
11
|
+
SDL_Joystick* joystick;
|
12
|
+
} Joystick;
|
13
|
+
|
14
|
+
static void Joystick_free(Joystick* j)
|
15
|
+
{
|
16
|
+
if (rubysdl2_is_active() && j->joystick)
|
17
|
+
SDL_JoystickClose(j->joystick);
|
18
|
+
free(j);
|
19
|
+
}
|
20
|
+
|
21
|
+
static VALUE Joystick_new(SDL_Joystick* joystick)
|
22
|
+
{
|
23
|
+
Joystick* j = ALLOC(Joystick);
|
24
|
+
j->joystick = joystick;
|
25
|
+
return Data_Wrap_Struct(cJoystick, 0, Joystick_free, j);
|
26
|
+
}
|
27
|
+
|
28
|
+
DEFINE_WRAPPER(SDL_Joystick, Joystick, joystick, cJoystick, "SDL2::Joystick");
|
29
|
+
|
30
|
+
/*
|
31
|
+
* Document-class: SDL2::Joystick
|
32
|
+
*
|
33
|
+
* This class represents a joystick connected to the machine.
|
34
|
+
*
|
35
|
+
* In order to use joystick subsystem, {SDL2.init} must have been called
|
36
|
+
* with the SDL2::INIT_JOYSTICK flag.
|
37
|
+
*
|
38
|
+
* @!method destroy?
|
39
|
+
* Return true if the device is alread closed.
|
40
|
+
* @see #destroy
|
41
|
+
*/
|
42
|
+
|
43
|
+
/*
|
44
|
+
* Get the number of connected joysticks.
|
45
|
+
*
|
46
|
+
* @return [Integer]
|
47
|
+
*/
|
48
|
+
static VALUE Joystick_s_num_connected_joysticks(VALUE self)
|
49
|
+
{
|
50
|
+
return INT2FIX(HANDLE_ERROR(SDL_NumJoysticks()));
|
51
|
+
}
|
52
|
+
|
53
|
+
static VALUE GUID_to_String(SDL_JoystickGUID guid)
|
54
|
+
{
|
55
|
+
char buf[128];
|
56
|
+
SDL_JoystickGetGUIDString(guid, buf, sizeof(buf));
|
57
|
+
return rb_usascii_str_new_cstr(buf);
|
58
|
+
}
|
59
|
+
|
60
|
+
/*
|
61
|
+
* Get the information of connected joysticks
|
62
|
+
*
|
63
|
+
* @return [Array<SDL2::Joystick::DeviceInfo>] information of connected devices
|
64
|
+
*/
|
65
|
+
static VALUE Joystick_s_devices(VALUE self)
|
66
|
+
{
|
67
|
+
int num_joysticks = SDL_NumJoysticks();
|
68
|
+
int i;
|
69
|
+
VALUE devices = rb_ary_new2(num_joysticks);
|
70
|
+
for (i=0; i<num_joysticks; ++i) {
|
71
|
+
VALUE device = rb_obj_alloc(cDeviceInfo);
|
72
|
+
rb_iv_set(device, "@GUID", GUID_to_String(SDL_JoystickGetDeviceGUID(i)));
|
73
|
+
rb_iv_set(device, "@name", utf8str_new_cstr(SDL_JoystickNameForIndex(i)));
|
74
|
+
rb_ary_push(devices, device);
|
75
|
+
}
|
76
|
+
return devices;
|
77
|
+
}
|
78
|
+
|
79
|
+
/*
|
80
|
+
* @overload open(device_index)
|
81
|
+
* Open a joystick for use.
|
82
|
+
*
|
83
|
+
* @param [Integer] device_index device index
|
84
|
+
* @return [SDL2::Joystick] opended joystick object
|
85
|
+
* @raise [SDL2::Error] raised when device open is failed.
|
86
|
+
* for exmaple, device_index is out of range.
|
87
|
+
*/
|
88
|
+
static VALUE Joystick_s_open(VALUE self, VALUE device_index)
|
89
|
+
{
|
90
|
+
SDL_Joystick* joystick = SDL_JoystickOpen(NUM2INT(device_index));
|
91
|
+
if (!joystick)
|
92
|
+
SDL_ERROR();
|
93
|
+
return Joystick_new(joystick);
|
94
|
+
}
|
95
|
+
|
96
|
+
/*
|
97
|
+
* @overload game_controller?(index)
|
98
|
+
* Return true if the joystick of given index supports the game controller
|
99
|
+
* interface.
|
100
|
+
*
|
101
|
+
* @param [Integer] index the joystick device index
|
102
|
+
* @see SDL2::GameController
|
103
|
+
*
|
104
|
+
*/
|
105
|
+
static VALUE Joystick_s_game_controller_p(VALUE self, VALUE index)
|
106
|
+
{
|
107
|
+
return INT2BOOL(SDL_IsGameController(NUM2INT(index)));
|
108
|
+
}
|
109
|
+
|
110
|
+
/*
|
111
|
+
* Return true a joystick has been opened and currently connected.
|
112
|
+
*/
|
113
|
+
static VALUE Joystick_attached_p(VALUE self)
|
114
|
+
{
|
115
|
+
Joystick* j = Get_Joystick(self);
|
116
|
+
if (!j->joystick)
|
117
|
+
return Qfalse;
|
118
|
+
return INT2BOOL(SDL_JoystickGetAttached(j->joystick));
|
119
|
+
}
|
120
|
+
|
121
|
+
/*
|
122
|
+
* Get the joystick GUID
|
123
|
+
*
|
124
|
+
* @return [String] GUID string
|
125
|
+
*/
|
126
|
+
static VALUE Joystick_GUID(VALUE self)
|
127
|
+
{
|
128
|
+
SDL_JoystickGUID guid;
|
129
|
+
char buf[128];
|
130
|
+
guid = SDL_JoystickGetGUID(Get_SDL_Joystick(self));
|
131
|
+
SDL_JoystickGetGUIDString(guid, buf, sizeof(buf));
|
132
|
+
return rb_usascii_str_new_cstr(buf);
|
133
|
+
}
|
134
|
+
|
135
|
+
/*
|
136
|
+
* Get the index of a joystick
|
137
|
+
*
|
138
|
+
* @return [Integer] index
|
139
|
+
*/
|
140
|
+
static VALUE Joystick_index(VALUE self)
|
141
|
+
{
|
142
|
+
return INT2NUM(HANDLE_ERROR(SDL_JoystickInstanceID(Get_SDL_Joystick(self))));
|
143
|
+
}
|
144
|
+
|
145
|
+
/*
|
146
|
+
* Close a joystick device.
|
147
|
+
*
|
148
|
+
* @return [nil]
|
149
|
+
* @see #destroy?
|
150
|
+
*/
|
151
|
+
static VALUE Joystick_destroy(VALUE self)
|
152
|
+
{
|
153
|
+
Joystick* j = Get_Joystick(self);
|
154
|
+
if (j->joystick)
|
155
|
+
SDL_JoystickClose(j->joystick);
|
156
|
+
j->joystick = NULL;
|
157
|
+
return Qnil;
|
158
|
+
}
|
159
|
+
|
160
|
+
/*
|
161
|
+
* Get the name of a joystick
|
162
|
+
*
|
163
|
+
* @return [String] name
|
164
|
+
*/
|
165
|
+
static VALUE Joystick_name(VALUE self)
|
166
|
+
{
|
167
|
+
return utf8str_new_cstr(SDL_JoystickName(Get_SDL_Joystick(self)));
|
168
|
+
}
|
169
|
+
|
170
|
+
/*
|
171
|
+
* Get the number of general axis controls on a joystick.
|
172
|
+
* @return [Integer]
|
173
|
+
* @see #axis
|
174
|
+
*/
|
175
|
+
static VALUE Joystick_num_axes(VALUE self)
|
176
|
+
{
|
177
|
+
return INT2FIX(SDL_JoystickNumAxes(Get_SDL_Joystick(self)));
|
178
|
+
}
|
179
|
+
|
180
|
+
/*
|
181
|
+
* Get the number of trackball on a joystick
|
182
|
+
* @return [Integer]
|
183
|
+
* @see #ball
|
184
|
+
*/
|
185
|
+
static VALUE Joystick_num_balls(VALUE self)
|
186
|
+
{
|
187
|
+
return INT2FIX(SDL_JoystickNumBalls(Get_SDL_Joystick(self)));
|
188
|
+
}
|
189
|
+
|
190
|
+
/*
|
191
|
+
* Get the number of button on a joystick
|
192
|
+
* @return [Integer]
|
193
|
+
* @see #button
|
194
|
+
*/
|
195
|
+
static VALUE Joystick_num_buttons(VALUE self)
|
196
|
+
{
|
197
|
+
return INT2FIX(SDL_JoystickNumButtons(Get_SDL_Joystick(self)));
|
198
|
+
}
|
199
|
+
|
200
|
+
/*
|
201
|
+
* Get the number of POV hats on a joystick
|
202
|
+
* @return [Integer]
|
203
|
+
* @see #hat
|
204
|
+
*/
|
205
|
+
static VALUE Joystick_num_hats(VALUE self)
|
206
|
+
{
|
207
|
+
return INT2FIX(SDL_JoystickNumHats(Get_SDL_Joystick(self)));
|
208
|
+
}
|
209
|
+
|
210
|
+
/*
|
211
|
+
* @overload axis(which)
|
212
|
+
* Get the current state of an axis control on a joystick.
|
213
|
+
*
|
214
|
+
* @param [Integer] which an index of an axis, started at index 0
|
215
|
+
* @return [Integer] state value, ranging from -32768 to 32767.
|
216
|
+
* @see #num_axes
|
217
|
+
*/
|
218
|
+
static VALUE Joystick_axis(VALUE self, VALUE which)
|
219
|
+
{
|
220
|
+
return INT2FIX(SDL_JoystickGetAxis(Get_SDL_Joystick(self), NUM2INT(which)));
|
221
|
+
}
|
222
|
+
|
223
|
+
/*
|
224
|
+
* @overload ball(which)
|
225
|
+
* Get the current state of a trackball on a joystick.
|
226
|
+
*
|
227
|
+
* @param [Integer] which an index of a trackball, started at index 0
|
228
|
+
* @return [[Integer,Integer]] dx and dy
|
229
|
+
* @see #num_balls
|
230
|
+
*/
|
231
|
+
static VALUE Joystick_ball(VALUE self, VALUE which)
|
232
|
+
{
|
233
|
+
int dx, dy;
|
234
|
+
HANDLE_ERROR(SDL_JoystickGetBall(Get_SDL_Joystick(self), NUM2INT(which), &dx, &dy));
|
235
|
+
return rb_ary_new3(2, INT2NUM(dx), INT2NUM(dy));
|
236
|
+
}
|
237
|
+
|
238
|
+
/*
|
239
|
+
* @overload button(which)
|
240
|
+
* Get the current state of a button on a joystick.
|
241
|
+
*
|
242
|
+
* @param [Integer] which an index of a button, started at index 0
|
243
|
+
* @return [Boolean] true if the button is pressed
|
244
|
+
* @see #num_buttons
|
245
|
+
*/
|
246
|
+
static VALUE Joystick_button(VALUE self, VALUE which)
|
247
|
+
{
|
248
|
+
return INT2BOOL(SDL_JoystickGetButton(Get_SDL_Joystick(self), NUM2INT(which)));
|
249
|
+
}
|
250
|
+
|
251
|
+
/*
|
252
|
+
* @overload hat(which)
|
253
|
+
* Get the current state of a POV hat on a joystick.
|
254
|
+
*
|
255
|
+
* @param [Integer] which an index of a hat, started at index 0
|
256
|
+
* @return [Integer] hat state
|
257
|
+
* @see #num_hats
|
258
|
+
*/
|
259
|
+
static VALUE Joystick_hat(VALUE self, VALUE which)
|
260
|
+
{
|
261
|
+
return UINT2NUM(SDL_JoystickGetHat(Get_SDL_Joystick(self), NUM2INT(which)));
|
262
|
+
}
|
263
|
+
|
264
|
+
/*
|
265
|
+
* Document-class: SDL2::Joystick::DeviceInfo
|
266
|
+
*
|
267
|
+
* This class represents joystick device information, its name and GUID.
|
268
|
+
*
|
269
|
+
* You can get the information with {SDL2::Joystick.devices}.
|
270
|
+
*/
|
271
|
+
|
272
|
+
/*
|
273
|
+
* Document-module: SDL2::Joystick::Hat
|
274
|
+
*
|
275
|
+
* This module provides constants of joysticks's hat positions used by {SDL2::Joystick} class.
|
276
|
+
* The position of the hat is represented by OR'd bits of {RIGHT}, {LEFT}, {UP}, and {DOWN}.
|
277
|
+
* This means the center position ({CENTERED}) is represeted by 0 and
|
278
|
+
* the left up position {LEFTUP} is represeted by ({LEFT}|{UP}).
|
279
|
+
*/
|
280
|
+
|
281
|
+
void rubysdl2_init_joystick(void)
|
282
|
+
{
|
283
|
+
cJoystick = rb_define_class_under(mSDL2, "Joystick", rb_cObject);
|
284
|
+
cDeviceInfo = rb_define_class_under(cJoystick, "DeviceInfo", rb_cObject);
|
285
|
+
|
286
|
+
rb_define_singleton_method(cJoystick, "num_connected_joysticks",
|
287
|
+
Joystick_s_num_connected_joysticks, 0);
|
288
|
+
rb_define_singleton_method(cJoystick, "devices", Joystick_s_devices, 0);
|
289
|
+
rb_define_singleton_method(cJoystick, "open", Joystick_s_open, 1);
|
290
|
+
rb_define_singleton_method(cJoystick, "game_controller?",
|
291
|
+
Joystick_s_game_controller_p, 1);
|
292
|
+
rb_define_method(cJoystick, "destroy?", Joystick_destroy_p, 0);
|
293
|
+
rb_define_alias(cJoystick, "close?", "destroy?");
|
294
|
+
rb_define_method(cJoystick, "attached?", Joystick_attached_p, 0);
|
295
|
+
rb_define_method(cJoystick, "GUID", Joystick_GUID, 0);
|
296
|
+
rb_define_method(cJoystick, "index", Joystick_index, 0);
|
297
|
+
rb_define_method(cJoystick, "destroy", Joystick_destroy, 0);
|
298
|
+
rb_define_alias(cJoystick, "close", "destroy");
|
299
|
+
rb_define_method(cJoystick, "name", Joystick_name, 0);
|
300
|
+
rb_define_method(cJoystick, "num_axes", Joystick_num_axes, 0);
|
301
|
+
rb_define_method(cJoystick, "num_balls", Joystick_num_balls, 0);
|
302
|
+
rb_define_method(cJoystick, "num_buttons", Joystick_num_buttons, 0);
|
303
|
+
rb_define_method(cJoystick, "num_hats", Joystick_num_hats, 0);
|
304
|
+
rb_define_method(cJoystick, "axis", Joystick_axis, 1);
|
305
|
+
rb_define_method(cJoystick, "ball", Joystick_ball, 1);
|
306
|
+
rb_define_method(cJoystick, "button", Joystick_button, 1);
|
307
|
+
rb_define_method(cJoystick, "hat", Joystick_hat, 1);
|
308
|
+
|
309
|
+
mHat = rb_define_module_under(cJoystick, "Hat");
|
310
|
+
|
311
|
+
/* define(`DEFINE_JOY_HAT_CONST',`rb_define_const(mHat, "$1", INT2NUM(SDL_HAT_$1))') */
|
312
|
+
/* Center position. Equal to 0. */
|
313
|
+
DEFINE_JOY_HAT_CONST(CENTERED);
|
314
|
+
/* Up position. */
|
315
|
+
DEFINE_JOY_HAT_CONST(UP);
|
316
|
+
/* Right position. */
|
317
|
+
DEFINE_JOY_HAT_CONST(RIGHT);
|
318
|
+
/* Down position. */
|
319
|
+
DEFINE_JOY_HAT_CONST(DOWN);
|
320
|
+
/* Left position. */
|
321
|
+
DEFINE_JOY_HAT_CONST(LEFT);
|
322
|
+
/* Right Up position. Equal to ({RIGHT} | {UP}) */
|
323
|
+
DEFINE_JOY_HAT_CONST(RIGHTUP);
|
324
|
+
/* Right Down position. Equal to ({RIGHT} | {DOWN}) */
|
325
|
+
DEFINE_JOY_HAT_CONST(RIGHTDOWN);
|
326
|
+
/* Left Up position. Equal to ({LEFT} | {UP}) */
|
327
|
+
DEFINE_JOY_HAT_CONST(LEFTUP);
|
328
|
+
/* Left Down position. Equal to ({LEFT} | {DOWN}) */
|
329
|
+
DEFINE_JOY_HAT_CONST(LEFTDOWN);
|
330
|
+
|
331
|
+
/* Device GUID
|
332
|
+
* @return [String] */
|
333
|
+
rb_define_attr(cDeviceInfo, "GUID", 1, 0);
|
334
|
+
/* Device name
|
335
|
+
* @return [String] */
|
336
|
+
rb_define_attr(cDeviceInfo, "name", 1, 0);
|
337
|
+
|
338
|
+
|
339
|
+
}
|
data/key.c.m4
CHANGED
@@ -173,22 +173,55 @@ static VALUE Mod_s_set_state(VALUE self, VALUE keymod)
|
|
173
173
|
*
|
174
174
|
* This module provides Unicode text input support.
|
175
175
|
*
|
176
|
+
* Normally, you can handle key inputs from key events
|
177
|
+
* and {SDL2::Key} module. This module is required to
|
178
|
+
* input thousands kinds of symbols like CJK languages.
|
179
|
+
* Please see {https://wiki.libsdl.org/Tutorials/TextInput}
|
180
|
+
* to understand the concept of Unicode text input.
|
181
|
+
*/
|
182
|
+
|
183
|
+
/*
|
184
|
+
* Return true if Unicode text input events are enabled.
|
185
|
+
*
|
186
|
+
* @see .start
|
187
|
+
* @see .stop
|
176
188
|
*/
|
177
189
|
static VALUE TextInput_s_active_p(VALUE self)
|
178
190
|
{
|
179
191
|
return INT2BOOL(SDL_IsTextInputActive());
|
180
192
|
}
|
181
193
|
|
194
|
+
/*
|
195
|
+
* Enable Unicode input events.
|
196
|
+
*
|
197
|
+
* @return [nil]
|
198
|
+
* @see .stop
|
199
|
+
* @see .active?
|
200
|
+
*/
|
182
201
|
static VALUE TextInput_s_start(VALUE self)
|
183
202
|
{
|
184
203
|
SDL_StartTextInput(); return Qnil;
|
185
204
|
}
|
186
205
|
|
206
|
+
/*
|
207
|
+
* Disable Unicode input events.
|
208
|
+
*
|
209
|
+
* @return [nil]
|
210
|
+
* @see .start
|
211
|
+
* @see .active?
|
212
|
+
*/
|
187
213
|
static VALUE TextInput_s_stop(VALUE self)
|
188
214
|
{
|
189
215
|
SDL_StopTextInput(); return Qnil;
|
190
216
|
}
|
191
217
|
|
218
|
+
/*
|
219
|
+
* @overload rect=(rect)
|
220
|
+
* Set the rectanlgle used to type Unicode text inputs.
|
221
|
+
*
|
222
|
+
* @param rect [SDL2::Rect] the rectangle to receive text
|
223
|
+
* @return [rect]
|
224
|
+
*/
|
192
225
|
static VALUE TextInput_s_set_rect(VALUE self, VALUE rect)
|
193
226
|
{
|
194
227
|
SDL_Rect *r = Get_SDL_Rect(rect);
|
data/lib/sdl2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-sdl2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ippei Obayashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Ruby/SDL2 is an extension library to use SDL 2.x
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- gl.c.m4
|
41
41
|
- hint.c
|
42
42
|
- joystick.c
|
43
|
+
- joystick.c.m4
|
43
44
|
- key.c
|
44
45
|
- key.c.m4
|
45
46
|
- lib/sdl2.rb
|