reflexion 0.3.5 → 0.3.6
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/.doc/ext/reflex/application.cpp +16 -0
- data/.doc/ext/reflex/device.cpp +46 -3
- data/.doc/ext/reflex/device_event.cpp +62 -0
- data/.doc/ext/reflex/key_event.cpp +49 -19
- data/.doc/ext/reflex/native.cpp +6 -4
- data/.doc/ext/reflex/reflex.cpp +7 -6
- data/ChangeLog.md +8 -0
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +18 -0
- data/ext/reflex/device.cpp +48 -3
- data/ext/reflex/device_event.cpp +65 -0
- data/ext/reflex/key_event.cpp +49 -19
- data/ext/reflex/native.cpp +6 -4
- data/ext/reflex/reflex.cpp +7 -6
- data/include/reflex/application.h +4 -0
- data/include/reflex/defs.h +58 -21
- data/include/reflex/device.h +22 -0
- data/include/reflex/event.h +25 -0
- data/include/reflex/gamepad.h +175 -0
- data/include/reflex/ruby/application.h +18 -0
- data/include/reflex/ruby/device.h +40 -0
- data/include/reflex/ruby/event.h +11 -0
- data/reflex.gemspec +3 -3
- data/src/application.cpp +67 -0
- data/src/application.h +9 -0
- data/src/device.cpp +24 -0
- data/src/event.cpp +38 -0
- data/src/gamepad.cpp +176 -0
- data/src/gamepad.h +74 -0
- data/src/ios/app_delegate.mm +2 -2
- data/src/ios/application.mm +0 -25
- data/src/ios/event.h +0 -5
- data/src/ios/event.mm +1 -85
- data/src/ios/gamepad.mm +313 -0
- data/src/ios/reflex.mm +0 -5
- data/src/osx/app_delegate.mm +2 -2
- data/src/osx/application.mm +0 -25
- data/src/osx/event.h +1 -3
- data/src/osx/event.mm +9 -86
- data/src/osx/gamepad.mm +40 -0
- data/src/osx/gamepad_gc.mm +299 -0
- data/src/osx/gamepad_hid.mm +567 -0
- data/src/osx/reflex.mm +0 -5
- data/src/win32/application.cpp +5 -26
- data/src/win32/event.cpp +6 -89
- data/src/win32/event.h +3 -1
- data/src/win32/gamepad.cpp +110 -0
- data/src/win32/gamepad.h +20 -0
- data/src/win32/window.cpp +2 -1
- metadata +28 -14
@@ -53,6 +53,10 @@ namespace Reflex
|
|
53
53
|
|
54
54
|
virtual void on_quit (Event* e);
|
55
55
|
|
56
|
+
virtual void on_device_connect (DeviceEvent* e);
|
57
|
+
|
58
|
+
virtual void on_device_disconnect (DeviceEvent* e);
|
59
|
+
|
56
60
|
virtual void on_motion (MotionEvent* e);
|
57
61
|
|
58
62
|
virtual void on_preference (Event* e);
|
data/include/reflex/defs.h
CHANGED
@@ -278,27 +278,64 @@ namespace Reflex
|
|
278
278
|
#undef NATIVE_VK
|
279
279
|
|
280
280
|
KEY_GAMEPAD_LEFT = 0x100,
|
281
|
-
KEY_GAMEPAD_RIGHT
|
282
|
-
KEY_GAMEPAD_UP
|
283
|
-
KEY_GAMEPAD_DOWN
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
281
|
+
KEY_GAMEPAD_RIGHT,
|
282
|
+
KEY_GAMEPAD_UP,
|
283
|
+
KEY_GAMEPAD_DOWN,
|
284
|
+
|
285
|
+
KEY_GAMEPAD_LSTICK_LEFT,
|
286
|
+
KEY_GAMEPAD_LSTICK_RIGHT,
|
287
|
+
KEY_GAMEPAD_LSTICK_UP,
|
288
|
+
KEY_GAMEPAD_LSTICK_DOWN,
|
289
|
+
|
290
|
+
KEY_GAMEPAD_RSTICK_LEFT,
|
291
|
+
KEY_GAMEPAD_RSTICK_RIGHT,
|
292
|
+
KEY_GAMEPAD_RSTICK_UP,
|
293
|
+
KEY_GAMEPAD_RSTICK_DOWN,
|
294
|
+
|
295
|
+
KEY_GAMEPAD_A,
|
296
|
+
KEY_GAMEPAD_B,
|
297
|
+
KEY_GAMEPAD_X,
|
298
|
+
KEY_GAMEPAD_Y,
|
299
|
+
|
300
|
+
KEY_GAMEPAD_LSHOULDER,
|
301
|
+
KEY_GAMEPAD_RSHOULDER,
|
302
|
+
KEY_GAMEPAD_LTRIGGER,
|
303
|
+
KEY_GAMEPAD_RTRIGGER,
|
304
|
+
KEY_GAMEPAD_LTHUMB,
|
305
|
+
KEY_GAMEPAD_RTHUMB,
|
306
|
+
|
307
|
+
KEY_GAMEPAD_LPADDLE_0,
|
308
|
+
KEY_GAMEPAD_LPADDLE_1,
|
309
|
+
KEY_GAMEPAD_RPADDLE_0,
|
310
|
+
KEY_GAMEPAD_RPADDLE_1,
|
311
|
+
|
312
|
+
KEY_GAMEPAD_HOME,
|
313
|
+
KEY_GAMEPAD_MENU,
|
314
|
+
KEY_GAMEPAD_OPTION,
|
315
|
+
KEY_GAMEPAD_SHARE,
|
316
|
+
KEY_GAMEPAD_START,
|
317
|
+
KEY_GAMEPAD_SELECT,
|
318
|
+
|
319
|
+
KEY_GAMEPAD_BUTTON_TOUCH,
|
320
|
+
|
321
|
+
KEY_GAMEPAD_BUTTON_0,
|
322
|
+
KEY_GAMEPAD_BUTTON_1,
|
323
|
+
KEY_GAMEPAD_BUTTON_2,
|
324
|
+
KEY_GAMEPAD_BUTTON_3,
|
325
|
+
KEY_GAMEPAD_BUTTON_4,
|
326
|
+
KEY_GAMEPAD_BUTTON_5,
|
327
|
+
KEY_GAMEPAD_BUTTON_6,
|
328
|
+
KEY_GAMEPAD_BUTTON_7,
|
329
|
+
KEY_GAMEPAD_BUTTON_8,
|
330
|
+
KEY_GAMEPAD_BUTTON_9,
|
331
|
+
KEY_GAMEPAD_BUTTON_10,
|
332
|
+
KEY_GAMEPAD_BUTTON_11,
|
333
|
+
KEY_GAMEPAD_BUTTON_12,
|
334
|
+
KEY_GAMEPAD_BUTTON_13,
|
335
|
+
KEY_GAMEPAD_BUTTON_14,
|
336
|
+
KEY_GAMEPAD_BUTTON_15,
|
337
|
+
|
338
|
+
KEY_GAMEPAD_BUTTON_MAX
|
302
339
|
|
303
340
|
};// KeyCode
|
304
341
|
|
data/include/reflex/device.h
CHANGED
@@ -4,10 +4,32 @@
|
|
4
4
|
#define __REFLEX_DEVICE_H__
|
5
5
|
|
6
6
|
|
7
|
+
#include <xot/ref.h>
|
8
|
+
#include <reflex/defs.h>
|
9
|
+
|
10
|
+
|
7
11
|
namespace Reflex
|
8
12
|
{
|
9
13
|
|
10
14
|
|
15
|
+
class Device : public Xot::RefCountable<>
|
16
|
+
{
|
17
|
+
|
18
|
+
public:
|
19
|
+
|
20
|
+
typedef Xot::Ref<Device> Ref;
|
21
|
+
|
22
|
+
virtual ~Device ();
|
23
|
+
|
24
|
+
virtual const char* name () const = 0;
|
25
|
+
|
26
|
+
virtual operator bool () const;
|
27
|
+
|
28
|
+
bool operator ! () const;
|
29
|
+
|
30
|
+
};// Device
|
31
|
+
|
32
|
+
|
11
33
|
void vibrate ();
|
12
34
|
|
13
35
|
|
data/include/reflex/event.h
CHANGED
@@ -17,6 +17,7 @@ namespace Reflex
|
|
17
17
|
{
|
18
18
|
|
19
19
|
|
20
|
+
class Device;
|
20
21
|
class Shape;
|
21
22
|
class View;
|
22
23
|
|
@@ -47,6 +48,30 @@ namespace Reflex
|
|
47
48
|
};// Event
|
48
49
|
|
49
50
|
|
51
|
+
class DeviceEvent : public Event
|
52
|
+
{
|
53
|
+
|
54
|
+
public:
|
55
|
+
|
56
|
+
DeviceEvent (Device* device = NULL);
|
57
|
+
|
58
|
+
DeviceEvent dup () const;
|
59
|
+
|
60
|
+
Device* device ();
|
61
|
+
|
62
|
+
const Device* device () const;
|
63
|
+
|
64
|
+
struct Data;
|
65
|
+
|
66
|
+
Xot::PSharedImpl<Data> self;
|
67
|
+
|
68
|
+
private:
|
69
|
+
|
70
|
+
DeviceEvent (const DeviceEvent* src);
|
71
|
+
|
72
|
+
};// DeviceEvent
|
73
|
+
|
74
|
+
|
50
75
|
class UpdateEvent : public Event
|
51
76
|
{
|
52
77
|
|
@@ -0,0 +1,175 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_GAMEPAD_H__
|
4
|
+
#define __REFLEX_GAMEPAD_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <xot/ref.h>
|
8
|
+
#include <xot/pimpl.h>
|
9
|
+
#include <xot/util.h>
|
10
|
+
#include <reflex/device.h>
|
11
|
+
#include <reflex/event.h>
|
12
|
+
|
13
|
+
|
14
|
+
namespace Reflex
|
15
|
+
{
|
16
|
+
|
17
|
+
|
18
|
+
class Gamepad : public Device
|
19
|
+
{
|
20
|
+
|
21
|
+
public:
|
22
|
+
|
23
|
+
typedef Xot::Ref<Gamepad> Ref;
|
24
|
+
|
25
|
+
typedef std::vector<Gamepad::Ref> List;
|
26
|
+
|
27
|
+
enum Index
|
28
|
+
{
|
29
|
+
|
30
|
+
INDEX_LEFT = 0, INDEX_RIGHT, INDEX_MAX
|
31
|
+
|
32
|
+
};// Index
|
33
|
+
|
34
|
+
enum Button
|
35
|
+
{
|
36
|
+
|
37
|
+
LEFT = Xot::bit<ulonglong>(0),
|
38
|
+
|
39
|
+
RIGHT = Xot::bit<ulonglong>(1),
|
40
|
+
|
41
|
+
UP = Xot::bit<ulonglong>(2),
|
42
|
+
|
43
|
+
DOWN = Xot::bit<ulonglong>(3),
|
44
|
+
|
45
|
+
LSTICK_LEFT = Xot::bit<ulonglong>(4),
|
46
|
+
|
47
|
+
LSTICK_RIGHT = Xot::bit<ulonglong>(5),
|
48
|
+
|
49
|
+
LSTICK_UP = Xot::bit<ulonglong>(6),
|
50
|
+
|
51
|
+
LSTICK_DOWN = Xot::bit<ulonglong>(7),
|
52
|
+
|
53
|
+
RSTICK_LEFT = Xot::bit<ulonglong>(8),
|
54
|
+
|
55
|
+
RSTICK_RIGHT = Xot::bit<ulonglong>(9),
|
56
|
+
|
57
|
+
RSTICK_UP = Xot::bit<ulonglong>(10),
|
58
|
+
|
59
|
+
RSTICK_DOWN = Xot::bit<ulonglong>(11),
|
60
|
+
|
61
|
+
BUTTON_A = Xot::bit<ulonglong>(12),
|
62
|
+
|
63
|
+
BUTTON_B = Xot::bit<ulonglong>(13),
|
64
|
+
|
65
|
+
BUTTON_X = Xot::bit<ulonglong>(14),
|
66
|
+
|
67
|
+
BUTTON_Y = Xot::bit<ulonglong>(15),
|
68
|
+
|
69
|
+
LSHOULDER = Xot::bit<ulonglong>(16),
|
70
|
+
|
71
|
+
RSHOULDER = Xot::bit<ulonglong>(17),
|
72
|
+
|
73
|
+
LTRIGGER = Xot::bit<ulonglong>(18),
|
74
|
+
|
75
|
+
RTRIGGER = Xot::bit<ulonglong>(19),
|
76
|
+
|
77
|
+
LTHUMB = Xot::bit<ulonglong>(20),
|
78
|
+
|
79
|
+
RTHUMB = Xot::bit<ulonglong>(21),
|
80
|
+
|
81
|
+
LPADDLE_0 = Xot::bit<ulonglong>(22),
|
82
|
+
|
83
|
+
LPADDLE_1 = Xot::bit<ulonglong>(23),
|
84
|
+
|
85
|
+
RPADDLE_0 = Xot::bit<ulonglong>(24),
|
86
|
+
|
87
|
+
RPADDLE_1 = Xot::bit<ulonglong>(25),
|
88
|
+
|
89
|
+
HOME = Xot::bit<ulonglong>(26),
|
90
|
+
|
91
|
+
MENU = Xot::bit<ulonglong>(27),
|
92
|
+
|
93
|
+
OPTION = Xot::bit<ulonglong>(28),
|
94
|
+
|
95
|
+
SHARE = Xot::bit<ulonglong>(29),
|
96
|
+
|
97
|
+
START = Xot::bit<ulonglong>(30),
|
98
|
+
|
99
|
+
SELECT = Xot::bit<ulonglong>(31),
|
100
|
+
|
101
|
+
BUTTON_TOUCH = Xot::bit<ulonglong>(32),
|
102
|
+
|
103
|
+
BUTTON_0 = Xot::bit<ulonglong>(33),
|
104
|
+
|
105
|
+
BUTTON_1 = Xot::bit<ulonglong>(34),
|
106
|
+
|
107
|
+
BUTTON_2 = Xot::bit<ulonglong>(35),
|
108
|
+
|
109
|
+
BUTTON_3 = Xot::bit<ulonglong>(36),
|
110
|
+
|
111
|
+
BUTTON_4 = Xot::bit<ulonglong>(37),
|
112
|
+
|
113
|
+
BUTTON_5 = Xot::bit<ulonglong>(38),
|
114
|
+
|
115
|
+
BUTTON_6 = Xot::bit<ulonglong>(39),
|
116
|
+
|
117
|
+
BUTTON_7 = Xot::bit<ulonglong>(40),
|
118
|
+
|
119
|
+
BUTTON_8 = Xot::bit<ulonglong>(41),
|
120
|
+
|
121
|
+
BUTTON_9 = Xot::bit<ulonglong>(42),
|
122
|
+
|
123
|
+
BUTTON_10 = Xot::bit<ulonglong>(43),
|
124
|
+
|
125
|
+
BUTTON_11 = Xot::bit<ulonglong>(44),
|
126
|
+
|
127
|
+
BUTTON_12 = Xot::bit<ulonglong>(45),
|
128
|
+
|
129
|
+
BUTTON_13 = Xot::bit<ulonglong>(46),
|
130
|
+
|
131
|
+
BUTTON_14 = Xot::bit<ulonglong>(47),
|
132
|
+
|
133
|
+
BUTTON_15 = Xot::bit<ulonglong>(48),
|
134
|
+
|
135
|
+
};// Button
|
136
|
+
|
137
|
+
Gamepad ();
|
138
|
+
|
139
|
+
virtual ~Gamepad ();
|
140
|
+
|
141
|
+
virtual const char* name () const;
|
142
|
+
|
143
|
+
virtual ulonglong buttons () const;
|
144
|
+
|
145
|
+
virtual const Point& stick (size_t index = INDEX_LEFT) const;
|
146
|
+
|
147
|
+
virtual float trigger (size_t index = INDEX_LEFT) const;
|
148
|
+
|
149
|
+
const Gamepad* prev () const;
|
150
|
+
|
151
|
+
virtual void on_key (KeyEvent* e);
|
152
|
+
|
153
|
+
virtual void on_key_down (KeyEvent* e);
|
154
|
+
|
155
|
+
virtual void on_key_up (KeyEvent* e);
|
156
|
+
|
157
|
+
//virtual void on_stick (StickEvent* e);
|
158
|
+
|
159
|
+
//virtual void on_trigger (TriggerEvent* e);
|
160
|
+
|
161
|
+
virtual operator bool () const;
|
162
|
+
|
163
|
+
static const List& all ();
|
164
|
+
|
165
|
+
struct Data;
|
166
|
+
|
167
|
+
Xot::PImpl<Data> self;
|
168
|
+
|
169
|
+
};// Gamepad
|
170
|
+
|
171
|
+
|
172
|
+
}// Reflex
|
173
|
+
|
174
|
+
|
175
|
+
#endif//EOH
|
@@ -65,6 +65,24 @@ namespace Reflex
|
|
65
65
|
return Super::on_quit(e);
|
66
66
|
}
|
67
67
|
|
68
|
+
virtual void on_device_connect (DeviceEvent* e)
|
69
|
+
{
|
70
|
+
RUCY_SYM(on_device_connect);
|
71
|
+
if (this->is_overridable())
|
72
|
+
this->value.call(on_device_connect, Rucy::value(e));
|
73
|
+
else
|
74
|
+
return Super::on_device_connect(e);
|
75
|
+
}
|
76
|
+
|
77
|
+
virtual void on_device_disconnect (DeviceEvent* e)
|
78
|
+
{
|
79
|
+
RUCY_SYM(on_device_disconnect);
|
80
|
+
if (this->is_overridable())
|
81
|
+
this->value.call(on_device_disconnect, Rucy::value(e));
|
82
|
+
else
|
83
|
+
return Super::on_device_disconnect(e);
|
84
|
+
}
|
85
|
+
|
68
86
|
virtual void on_motion (MotionEvent* e)
|
69
87
|
{
|
70
88
|
RUCY_SYM(on_motion);
|
@@ -0,0 +1,40 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_RUBY_DEVICE_H__
|
4
|
+
#define __REFLEX_RUBY_DEVICE_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <rucy/class.h>
|
8
|
+
#include <rucy/extension.h>
|
9
|
+
#include <reflex/device.h>
|
10
|
+
|
11
|
+
|
12
|
+
RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::Device)
|
13
|
+
|
14
|
+
|
15
|
+
namespace Reflex
|
16
|
+
{
|
17
|
+
|
18
|
+
|
19
|
+
REFLEX_EXPORT Rucy::Class device_class ();
|
20
|
+
// class Reflex::Device
|
21
|
+
|
22
|
+
|
23
|
+
}// Reflex
|
24
|
+
|
25
|
+
|
26
|
+
namespace Rucy
|
27
|
+
{
|
28
|
+
|
29
|
+
|
30
|
+
template <> inline Class
|
31
|
+
get_ruby_class<Reflex::Device> ()
|
32
|
+
{
|
33
|
+
return Reflex::device_class();
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
}// Rucy
|
38
|
+
|
39
|
+
|
40
|
+
#endif//EOH
|
data/include/reflex/ruby/event.h
CHANGED
@@ -11,6 +11,8 @@
|
|
11
11
|
|
12
12
|
RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::Event)
|
13
13
|
|
14
|
+
RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::DeviceEvent)
|
15
|
+
|
14
16
|
RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::UpdateEvent)
|
15
17
|
|
16
18
|
RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::DrawEvent)
|
@@ -43,6 +45,9 @@ namespace Reflex
|
|
43
45
|
REFLEX_EXPORT Rucy::Class event_class ();
|
44
46
|
// class Reflex::Event
|
45
47
|
|
48
|
+
REFLEX_EXPORT Rucy::Class device_event_class ();
|
49
|
+
// class Reflex::DeviceEvent
|
50
|
+
|
46
51
|
REFLEX_EXPORT Rucy::Class update_event_class ();
|
47
52
|
// class Reflex::UpdateEvent
|
48
53
|
|
@@ -93,6 +98,12 @@ namespace Rucy
|
|
93
98
|
return Reflex::event_class();
|
94
99
|
}
|
95
100
|
|
101
|
+
template <> inline Class
|
102
|
+
get_ruby_class<Reflex::DeviceEvent> ()
|
103
|
+
{
|
104
|
+
return Reflex::device_event_class();
|
105
|
+
}
|
106
|
+
|
96
107
|
template <> inline Class
|
97
108
|
get_ruby_class<Reflex::UpdateEvent> ()
|
98
109
|
{
|
data/reflex.gemspec
CHANGED
@@ -25,9 +25,9 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.platform = Gem::Platform::RUBY
|
26
26
|
s.required_ruby_version = '>= 3.0.0'
|
27
27
|
|
28
|
-
s.add_dependency 'xot', '~> 0.3.
|
29
|
-
s.add_dependency 'rucy', '~> 0.3.
|
30
|
-
s.add_dependency 'rays', '~> 0.3.
|
28
|
+
s.add_dependency 'xot', '~> 0.3.6', '>= 0.3.6'
|
29
|
+
s.add_dependency 'rucy', '~> 0.3.6', '>= 0.3.6'
|
30
|
+
s.add_dependency 'rays', '~> 0.3.6', '>= 0.3.6'
|
31
31
|
|
32
32
|
s.files = `git ls-files`.split $/
|
33
33
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|
data/src/application.cpp
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
#include "reflex/exception.h"
|
5
5
|
#include "reflex/debug.h"
|
6
6
|
#include "window.h"
|
7
|
+
#include "gamepad.h"
|
7
8
|
|
8
9
|
|
9
10
|
namespace Reflex
|
@@ -18,6 +19,37 @@ namespace Reflex
|
|
18
19
|
}// global
|
19
20
|
|
20
21
|
|
22
|
+
void
|
23
|
+
Application_call_start (Application* app, Event* e)
|
24
|
+
{
|
25
|
+
Gamepad_init(app);
|
26
|
+
|
27
|
+
app->on_start(e);
|
28
|
+
}
|
29
|
+
|
30
|
+
void
|
31
|
+
Application_call_quit (Application* app, Event* e)
|
32
|
+
{
|
33
|
+
app->on_quit(e);
|
34
|
+
if (e->is_blocked()) return;
|
35
|
+
|
36
|
+
Gamepad_fin(app);
|
37
|
+
}
|
38
|
+
|
39
|
+
void
|
40
|
+
Application_call_device_connect (Application* app, Device* device)
|
41
|
+
{
|
42
|
+
DeviceEvent e(device);
|
43
|
+
app->on_device_connect(&e);
|
44
|
+
}
|
45
|
+
|
46
|
+
void
|
47
|
+
Application_call_device_disconnect (Application* app, Device* device)
|
48
|
+
{
|
49
|
+
DeviceEvent e(device);
|
50
|
+
app->on_device_disconnect(&e);
|
51
|
+
}
|
52
|
+
|
21
53
|
Application*
|
22
54
|
app ()
|
23
55
|
{
|
@@ -78,6 +110,41 @@ namespace Reflex
|
|
78
110
|
return Window_all().end();
|
79
111
|
}
|
80
112
|
|
113
|
+
void
|
114
|
+
Application::on_start (Event* e)
|
115
|
+
{
|
116
|
+
}
|
117
|
+
|
118
|
+
void
|
119
|
+
Application::on_quit (Event* e)
|
120
|
+
{
|
121
|
+
}
|
122
|
+
|
123
|
+
void
|
124
|
+
Application::on_device_connect (DeviceEvent* e)
|
125
|
+
{
|
126
|
+
}
|
127
|
+
|
128
|
+
void
|
129
|
+
Application::on_device_disconnect (DeviceEvent* e)
|
130
|
+
{
|
131
|
+
}
|
132
|
+
|
133
|
+
void
|
134
|
+
Application::on_motion (MotionEvent* e)
|
135
|
+
{
|
136
|
+
}
|
137
|
+
|
138
|
+
void
|
139
|
+
Application::on_preference (Event* e)
|
140
|
+
{
|
141
|
+
}
|
142
|
+
|
143
|
+
Application::operator bool () const
|
144
|
+
{
|
145
|
+
return true;
|
146
|
+
}
|
147
|
+
|
81
148
|
bool
|
82
149
|
Application::operator ! () const
|
83
150
|
{
|
data/src/application.h
CHANGED
@@ -22,6 +22,15 @@ namespace Reflex
|
|
22
22
|
Application::Data* Application_create_data ();
|
23
23
|
|
24
24
|
|
25
|
+
void Application_call_start (Application* app, Event* e);
|
26
|
+
|
27
|
+
void Application_call_quit (Application* app, Event* e);
|
28
|
+
|
29
|
+
void Application_call_device_connect (Application* app, Device* device);
|
30
|
+
|
31
|
+
void Application_call_device_disconnect (Application* app, Device* device);
|
32
|
+
|
33
|
+
|
25
34
|
}// Reflex
|
26
35
|
|
27
36
|
|
data/src/device.cpp
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#include "reflex/device.h"
|
2
|
+
|
3
|
+
|
4
|
+
namespace Reflex
|
5
|
+
{
|
6
|
+
|
7
|
+
|
8
|
+
Device::~Device ()
|
9
|
+
{
|
10
|
+
}
|
11
|
+
|
12
|
+
Device::operator bool () const
|
13
|
+
{
|
14
|
+
return true;
|
15
|
+
}
|
16
|
+
|
17
|
+
bool
|
18
|
+
Device::operator ! () const
|
19
|
+
{
|
20
|
+
return !operator bool();
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
}// Reflex
|
data/src/event.cpp
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
#include <algorithm>
|
5
|
+
#include "reflex/device.h"
|
5
6
|
#include "reflex/timer.h"
|
6
7
|
#include "reflex/shape.h"
|
7
8
|
#include "reflex/exception.h"
|
@@ -69,6 +70,43 @@ namespace Reflex
|
|
69
70
|
}
|
70
71
|
|
71
72
|
|
73
|
+
struct DeviceEvent::Data
|
74
|
+
{
|
75
|
+
|
76
|
+
Device::Ref device;
|
77
|
+
|
78
|
+
};// DeviceEvent::Data
|
79
|
+
|
80
|
+
|
81
|
+
DeviceEvent::DeviceEvent (Device* device)
|
82
|
+
{
|
83
|
+
if (device) self->device = device;
|
84
|
+
}
|
85
|
+
|
86
|
+
DeviceEvent::DeviceEvent (const DeviceEvent* src)
|
87
|
+
: Event(src), self(new Data(*src->self))
|
88
|
+
{
|
89
|
+
}
|
90
|
+
|
91
|
+
DeviceEvent
|
92
|
+
DeviceEvent::dup () const
|
93
|
+
{
|
94
|
+
return DeviceEvent(this);
|
95
|
+
}
|
96
|
+
|
97
|
+
Device*
|
98
|
+
DeviceEvent::device ()
|
99
|
+
{
|
100
|
+
return self->device;
|
101
|
+
}
|
102
|
+
|
103
|
+
const Device*
|
104
|
+
DeviceEvent::device () const
|
105
|
+
{
|
106
|
+
return self->device;
|
107
|
+
}
|
108
|
+
|
109
|
+
|
72
110
|
struct UpdateEvent::Data
|
73
111
|
{
|
74
112
|
|