reflexion 0.1.57 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02fdc15de8ef558e7278dfdff35b09408002fc3f20f3ab0913ac887a72c74ea6
4
- data.tar.gz: e67ba5410334498eeea9ca321ab29d39a60d837d97fa69945adc041560087829
3
+ metadata.gz: 99978c547d86b5998ac78e2e7450a8cb998c892d693ed40a40f91e1975c9ccdc
4
+ data.tar.gz: f6ca834ae895ab7cf613292369040a633f6f893766c6321be61e2c6064f1ea33
5
5
  SHA512:
6
- metadata.gz: 62e8dc0bfb08ad9bcd2403821d351aed82b7bc244abb5dd1267dc7190fb4c2c7aac7f63c7c82b64fad2a372c276332d877e22985e9632baa9ace583c6084e646
7
- data.tar.gz: ee0dbbdab07c9e1b61ea4b7ee0a9f0ff2de25a8c3e3a8186bd9c7c822c5dc98a6b33d469b9883a688d6a0952eab88e23a0a663d8623476fe412e42169956c0cc
6
+ metadata.gz: 85d60b283c9af932e962bf9fc8f9d89ab659416342a325d50b7ccf8bb0f12e3e6e1fea650b9d1f3f919faf511b0915d4e2c716ec2d35219fd3824a43aecf0645
7
+ data.tar.gz: 11c8346eab634a5528fcb0c684e328b4f39271f580a79575abfaef07545e3611e5715d3786aee7da511f7989555dd72bf460bda5d44e5e51cb21f51abd75c6a3
@@ -13,7 +13,7 @@ Init_reflex_exception ()
13
13
  {
14
14
  Module mReflex = rb_define_module("Reflex");
15
15
 
16
- cReflexError = rb_define_class_under(mReflex, "ReflexError", rb_eRuntimeError);
16
+ cReflexError = rb_define_class_under(mReflex, "ReflexError", rb_eStandardError);
17
17
  cLayoutError = rb_define_class_under(mReflex, "LayoutError", cReflexError);
18
18
  cPhysicsError = rb_define_class_under(mReflex, "PhysicsError", cReflexError);
19
19
  }
@@ -119,8 +119,12 @@ VALUE get_key(VALUE self)
119
119
  CASE(LBRACKET): SYMBOL1(lbracket);
120
120
  CASE(RBRACKET): SYMBOL1(rbracket);
121
121
 
122
- CASE(ENTER):
123
- CASE(RETURN): SYMBOL1(enter);
122
+ #if defined(OSX) || defined(IOS)
123
+ CASE(ENTER): SYMBOL1(enter);
124
+ #else
125
+ CASE(ENTER): SYMBOL1(enter);
126
+ CASE(RETURN): SYMBOL1(_return, "return");
127
+ #endif
124
128
  CASE(SPACE): SYMBOL1(space);
125
129
  CASE(TAB): SYMBOL1(tab);
126
130
  CASE(DELETE): SYMBOL2(_delete, "delete");
@@ -137,18 +141,27 @@ VALUE get_key(VALUE self)
137
141
  CASE(PAGEUP): SYMBOL1(pageup);
138
142
  CASE(PAGEDOWN): SYMBOL1(pagedown);
139
143
 
144
+ #if defined(OSX) || defined(IOS)
140
145
  CASE(LSHIFT):
141
146
  CASE(RSHIFT): SYMBOL1(shift);
142
147
  CASE(LCONTROL):
143
148
  CASE(RCONTROL): SYMBOL1(control);
144
- //CASE(LALT):
145
- //CASE(RALT): SYMBOL1(alt);
146
- //CASE(LWIN):
147
- //CASE(RWIN): SYMBOL1(win);
148
149
  CASE(LCOMMAND):
149
150
  CASE(RCOMMAND): SYMBOL1(command);
150
151
  CASE(LOPTION):
151
152
  CASE(ROPTION): SYMBOL1(option);
153
+ #else
154
+ CASE(SHIFT):
155
+ CASE(LSHIFT):
156
+ CASE(RSHIFT): SYMBOL1(shift);
157
+ CASE(CONTROL):
158
+ CASE(LCONTROL):
159
+ CASE(RCONTROL): SYMBOL1(control);
160
+ //CASE(LALT):
161
+ //CASE(RALT): SYMBOL1(alt);
162
+ //CASE(LWIN):
163
+ //CASE(RWIN): SYMBOL1(win);
164
+ #endif
152
165
  CASE(FUNCTION): SYMBOL1(function);
153
166
 
154
167
  CASE(F1): SYMBOL1(f1);
@@ -184,6 +197,7 @@ VALUE get_key(VALUE self)
184
197
  CASE(NUM_COMMA): SYMBOL1(comma);
185
198
  CASE(NUM_DECIMAL): SYMBOL1(decimal);
186
199
  CASE(NUM_CLEAR): SYMBOL1(clear);
200
+ CASE(NUM_ENTER): SYMBOL1(enter);
187
201
 
188
202
  CASE(CAPSLOCK): SYMBOL1(capslock);
189
203
  //CASE(NUMLOCK): SYMBOL1(numlock);
@@ -248,7 +262,8 @@ static
248
262
  VALUE get_chars(VALUE self)
249
263
  {
250
264
  CHECK;
251
- return value(THIS->chars());
265
+ const char* chars = THIS->chars();
266
+ return chars ? value(chars) : nil();
252
267
  }
253
268
 
254
269
  static
@@ -50,6 +50,209 @@ Init_reflex ()
50
50
  mReflex = rb_define_module("Reflex");
51
51
  mReflex.define_singleton_method("init!", init);
52
52
  mReflex.define_singleton_method("fin!", fin);
53
+
54
+ using namespace Reflex;
55
+
56
+ #define DEFINE_CONST(name) mReflex.define_const(#name, name)
57
+
58
+ DEFINE_CONST(KEY_A);
59
+ DEFINE_CONST(KEY_B);
60
+ DEFINE_CONST(KEY_C);
61
+ DEFINE_CONST(KEY_D);
62
+ DEFINE_CONST(KEY_E);
63
+ DEFINE_CONST(KEY_F);
64
+ DEFINE_CONST(KEY_G);
65
+ DEFINE_CONST(KEY_H);
66
+ DEFINE_CONST(KEY_I);
67
+ DEFINE_CONST(KEY_J);
68
+ DEFINE_CONST(KEY_K);
69
+ DEFINE_CONST(KEY_L);
70
+ DEFINE_CONST(KEY_M);
71
+ DEFINE_CONST(KEY_N);
72
+ DEFINE_CONST(KEY_O);
73
+ DEFINE_CONST(KEY_P);
74
+ DEFINE_CONST(KEY_Q);
75
+ DEFINE_CONST(KEY_R);
76
+ DEFINE_CONST(KEY_S);
77
+ DEFINE_CONST(KEY_T);
78
+ DEFINE_CONST(KEY_U);
79
+ DEFINE_CONST(KEY_V);
80
+ DEFINE_CONST(KEY_W);
81
+ DEFINE_CONST(KEY_X);
82
+ DEFINE_CONST(KEY_Y);
83
+ DEFINE_CONST(KEY_Z);
84
+
85
+ DEFINE_CONST(KEY_0);
86
+ DEFINE_CONST(KEY_1);
87
+ DEFINE_CONST(KEY_2);
88
+ DEFINE_CONST(KEY_3);
89
+ DEFINE_CONST(KEY_4);
90
+ DEFINE_CONST(KEY_5);
91
+ DEFINE_CONST(KEY_6);
92
+ DEFINE_CONST(KEY_7);
93
+ DEFINE_CONST(KEY_8);
94
+ DEFINE_CONST(KEY_9);
95
+
96
+ DEFINE_CONST(KEY_MINUS);
97
+ DEFINE_CONST(KEY_EQUAL);
98
+ DEFINE_CONST(KEY_COMMA);
99
+ DEFINE_CONST(KEY_PERIOD);
100
+ DEFINE_CONST(KEY_SEMICOLON);
101
+ DEFINE_CONST(KEY_QUOTE);
102
+ DEFINE_CONST(KEY_SLASH);
103
+ DEFINE_CONST(KEY_BACKSLASH);
104
+ DEFINE_CONST(KEY_UNDERSCORE);
105
+ DEFINE_CONST(KEY_GRAVE);
106
+ DEFINE_CONST(KEY_YEN);
107
+ DEFINE_CONST(KEY_LBRACKET);
108
+ DEFINE_CONST(KEY_RBRACKET);
109
+
110
+ DEFINE_CONST(KEY_ENTER);
111
+ DEFINE_CONST(KEY_RETURN);
112
+ DEFINE_CONST(KEY_SPACE);
113
+ DEFINE_CONST(KEY_TAB);
114
+ DEFINE_CONST(KEY_DELETE);
115
+ DEFINE_CONST(KEY_BACKSPACE);
116
+ //DEFINE_CONST(KEY_INSERT);
117
+ DEFINE_CONST(KEY_ESCAPE);
118
+
119
+ DEFINE_CONST(KEY_LEFT);
120
+ DEFINE_CONST(KEY_RIGHT);
121
+ DEFINE_CONST(KEY_UP);
122
+ DEFINE_CONST(KEY_DOWN);
123
+ DEFINE_CONST(KEY_HOME);
124
+ DEFINE_CONST(KEY_END);
125
+ DEFINE_CONST(KEY_PAGEUP);
126
+ DEFINE_CONST(KEY_PAGEDOWN);
127
+
128
+ DEFINE_CONST(KEY_SHIFT);
129
+ DEFINE_CONST(KEY_LSHIFT);
130
+ DEFINE_CONST(KEY_RSHIFT);
131
+ DEFINE_CONST(KEY_CONTROL);
132
+ DEFINE_CONST(KEY_LCONTROL);
133
+ DEFINE_CONST(KEY_RCONTROL);
134
+ //DEFINE_CONST(KEY_LALT);
135
+ //DEFINE_CONST(KEY_RALT);
136
+ //DEFINE_CONST(KEY_LWIN);
137
+ //DEFINE_CONST(KEY_RWIN);
138
+ DEFINE_CONST(KEY_COMMAND);
139
+ DEFINE_CONST(KEY_LCOMMAND);
140
+ DEFINE_CONST(KEY_RCOMMAND);
141
+ DEFINE_CONST(KEY_OPTION);
142
+ DEFINE_CONST(KEY_LOPTION);
143
+ DEFINE_CONST(KEY_ROPTION);
144
+ DEFINE_CONST(KEY_FUNCTION);
145
+
146
+ DEFINE_CONST(KEY_F1);
147
+ DEFINE_CONST(KEY_F2);
148
+ DEFINE_CONST(KEY_F3);
149
+ DEFINE_CONST(KEY_F4);
150
+ DEFINE_CONST(KEY_F5);
151
+ DEFINE_CONST(KEY_F6);
152
+ DEFINE_CONST(KEY_F7);
153
+ DEFINE_CONST(KEY_F8);
154
+ DEFINE_CONST(KEY_F9);
155
+ DEFINE_CONST(KEY_F10);
156
+ DEFINE_CONST(KEY_F11);
157
+ DEFINE_CONST(KEY_F12);
158
+ DEFINE_CONST(KEY_F13);
159
+ DEFINE_CONST(KEY_F14);
160
+ DEFINE_CONST(KEY_F15);
161
+ DEFINE_CONST(KEY_F16);
162
+ DEFINE_CONST(KEY_F17);
163
+ DEFINE_CONST(KEY_F18);
164
+ DEFINE_CONST(KEY_F19);
165
+ DEFINE_CONST(KEY_F20);
166
+ //DEFINE_CONST(KEY_F21);
167
+ //DEFINE_CONST(KEY_F22);
168
+ //DEFINE_CONST(KEY_F23);
169
+ //DEFINE_CONST(KEY_F24);
170
+
171
+ DEFINE_CONST(KEY_NUM_0);
172
+ DEFINE_CONST(KEY_NUM_1);
173
+ DEFINE_CONST(KEY_NUM_2);
174
+ DEFINE_CONST(KEY_NUM_3);
175
+ DEFINE_CONST(KEY_NUM_4);
176
+ DEFINE_CONST(KEY_NUM_5);
177
+ DEFINE_CONST(KEY_NUM_6);
178
+ DEFINE_CONST(KEY_NUM_7);
179
+ DEFINE_CONST(KEY_NUM_8);
180
+ DEFINE_CONST(KEY_NUM_9);
181
+
182
+ DEFINE_CONST(KEY_NUM_PLUS);
183
+ DEFINE_CONST(KEY_NUM_MINUS);
184
+ DEFINE_CONST(KEY_NUM_MULTIPLY);
185
+ DEFINE_CONST(KEY_NUM_DIVIDE);
186
+ DEFINE_CONST(KEY_NUM_EQUAL);
187
+ DEFINE_CONST(KEY_NUM_COMMA);
188
+ DEFINE_CONST(KEY_NUM_DECIMAL);
189
+ DEFINE_CONST(KEY_NUM_CLEAR);
190
+ DEFINE_CONST(KEY_NUM_ENTER);
191
+
192
+ DEFINE_CONST(KEY_CAPSLOCK);
193
+ //DEFINE_CONST(KEY_NUMLOCK);
194
+ //DEFINE_CONST(KEY_SCROLLLOCK);
195
+
196
+ //DEFINE_CONST(KEY_PRINTSCREEN);
197
+ //DEFINE_CONST(KEY_PAUSE);
198
+ //DEFINE_CONST(KEY_BREAK);
199
+ DEFINE_CONST(KEY_SECTION);
200
+ DEFINE_CONST(KEY_HELP);
201
+
202
+ DEFINE_CONST(KEY_IME_EISU);
203
+ DEFINE_CONST(KEY_IME_KANA);
204
+ //DEFINE_CONST(KEY_IME_KANJI);
205
+ //DEFINE_CONST(KEY_IME_JUNJA);
206
+ //DEFINE_CONST(KEY_IME_PROCESS);
207
+ //DEFINE_CONST(KEY_IME_ACCEPT);
208
+ //DEFINE_CONST(KEY_IME_FINAL);
209
+ //DEFINE_CONST(KEY_IME_CONVERT);
210
+ //DEFINE_CONST(KEY_IME_NONCONVERT);
211
+ //DEFINE_CONST(KEY_IME_MODECHANGE);
212
+
213
+ DEFINE_CONST(KEY_VOLUME_UP);
214
+ DEFINE_CONST(KEY_VOLUME_DOWN);
215
+ DEFINE_CONST(KEY_MUTE);
216
+
217
+ //DEFINE_CONST(KEY_SLEEP);
218
+ //DEFINE_CONST(KEY_EXEC);
219
+ //DEFINE_CONST(KEY_PRINT);
220
+ //DEFINE_CONST(KEY_APPS);
221
+ //DEFINE_CONST(KEY_SELECT);
222
+ //DEFINE_CONST(KEY_CLEAR);
223
+ //DEFINE_CONST(KEY_PLAY);
224
+ //DEFINE_CONST(KEY_ZOOM);
225
+
226
+ //DEFINE_CONST(KEY_BROWSER_BACK);
227
+ //DEFINE_CONST(KEY_BROWSER_FORWARD);
228
+ //DEFINE_CONST(KEY_BROWSER_REFRESH);
229
+ //DEFINE_CONST(KEY_BROWSER_STOP);
230
+ //DEFINE_CONST(KEY_BROWSER_SEARCH);
231
+ //DEFINE_CONST(KEY_BROWSER_FAVORITES);
232
+ //DEFINE_CONST(KEY_BROWSER_HOME);
233
+
234
+ //DEFINE_CONST(KEY_MEDIA_NEXT_TRACK);
235
+ //DEFINE_CONST(KEY_MEDIA_PREV_TRACK);
236
+ //DEFINE_CONST(KEY_MEDIA_STOP);
237
+ //DEFINE_CONST(KEY_MEDIA_PLAY_PAUSE);
238
+
239
+ //DEFINE_CONST(KEY_LAUNCH_MAIL);
240
+ //DEFINE_CONST(KEY_LAUNCH_MEDIA_SELECT);
241
+ //DEFINE_CONST(KEY_LAUNCH_APP1);
242
+ //DEFINE_CONST(KEY_LAUNCH_APP2);
243
+
244
+ DEFINE_CONST(MOD_SHIFT);
245
+ DEFINE_CONST(MOD_CONTROL);
246
+ DEFINE_CONST(MOD_ALT);
247
+ DEFINE_CONST(MOD_WIN);
248
+ DEFINE_CONST(MOD_OPTION);
249
+ DEFINE_CONST(MOD_COMMAND);
250
+ DEFINE_CONST(MOD_HELP);
251
+ DEFINE_CONST(MOD_FUNCTION);
252
+ DEFINE_CONST(MOD_NUMPAD);
253
+ DEFINE_CONST(MOD_CAPS);
254
+
255
+ #undef DEFINE_CONST
53
256
  }
54
257
 
55
258
 
@@ -50,7 +50,7 @@ VALUE set_flow(VALUE self)
50
50
  argc >= 2 ? (Reflex::Style::Flow) to<int>(argv[1]) : Reflex::Style::FLOW_NONE);
51
51
  }
52
52
 
53
- return value(argc, argv);
53
+ return array(argv, argc);
54
54
  }
55
55
 
56
56
  static
@@ -112,7 +112,7 @@ VALUE set_size(VALUE self)
112
112
  set_width( self, argv[0]);
113
113
  set_height(self, argc >= 2 ? argv[1] : argv[0]);
114
114
 
115
- return value(argc, argv);
115
+ return array(argv, argc);
116
116
  }
117
117
 
118
118
  static
@@ -31,7 +31,7 @@ array (T begin, T end)
31
31
  {
32
32
  std::vector<Value> v;
33
33
  for (T it = begin; it != end; ++it) v.push_back(value(*it));
34
- return value(v.size(), &v[0]);
34
+ return array(&v[0], v.size());
35
35
  }
36
36
 
37
37
 
@@ -15,7 +15,7 @@ jobs:
15
15
  ruby-version: 3.2
16
16
 
17
17
  - name: checkout
18
- uses: actions/checkout@v2
18
+ uses: actions/checkout@v4
19
19
 
20
20
  - name: setup gems
21
21
  run: bundle install
@@ -15,7 +15,7 @@ jobs:
15
15
  ruby-version: 3.2
16
16
 
17
17
  - name: checkout
18
- uses: actions/checkout@v2
18
+ uses: actions/checkout@v4
19
19
  with:
20
20
  fetch-depth: 0
21
21
  token: ${{ secrets.PAT }}
@@ -16,7 +16,7 @@ jobs:
16
16
  ruby-version: 3.2
17
17
 
18
18
  - name: checkout
19
- uses: actions/checkout@v2
19
+ uses: actions/checkout@v4
20
20
 
21
21
  - name: setup gems
22
22
  run: bundle install
@@ -24,5 +24,11 @@ jobs:
24
24
  - name: setup dependencies
25
25
  run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
26
26
 
27
+ - name: lib
28
+ run: bundle exec rake lib
29
+
30
+ - name: ext
31
+ run: bundle exec rake ext
32
+
27
33
  - name: test
28
34
  run: bundle exec rake test
data/ChangeLog.md CHANGED
@@ -1,6 +1,24 @@
1
1
  # reflex ChangeLog
2
2
 
3
3
 
4
+ ## [v0.2.1] - 2024-07-05
5
+
6
+ - Use native values for key codes
7
+ - KeyEvent#chars returns nil
8
+ - KeyEvent#inspect prints 'key' value
9
+ - MOD_ALT -> MOD_OPTION
10
+ - Do not redefine fin!() methods, they are no longer needed
11
+ - Refactoring: Pointer#down
12
+ - Update workflows for test
13
+ - Update to actions/checkout@v4
14
+ - Fix duplicated prev pointer
15
+
16
+
17
+ ## [v0.2] - 2024-03-14
18
+
19
+ - Change the super class for exception class from RuntimeError to StandardError
20
+
21
+
4
22
  ## [v0.1.57] - 2024-02-07
5
23
 
6
24
  - Add Window#fullscreen accessor
@@ -9,6 +27,7 @@
9
27
  - Fix Window#set_frame updating to a position that was lower than the correct position by the height of the window title bar
10
28
  - Fix a bug that the window position origin (0, 0) was at the bottom-left corner of the screen; now it is at the top-left corner of the screen
11
29
 
30
+
12
31
  ## [v0.1.56] - 2024-01-08
13
32
 
14
33
  - Delete Polygon::Line because it was merged into Polyline
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GEM
9
9
 
10
10
  PLATFORMS
11
11
  arm64-darwin-21
12
- x86_64-darwin-20
12
+ arm64-darwin-22
13
13
 
14
14
  DEPENDENCIES
15
15
  rake
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.57
1
+ 0.2.1
@@ -13,7 +13,7 @@ Init_reflex_exception ()
13
13
  {
14
14
  Module mReflex = define_module("Reflex");
15
15
 
16
- cReflexError = mReflex.define_class("ReflexError", rb_eRuntimeError);
16
+ cReflexError = mReflex.define_class("ReflexError", rb_eStandardError);
17
17
  cLayoutError = mReflex.define_class("LayoutError", cReflexError);
18
18
  cPhysicsError = mReflex.define_class("PhysicsError", cReflexError);
19
19
  }
@@ -123,8 +123,12 @@ RUCY_DEF0(get_key)
123
123
  CASE(LBRACKET): SYMBOL1(lbracket);
124
124
  CASE(RBRACKET): SYMBOL1(rbracket);
125
125
 
126
- CASE(ENTER):
127
- CASE(RETURN): SYMBOL1(enter);
126
+ #if defined(OSX) || defined(IOS)
127
+ CASE(ENTER): SYMBOL1(enter);
128
+ #else
129
+ CASE(ENTER): SYMBOL1(enter);
130
+ CASE(RETURN): SYMBOL1(_return, "return");
131
+ #endif
128
132
  CASE(SPACE): SYMBOL1(space);
129
133
  CASE(TAB): SYMBOL1(tab);
130
134
  CASE(DELETE): SYMBOL2(_delete, "delete");
@@ -141,18 +145,27 @@ RUCY_DEF0(get_key)
141
145
  CASE(PAGEUP): SYMBOL1(pageup);
142
146
  CASE(PAGEDOWN): SYMBOL1(pagedown);
143
147
 
148
+ #if defined(OSX) || defined(IOS)
144
149
  CASE(LSHIFT):
145
150
  CASE(RSHIFT): SYMBOL1(shift);
146
151
  CASE(LCONTROL):
147
152
  CASE(RCONTROL): SYMBOL1(control);
148
- //CASE(LALT):
149
- //CASE(RALT): SYMBOL1(alt);
150
- //CASE(LWIN):
151
- //CASE(RWIN): SYMBOL1(win);
152
153
  CASE(LCOMMAND):
153
154
  CASE(RCOMMAND): SYMBOL1(command);
154
155
  CASE(LOPTION):
155
156
  CASE(ROPTION): SYMBOL1(option);
157
+ #else
158
+ CASE(SHIFT):
159
+ CASE(LSHIFT):
160
+ CASE(RSHIFT): SYMBOL1(shift);
161
+ CASE(CONTROL):
162
+ CASE(LCONTROL):
163
+ CASE(RCONTROL): SYMBOL1(control);
164
+ //CASE(LALT):
165
+ //CASE(RALT): SYMBOL1(alt);
166
+ //CASE(LWIN):
167
+ //CASE(RWIN): SYMBOL1(win);
168
+ #endif
156
169
  CASE(FUNCTION): SYMBOL1(function);
157
170
 
158
171
  CASE(F1): SYMBOL1(f1);
@@ -188,6 +201,7 @@ RUCY_DEF0(get_key)
188
201
  CASE(NUM_COMMA): SYMBOL1(comma);
189
202
  CASE(NUM_DECIMAL): SYMBOL1(decimal);
190
203
  CASE(NUM_CLEAR): SYMBOL1(clear);
204
+ CASE(NUM_ENTER): SYMBOL1(enter);
191
205
 
192
206
  CASE(CAPSLOCK): SYMBOL1(capslock);
193
207
  //CASE(NUMLOCK): SYMBOL1(numlock);
@@ -253,7 +267,8 @@ static
253
267
  RUCY_DEF0(get_chars)
254
268
  {
255
269
  CHECK;
256
- return value(THIS->chars());
270
+ const char* chars = THIS->chars();
271
+ return chars ? value(chars) : nil();
257
272
  }
258
273
  RUCY_END
259
274
 
@@ -52,6 +52,209 @@ Init_reflex ()
52
52
  mReflex = define_module("Reflex");
53
53
  mReflex.define_singleton_method("init!", init);
54
54
  mReflex.define_singleton_method("fin!", fin);
55
+
56
+ using namespace Reflex;
57
+
58
+ #define DEFINE_CONST(name) mReflex.define_const(#name, name)
59
+
60
+ DEFINE_CONST(KEY_A);
61
+ DEFINE_CONST(KEY_B);
62
+ DEFINE_CONST(KEY_C);
63
+ DEFINE_CONST(KEY_D);
64
+ DEFINE_CONST(KEY_E);
65
+ DEFINE_CONST(KEY_F);
66
+ DEFINE_CONST(KEY_G);
67
+ DEFINE_CONST(KEY_H);
68
+ DEFINE_CONST(KEY_I);
69
+ DEFINE_CONST(KEY_J);
70
+ DEFINE_CONST(KEY_K);
71
+ DEFINE_CONST(KEY_L);
72
+ DEFINE_CONST(KEY_M);
73
+ DEFINE_CONST(KEY_N);
74
+ DEFINE_CONST(KEY_O);
75
+ DEFINE_CONST(KEY_P);
76
+ DEFINE_CONST(KEY_Q);
77
+ DEFINE_CONST(KEY_R);
78
+ DEFINE_CONST(KEY_S);
79
+ DEFINE_CONST(KEY_T);
80
+ DEFINE_CONST(KEY_U);
81
+ DEFINE_CONST(KEY_V);
82
+ DEFINE_CONST(KEY_W);
83
+ DEFINE_CONST(KEY_X);
84
+ DEFINE_CONST(KEY_Y);
85
+ DEFINE_CONST(KEY_Z);
86
+
87
+ DEFINE_CONST(KEY_0);
88
+ DEFINE_CONST(KEY_1);
89
+ DEFINE_CONST(KEY_2);
90
+ DEFINE_CONST(KEY_3);
91
+ DEFINE_CONST(KEY_4);
92
+ DEFINE_CONST(KEY_5);
93
+ DEFINE_CONST(KEY_6);
94
+ DEFINE_CONST(KEY_7);
95
+ DEFINE_CONST(KEY_8);
96
+ DEFINE_CONST(KEY_9);
97
+
98
+ DEFINE_CONST(KEY_MINUS);
99
+ DEFINE_CONST(KEY_EQUAL);
100
+ DEFINE_CONST(KEY_COMMA);
101
+ DEFINE_CONST(KEY_PERIOD);
102
+ DEFINE_CONST(KEY_SEMICOLON);
103
+ DEFINE_CONST(KEY_QUOTE);
104
+ DEFINE_CONST(KEY_SLASH);
105
+ DEFINE_CONST(KEY_BACKSLASH);
106
+ DEFINE_CONST(KEY_UNDERSCORE);
107
+ DEFINE_CONST(KEY_GRAVE);
108
+ DEFINE_CONST(KEY_YEN);
109
+ DEFINE_CONST(KEY_LBRACKET);
110
+ DEFINE_CONST(KEY_RBRACKET);
111
+
112
+ DEFINE_CONST(KEY_ENTER);
113
+ DEFINE_CONST(KEY_RETURN);
114
+ DEFINE_CONST(KEY_SPACE);
115
+ DEFINE_CONST(KEY_TAB);
116
+ DEFINE_CONST(KEY_DELETE);
117
+ DEFINE_CONST(KEY_BACKSPACE);
118
+ //DEFINE_CONST(KEY_INSERT);
119
+ DEFINE_CONST(KEY_ESCAPE);
120
+
121
+ DEFINE_CONST(KEY_LEFT);
122
+ DEFINE_CONST(KEY_RIGHT);
123
+ DEFINE_CONST(KEY_UP);
124
+ DEFINE_CONST(KEY_DOWN);
125
+ DEFINE_CONST(KEY_HOME);
126
+ DEFINE_CONST(KEY_END);
127
+ DEFINE_CONST(KEY_PAGEUP);
128
+ DEFINE_CONST(KEY_PAGEDOWN);
129
+
130
+ DEFINE_CONST(KEY_SHIFT);
131
+ DEFINE_CONST(KEY_LSHIFT);
132
+ DEFINE_CONST(KEY_RSHIFT);
133
+ DEFINE_CONST(KEY_CONTROL);
134
+ DEFINE_CONST(KEY_LCONTROL);
135
+ DEFINE_CONST(KEY_RCONTROL);
136
+ //DEFINE_CONST(KEY_LALT);
137
+ //DEFINE_CONST(KEY_RALT);
138
+ //DEFINE_CONST(KEY_LWIN);
139
+ //DEFINE_CONST(KEY_RWIN);
140
+ DEFINE_CONST(KEY_COMMAND);
141
+ DEFINE_CONST(KEY_LCOMMAND);
142
+ DEFINE_CONST(KEY_RCOMMAND);
143
+ DEFINE_CONST(KEY_OPTION);
144
+ DEFINE_CONST(KEY_LOPTION);
145
+ DEFINE_CONST(KEY_ROPTION);
146
+ DEFINE_CONST(KEY_FUNCTION);
147
+
148
+ DEFINE_CONST(KEY_F1);
149
+ DEFINE_CONST(KEY_F2);
150
+ DEFINE_CONST(KEY_F3);
151
+ DEFINE_CONST(KEY_F4);
152
+ DEFINE_CONST(KEY_F5);
153
+ DEFINE_CONST(KEY_F6);
154
+ DEFINE_CONST(KEY_F7);
155
+ DEFINE_CONST(KEY_F8);
156
+ DEFINE_CONST(KEY_F9);
157
+ DEFINE_CONST(KEY_F10);
158
+ DEFINE_CONST(KEY_F11);
159
+ DEFINE_CONST(KEY_F12);
160
+ DEFINE_CONST(KEY_F13);
161
+ DEFINE_CONST(KEY_F14);
162
+ DEFINE_CONST(KEY_F15);
163
+ DEFINE_CONST(KEY_F16);
164
+ DEFINE_CONST(KEY_F17);
165
+ DEFINE_CONST(KEY_F18);
166
+ DEFINE_CONST(KEY_F19);
167
+ DEFINE_CONST(KEY_F20);
168
+ //DEFINE_CONST(KEY_F21);
169
+ //DEFINE_CONST(KEY_F22);
170
+ //DEFINE_CONST(KEY_F23);
171
+ //DEFINE_CONST(KEY_F24);
172
+
173
+ DEFINE_CONST(KEY_NUM_0);
174
+ DEFINE_CONST(KEY_NUM_1);
175
+ DEFINE_CONST(KEY_NUM_2);
176
+ DEFINE_CONST(KEY_NUM_3);
177
+ DEFINE_CONST(KEY_NUM_4);
178
+ DEFINE_CONST(KEY_NUM_5);
179
+ DEFINE_CONST(KEY_NUM_6);
180
+ DEFINE_CONST(KEY_NUM_7);
181
+ DEFINE_CONST(KEY_NUM_8);
182
+ DEFINE_CONST(KEY_NUM_9);
183
+
184
+ DEFINE_CONST(KEY_NUM_PLUS);
185
+ DEFINE_CONST(KEY_NUM_MINUS);
186
+ DEFINE_CONST(KEY_NUM_MULTIPLY);
187
+ DEFINE_CONST(KEY_NUM_DIVIDE);
188
+ DEFINE_CONST(KEY_NUM_EQUAL);
189
+ DEFINE_CONST(KEY_NUM_COMMA);
190
+ DEFINE_CONST(KEY_NUM_DECIMAL);
191
+ DEFINE_CONST(KEY_NUM_CLEAR);
192
+ DEFINE_CONST(KEY_NUM_ENTER);
193
+
194
+ DEFINE_CONST(KEY_CAPSLOCK);
195
+ //DEFINE_CONST(KEY_NUMLOCK);
196
+ //DEFINE_CONST(KEY_SCROLLLOCK);
197
+
198
+ //DEFINE_CONST(KEY_PRINTSCREEN);
199
+ //DEFINE_CONST(KEY_PAUSE);
200
+ //DEFINE_CONST(KEY_BREAK);
201
+ DEFINE_CONST(KEY_SECTION);
202
+ DEFINE_CONST(KEY_HELP);
203
+
204
+ DEFINE_CONST(KEY_IME_EISU);
205
+ DEFINE_CONST(KEY_IME_KANA);
206
+ //DEFINE_CONST(KEY_IME_KANJI);
207
+ //DEFINE_CONST(KEY_IME_JUNJA);
208
+ //DEFINE_CONST(KEY_IME_PROCESS);
209
+ //DEFINE_CONST(KEY_IME_ACCEPT);
210
+ //DEFINE_CONST(KEY_IME_FINAL);
211
+ //DEFINE_CONST(KEY_IME_CONVERT);
212
+ //DEFINE_CONST(KEY_IME_NONCONVERT);
213
+ //DEFINE_CONST(KEY_IME_MODECHANGE);
214
+
215
+ DEFINE_CONST(KEY_VOLUME_UP);
216
+ DEFINE_CONST(KEY_VOLUME_DOWN);
217
+ DEFINE_CONST(KEY_MUTE);
218
+
219
+ //DEFINE_CONST(KEY_SLEEP);
220
+ //DEFINE_CONST(KEY_EXEC);
221
+ //DEFINE_CONST(KEY_PRINT);
222
+ //DEFINE_CONST(KEY_APPS);
223
+ //DEFINE_CONST(KEY_SELECT);
224
+ //DEFINE_CONST(KEY_CLEAR);
225
+ //DEFINE_CONST(KEY_PLAY);
226
+ //DEFINE_CONST(KEY_ZOOM);
227
+
228
+ //DEFINE_CONST(KEY_BROWSER_BACK);
229
+ //DEFINE_CONST(KEY_BROWSER_FORWARD);
230
+ //DEFINE_CONST(KEY_BROWSER_REFRESH);
231
+ //DEFINE_CONST(KEY_BROWSER_STOP);
232
+ //DEFINE_CONST(KEY_BROWSER_SEARCH);
233
+ //DEFINE_CONST(KEY_BROWSER_FAVORITES);
234
+ //DEFINE_CONST(KEY_BROWSER_HOME);
235
+
236
+ //DEFINE_CONST(KEY_MEDIA_NEXT_TRACK);
237
+ //DEFINE_CONST(KEY_MEDIA_PREV_TRACK);
238
+ //DEFINE_CONST(KEY_MEDIA_STOP);
239
+ //DEFINE_CONST(KEY_MEDIA_PLAY_PAUSE);
240
+
241
+ //DEFINE_CONST(KEY_LAUNCH_MAIL);
242
+ //DEFINE_CONST(KEY_LAUNCH_MEDIA_SELECT);
243
+ //DEFINE_CONST(KEY_LAUNCH_APP1);
244
+ //DEFINE_CONST(KEY_LAUNCH_APP2);
245
+
246
+ DEFINE_CONST(MOD_SHIFT);
247
+ DEFINE_CONST(MOD_CONTROL);
248
+ DEFINE_CONST(MOD_ALT);
249
+ DEFINE_CONST(MOD_WIN);
250
+ DEFINE_CONST(MOD_OPTION);
251
+ DEFINE_CONST(MOD_COMMAND);
252
+ DEFINE_CONST(MOD_HELP);
253
+ DEFINE_CONST(MOD_FUNCTION);
254
+ DEFINE_CONST(MOD_NUMPAD);
255
+ DEFINE_CONST(MOD_CAPS);
256
+
257
+ #undef DEFINE_CONST
55
258
  }
56
259
 
57
260