cwiid 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config.rb +1 -1
- data/ext/wiimote.cc +56 -9
- data/ext/wiimote.hh +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2401496e2027e16a16eb64bb2fae7af4618d97e5
|
4
|
+
data.tar.gz: 63fd28dccc17c238ee0cfc434d1ab21d9116f4f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d4b8f54f2d96299017dbeaab87036f46861a674caf395987ea36dff5ef2eca85bb68f9eeafe55e9113c8373d18fb219ad62b7b9e4a08c40516ec8297147026d
|
7
|
+
data.tar.gz: b5f41ef2fd859cea46a56fbabe6d57f23e72b1d8487949daea082ac5ca6cec40df9b3a559f7187bc13305e9228698fa39ad34aad6d87f7f7f6024751e71b0921
|
data/config.rb
CHANGED
data/ext/wiimote.cc
CHANGED
@@ -127,11 +127,27 @@ unsigned short int WiiMote::getButtons(void)
|
|
127
127
|
return m_state.buttons;
|
128
128
|
}
|
129
129
|
|
130
|
+
unsigned short int WiiMote::getNunchukButtons(void)
|
131
|
+
{
|
132
|
+
return m_state.ext.nunchuk.buttons;
|
133
|
+
}
|
134
|
+
|
130
135
|
unsigned char WiiMote::getAcc( int id )
|
131
136
|
{
|
132
137
|
return m_state.acc[ id ];
|
133
138
|
}
|
134
139
|
|
140
|
+
unsigned char WiiMote::getNunchukAcc( int id )
|
141
|
+
{
|
142
|
+
return m_state.ext.nunchuk.acc[ id ];
|
143
|
+
}
|
144
|
+
|
145
|
+
unsigned char WiiMote::getNunchukJoyStick( int id )
|
146
|
+
{
|
147
|
+
return m_state.ext.nunchuk.stick[ id ];
|
148
|
+
}
|
149
|
+
|
150
|
+
|
135
151
|
bool WiiMote::irValid( int i )
|
136
152
|
{
|
137
153
|
return m_state.ir_src[ i ].valid != 0;
|
@@ -180,6 +196,8 @@ VALUE WiiMote::registerRubyClass(void)
|
|
180
196
|
rb_define_const( cRubyClass, "BTN_1", INT2NUM( CWIID_BTN_1 ) );
|
181
197
|
rb_define_const( cRubyClass, "BTN_B", INT2NUM( CWIID_BTN_B ) );
|
182
198
|
rb_define_const( cRubyClass, "BTN_A", INT2NUM( CWIID_BTN_A ) );
|
199
|
+
rb_define_const( cRubyClass, "NUNCHUK_BTN_C", INT2NUM( CWIID_NUNCHUK_BTN_C ) );
|
200
|
+
rb_define_const( cRubyClass, "NUNCHUK_BTN_Z", INT2NUM( CWIID_NUNCHUK_BTN_Z ) );
|
183
201
|
rb_define_const( cRubyClass, "BTN_MINUS", INT2NUM( CWIID_BTN_MINUS ) );
|
184
202
|
rb_define_const( cRubyClass, "BTN_HOME", INT2NUM( CWIID_BTN_HOME ) );
|
185
203
|
rb_define_const( cRubyClass, "BTN_LEFT", INT2NUM( CWIID_BTN_LEFT ) );
|
@@ -216,8 +234,14 @@ VALUE WiiMote::registerRubyClass(void)
|
|
216
234
|
RUBY_METHOD_FUNC( wrapSetRumble ), 1 );
|
217
235
|
rb_define_method( cRubyClass, "buttons",
|
218
236
|
RUBY_METHOD_FUNC( wrapGetButtons ), 0 );
|
237
|
+
rb_define_method( cRubyClass, "nunchuk_buttons",
|
238
|
+
RUBY_METHOD_FUNC( wrapGetNunchukButtons ), 0 );
|
219
239
|
rb_define_method( cRubyClass, "acc",
|
220
240
|
RUBY_METHOD_FUNC( wrapGetAcc ), 0 );
|
241
|
+
rb_define_method( cRubyClass, "nunchuk_acc",
|
242
|
+
RUBY_METHOD_FUNC( wrapGetNunchukAcc ), 0 );
|
243
|
+
rb_define_method( cRubyClass, "nunchuk_stick",
|
244
|
+
RUBY_METHOD_FUNC( wrapGetNunchukJoyStick ), 0 );
|
221
245
|
rb_define_method( cRubyClass, "ir",
|
222
246
|
RUBY_METHOD_FUNC( wrapGetIR ), 0 );
|
223
247
|
rb_define_method( cRubyClass, "motionplus",
|
@@ -289,19 +313,19 @@ VALUE WiiMote::wrapSetRptMode( VALUE rbSelf, VALUE rbMode )
|
|
289
313
|
rb_raise( rb_eRuntimeError, "%s", e.what() );
|
290
314
|
};
|
291
315
|
return rbMode;
|
292
|
-
}
|
316
|
+
}
|
293
317
|
|
294
318
|
VALUE WiiMote::wrapGetBattery( VALUE rbSelf )
|
295
319
|
{
|
296
320
|
WiiMotePtr *self; Data_Get_Struct( rbSelf, WiiMotePtr, self );
|
297
321
|
return INT2NUM( (*self)->getBattery() );
|
298
|
-
}
|
322
|
+
}
|
299
323
|
|
300
324
|
VALUE WiiMote::wrapGetLED( VALUE rbSelf )
|
301
325
|
{
|
302
326
|
WiiMotePtr *self; Data_Get_Struct( rbSelf, WiiMotePtr, self );
|
303
327
|
return INT2NUM( (*self)->getLED() );
|
304
|
-
}
|
328
|
+
}
|
305
329
|
|
306
330
|
VALUE WiiMote::wrapSetLED( VALUE rbSelf, VALUE rbState )
|
307
331
|
{
|
@@ -312,13 +336,13 @@ VALUE WiiMote::wrapSetLED( VALUE rbSelf, VALUE rbState )
|
|
312
336
|
rb_raise( rb_eRuntimeError, "%s", e.what() );
|
313
337
|
};
|
314
338
|
return rbState;
|
315
|
-
}
|
339
|
+
}
|
316
340
|
|
317
341
|
VALUE WiiMote::wrapGetRumble( VALUE rbSelf )
|
318
342
|
{
|
319
343
|
WiiMotePtr *self; Data_Get_Struct( rbSelf, WiiMotePtr, self );
|
320
344
|
return (*self)->getRumble() ? Qtrue : Qfalse;
|
321
|
-
}
|
345
|
+
}
|
322
346
|
|
323
347
|
VALUE WiiMote::wrapSetRumble( VALUE rbSelf, VALUE rbState )
|
324
348
|
{
|
@@ -329,13 +353,15 @@ VALUE WiiMote::wrapSetRumble( VALUE rbSelf, VALUE rbState )
|
|
329
353
|
rb_raise( rb_eRuntimeError, "%s", e.what() );
|
330
354
|
};
|
331
355
|
return rbState;
|
332
|
-
}
|
356
|
+
}
|
333
357
|
|
334
358
|
VALUE WiiMote::wrapGetButtons( VALUE rbSelf )
|
335
359
|
{
|
336
360
|
WiiMotePtr *self; Data_Get_Struct( rbSelf, WiiMotePtr, self );
|
337
361
|
return INT2NUM( (*self)->getButtons() );
|
338
|
-
}
|
362
|
+
}
|
363
|
+
|
364
|
+
|
339
365
|
|
340
366
|
VALUE WiiMote::wrapGetAcc( VALUE rbSelf )
|
341
367
|
{
|
@@ -343,7 +369,7 @@ VALUE WiiMote::wrapGetAcc( VALUE rbSelf )
|
|
343
369
|
return rb_ary_new3( 3, INT2NUM( (*self)->getAcc( 0 ) ),
|
344
370
|
INT2NUM( (*self)->getAcc( 1 ) ),
|
345
371
|
INT2NUM( (*self)->getAcc( 2 ) ) );
|
346
|
-
}
|
372
|
+
}
|
347
373
|
|
348
374
|
VALUE WiiMote::wrapGetIR( VALUE rbSelf )
|
349
375
|
{
|
@@ -364,5 +390,26 @@ VALUE WiiMote::wrapGetMotionPlus( VALUE rbSelf )
|
|
364
390
|
return rb_ary_new3( 3, INT2NUM( (*self)->getMotionPlus( 0 ) ),
|
365
391
|
INT2NUM( (*self)->getMotionPlus( 1 ) ),
|
366
392
|
INT2NUM( (*self)->getMotionPlus( 2 ) ) );
|
367
|
-
}
|
393
|
+
}
|
394
|
+
|
395
|
+
VALUE WiiMote::wrapGetNunchukAcc( VALUE rbSelf )
|
396
|
+
{
|
397
|
+
WiiMotePtr *self; Data_Get_Struct( rbSelf, WiiMotePtr, self );
|
398
|
+
return rb_ary_new3( 3, INT2NUM( (*self)->getNunchukAcc( 0 ) ),
|
399
|
+
INT2NUM( (*self)->getNunchukAcc( 1 ) ),
|
400
|
+
INT2NUM( (*self)->getNunchukAcc( 2 ) ) );
|
401
|
+
}
|
402
|
+
|
403
|
+
VALUE WiiMote::wrapGetNunchukJoyStick( VALUE rbSelf )
|
404
|
+
{
|
405
|
+
WiiMotePtr *self; Data_Get_Struct( rbSelf, WiiMotePtr, self );
|
406
|
+
return rb_ary_new3( 2, INT2NUM( (*self)->getNunchukJoyStick( 0 ) ),
|
407
|
+
INT2NUM( (*self)->getNunchukJoyStick( 1 ) ));
|
408
|
+
}
|
409
|
+
|
410
|
+
VALUE WiiMote::wrapGetNunchukButtons( VALUE rbSelf )
|
411
|
+
{
|
412
|
+
WiiMotePtr *self; Data_Get_Struct( rbSelf, WiiMotePtr, self );
|
413
|
+
return INT2NUM( (*self)->getNunchukButtons() );
|
414
|
+
}
|
368
415
|
|
data/ext/wiimote.hh
CHANGED
@@ -37,7 +37,10 @@ public:
|
|
37
37
|
bool getRumble(void);
|
38
38
|
void setRumble( bool state ) throw(Error);
|
39
39
|
unsigned short int getButtons(void);
|
40
|
+
unsigned short int getNunchukButtons(void);
|
40
41
|
unsigned char getAcc( int id );
|
42
|
+
unsigned char getNunchukAcc( int id );
|
43
|
+
unsigned char getNunchukJoyStick( int id );
|
41
44
|
bool irValid( int i );
|
42
45
|
unsigned short int getIRX( int i );
|
43
46
|
unsigned short int getIRY( int i );
|
@@ -60,6 +63,9 @@ public:
|
|
60
63
|
static VALUE wrapSetRumble( VALUE rbSelf, VALUE rbState );
|
61
64
|
static VALUE wrapGetButtons( VALUE rbSelf );
|
62
65
|
static VALUE wrapGetAcc( VALUE rbSelf );
|
66
|
+
static VALUE wrapGetNunchukButtons( VALUE rbSelf );
|
67
|
+
static VALUE wrapGetNunchukAcc( VALUE rbSelf );
|
68
|
+
static VALUE wrapGetNunchukJoyStick( VALUE rbSelf );
|
63
69
|
static VALUE wrapGetIR( VALUE rbSelf );
|
64
70
|
static VALUE wrapGetMotionPlus( VALUE rbSelf );
|
65
71
|
static WiiMote *current;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cwiid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Wedekind
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This Ruby extension provides an inerface to access a Wii Remote using
|
14
14
|
the libcwiid library.
|