reflexion 0.1.3 → 0.1.4

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.
Files changed (88) hide show
  1. data/.doc/ext/reflex/application.cpp +35 -76
  2. data/.doc/ext/reflex/defs.cpp +8 -0
  3. data/.doc/ext/reflex/key.cpp +38 -43
  4. data/.doc/ext/reflex/native.cpp +6 -4
  5. data/.doc/ext/reflex/points.cpp +47 -52
  6. data/.doc/ext/reflex/reflex.cpp +12 -13
  7. data/.doc/ext/reflex/view.cpp +242 -0
  8. data/.doc/ext/reflex/window.cpp +87 -178
  9. data/.gitignore +14 -0
  10. data/Rakefile +6 -31
  11. data/VERSION +1 -1
  12. data/examples/hello/.gitignore +2 -0
  13. data/examples/ruby/app.rb +2 -2
  14. data/examples/ruby/checker.rb +3 -3
  15. data/examples/ruby/fps.rb +14 -14
  16. data/examples/ruby/grid.rb +65 -0
  17. data/examples/ruby/hello.rb +19 -7
  18. data/examples/ruby/key.rb +4 -4
  19. data/examples/ruby/shapes.rb +6 -6
  20. data/examples/ruby/text.rb +20 -17
  21. data/examples/ruby/views.rb +88 -0
  22. data/examples/ruby/visuals.rb +27 -0
  23. data/ext/reflex/application.cpp +36 -76
  24. data/ext/reflex/defs.cpp +8 -0
  25. data/ext/reflex/defs.h +1 -18
  26. data/ext/reflex/extconf.rb +16 -8
  27. data/ext/reflex/key.cpp +39 -43
  28. data/ext/reflex/native.cpp +6 -4
  29. data/ext/reflex/points.cpp +48 -52
  30. data/ext/reflex/reflex.cpp +12 -13
  31. data/ext/reflex/view.cpp +260 -0
  32. data/ext/reflex/window.cpp +89 -178
  33. data/include/reflex/application.h +14 -7
  34. data/include/reflex/defs.h +8 -6
  35. data/include/reflex/exception.h +1 -1
  36. data/include/reflex/ruby/application.h +31 -10
  37. data/include/reflex/ruby/key.h +3 -3
  38. data/include/reflex/ruby/points.h +3 -3
  39. data/include/reflex/ruby/view.h +106 -0
  40. data/include/reflex/ruby/window.h +83 -12
  41. data/include/reflex/ruby.h +3 -2
  42. data/include/reflex/view.h +103 -0
  43. data/include/reflex/window.h +43 -18
  44. data/include/reflex.h +2 -1
  45. data/lib/reflex/application.rb +8 -7
  46. data/lib/reflex/autoinit.rb +1 -1
  47. data/lib/reflex/bitmap.rb +13 -0
  48. data/lib/reflex/bounds.rb +2 -122
  49. data/lib/reflex/ext.rb +5 -0
  50. data/lib/reflex/helpers.rb +36 -31
  51. data/lib/reflex/image.rb +13 -0
  52. data/lib/reflex/module.rb +9 -2
  53. data/lib/reflex/painter.rb +13 -0
  54. data/lib/reflex/point.rb +3 -59
  55. data/lib/reflex/reflex.rb +1 -1
  56. data/lib/reflex/texture.rb +13 -0
  57. data/lib/reflex/view.rb +33 -0
  58. data/lib/reflex/visuals/string.rb +53 -0
  59. data/lib/reflex/window.rb +18 -43
  60. data/lib/reflex.rb +3 -3
  61. data/reflex.gemspec +16 -42
  62. data/src/cocoa/application.mm +17 -23
  63. data/src/cocoa/applicationdata.h +3 -9
  64. data/src/cocoa/cocoaapplication.h +6 -4
  65. data/src/cocoa/cocoaapplication.mm +61 -19
  66. data/src/cocoa/cocoawindow.h +7 -5
  67. data/src/cocoa/cocoawindow.mm +109 -50
  68. data/src/cocoa/defs.mm +5 -2
  69. data/src/cocoa/window.mm +71 -41
  70. data/src/cocoa/windowdata.h +14 -9
  71. data/src/defs.cpp +1 -1
  72. data/src/exception.cpp +3 -18
  73. data/src/helpers.h +12 -0
  74. data/src/reflex.cpp +11 -5
  75. data/src/view.cpp +326 -0
  76. data/src/win32/application.cpp +7 -8
  77. data/src/win32/defs.h +1 -1
  78. data/src/win32/window.cpp +137 -41
  79. data/src/window.cpp +38 -1
  80. data/test/helpers.rb +2 -5
  81. data/test/test_application.rb +17 -0
  82. data/test/test_reflex.rb +4 -2
  83. data/test/test_view.rb +74 -0
  84. data/test/test_window.rb +33 -2
  85. metadata +157 -97
  86. data/include/reflex/helpers.h +0 -32
  87. data/test/test_bounds.rb +0 -163
  88. data/test/test_point.rb +0 -81
@@ -0,0 +1,242 @@
1
+ #include "reflex/ruby/view.h"
2
+
3
+
4
+ #include <rucy.h>
5
+ #include <reflex/ruby/window.h>
6
+ #include "defs.h"
7
+
8
+
9
+ using namespace Rucy;
10
+
11
+ using Reflex::coord;
12
+
13
+
14
+ static Class cView;
15
+
16
+
17
+ namespace Reflex
18
+ {
19
+
20
+
21
+ Class
22
+ view_class ()
23
+ {
24
+ return cView;
25
+ }
26
+
27
+
28
+ }// Reflex
29
+
30
+
31
+ typedef Reflex::RubyView<Reflex::View> RubyView;
32
+
33
+
34
+ #define THIS to<Reflex::View*>(self)
35
+
36
+ #define CHECK RUCY_CHECK_OBJECT(self, Reflex::View, cView)
37
+
38
+ #define CALL(fun) RUCY_WRAPPER_CALL(RubyView, THIS, fun)
39
+
40
+
41
+ static
42
+ VALUE alloc(VALUE klass)
43
+ {
44
+ return value(new RubyView, klass);
45
+ }
46
+
47
+ static
48
+ VALUE show(VALUE self)
49
+ {
50
+ CHECK;
51
+ if (!CALL(show()))
52
+ reflex_error("failed to show view.");
53
+ return self;
54
+ }
55
+
56
+ static
57
+ VALUE hide(VALUE self)
58
+ {
59
+ CHECK;
60
+ if (!CALL(hide()))
61
+ reflex_error("failed to hide view.");
62
+ return self;
63
+ }
64
+
65
+ static
66
+ VALUE redraw(VALUE self)
67
+ {
68
+ CHECK;
69
+ if (!THIS->redraw())
70
+ reflex_error("failed to redraw view.");
71
+ return self;
72
+ }
73
+
74
+ static
75
+ VALUE add_child(VALUE self, VALUE child)
76
+ {
77
+ CHECK;
78
+
79
+ Reflex::View* c = to<Reflex::View*>(child);
80
+ if (!c) argument_error();
81
+
82
+ if (!THIS->add_child(c))
83
+ reflex_error("failed to add child view.");
84
+
85
+ return self;
86
+ }
87
+
88
+ static
89
+ VALUE remove_child(VALUE self, VALUE child)
90
+ {
91
+ CHECK;
92
+
93
+ Reflex::View* c = to<Reflex::View*>(child);
94
+ if (!c) argument_error();
95
+
96
+ if (!THIS->remove_child(c))
97
+ reflex_error("failed to remove child view.");
98
+
99
+ return self;
100
+ }
101
+
102
+ static
103
+ VALUE find_child(VALUE self)
104
+ {
105
+ CHECK;
106
+ if (argc < 1 || 3 < argc)
107
+ arg_count_error("View#find_child", argc, 1, 2, 3);
108
+
109
+ const char* name = to<const char*>(argv[0]);
110
+ size_t index = (argc >= 2) ? to<size_t>(argv[1]) : 0;
111
+ bool recursive = (argc >= 3) ? to<bool>(argv[2]) : false;
112
+
113
+ Reflex::View* c = THIS->find_child(name, index, recursive);
114
+ if (!c) return Qnil;
115
+
116
+ return value(c);
117
+ }
118
+
119
+ static
120
+ VALUE set_name(VALUE self, VALUE name)
121
+ {
122
+ CHECK;
123
+ if (!THIS->set_name(name.c_str()))
124
+ reflex_error("failed to set the name of view.");
125
+ return name;
126
+ }
127
+
128
+ static
129
+ VALUE get_name(VALUE self)
130
+ {
131
+ CHECK;
132
+ const char* s = THIS->name();
133
+ if (!s) reflex_error("failed to get name of view.");
134
+ return value(s);
135
+ }
136
+
137
+ static
138
+ VALUE set_bounds(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
139
+ {
140
+ CHECK;
141
+ if (!THIS->set_bounds(
142
+ to<coord>(x), to<coord>(y), to<coord>(width), to<coord>(height)))
143
+ {
144
+ reflex_error("failed to set the bounds of view.");
145
+ }
146
+ return value(THIS->bounds());
147
+ }
148
+
149
+ static
150
+ VALUE get_bounds(VALUE self)
151
+ {
152
+ CHECK;
153
+ return value(THIS->bounds());
154
+ }
155
+
156
+ static
157
+ VALUE hidden(VALUE self)
158
+ {
159
+ CHECK;
160
+ return value(THIS->hidden());
161
+ }
162
+
163
+ static
164
+ VALUE parent(VALUE self)
165
+ {
166
+ CHECK;
167
+
168
+ Reflex::View* v = THIS->parent();
169
+ if (!v) return Qnil;
170
+
171
+ return value(v);
172
+ }
173
+
174
+ static
175
+ VALUE window(VALUE self)
176
+ {
177
+ CHECK;
178
+
179
+ Reflex::Window* w = THIS->window();
180
+ if (!w) return Qnil;
181
+
182
+ return value(w);
183
+ }
184
+
185
+ static
186
+ VALUE update(VALUE self, VALUE dt)
187
+ {
188
+ CHECK;
189
+ CALL(update(to<float>(dt)));
190
+ return self;
191
+ }
192
+
193
+ static
194
+ VALUE draw(VALUE self, VALUE painter, VALUE bounds)
195
+ {
196
+ CHECK;
197
+ CALL(draw(to<Rays::Painter*>(painter), *to<Rays::Bounds*>(bounds)));
198
+ return self;
199
+ }
200
+
201
+ static
202
+ VALUE moved(VALUE self, VALUE dx, VALUE dy)
203
+ {
204
+ CHECK;
205
+ CALL(moved(to<coord>(dx), to<coord>(dy)));
206
+ return self;
207
+ }
208
+
209
+ static
210
+ VALUE resized(VALUE self, VALUE dwidth, VALUE dheight)
211
+ {
212
+ CHECK;
213
+ CALL(resized(to<coord>(dwidth), to<coord>(dheight)));
214
+ return self;
215
+ }
216
+
217
+
218
+ void
219
+ Init_view ()
220
+ {
221
+ Module mReflex = rb_define_module("Reflex");
222
+
223
+ cView = rb_define_class_under(mReflex, "View", rb_cObject);
224
+ rb_define_alloc_func(cView, alloc);
225
+ rb_define_method(cView, "show", RUBY_METHOD_FUNC(show), 0);
226
+ rb_define_method(cView, "hide", RUBY_METHOD_FUNC(hide), 0);
227
+ rb_define_method(cView, "redraw", RUBY_METHOD_FUNC(redraw), 0);
228
+ rb_define_method(cView, "add_child", RUBY_METHOD_FUNC(add_child), 1);
229
+ rb_define_method(cView, "remove_child", RUBY_METHOD_FUNC(remove_child), 1);
230
+ rb_define_method(cView, "find_child", RUBY_METHOD_FUNC(find_child), -1);
231
+ rb_define_method(cView, "name=", RUBY_METHOD_FUNC(set_name), 1);
232
+ rb_define_method(cView, "name", RUBY_METHOD_FUNC(get_name), 0);
233
+ rb_define_private_method(cView, "set_bounds", RUBY_METHOD_FUNC(set_bounds), 4);
234
+ rb_define_private_method(cView, "get_bounds", RUBY_METHOD_FUNC(get_bounds), 0);
235
+ rb_define_method(cView, "hidden", RUBY_METHOD_FUNC(hidden), 0);
236
+ rb_define_method(cView, "parent", RUBY_METHOD_FUNC(parent), 0);
237
+ rb_define_method(cView, "window", RUBY_METHOD_FUNC(window), 0);
238
+ rb_define_method(cView, "update", RUBY_METHOD_FUNC(update), 1);
239
+ rb_define_method(cView, "draw", RUBY_METHOD_FUNC(draw), 2);
240
+ rb_define_method(cView, "moved", RUBY_METHOD_FUNC(moved), 2);
241
+ rb_define_method(cView, "resized", RUBY_METHOD_FUNC(resized), 2);
242
+ }
@@ -2,8 +2,8 @@
2
2
 
3
3
 
4
4
  #include <rucy.h>
5
- #include <reflex/ruby/key.h>
6
- #include <reflex/ruby/points.h>
5
+ #include <rays/ruby/painter.h>
6
+ #include <reflex/ruby/view.h>
7
7
  #include "defs.h"
8
8
 
9
9
 
@@ -12,12 +12,13 @@ using namespace Rucy;
12
12
  using Reflex::coord;
13
13
 
14
14
 
15
+ static Class cWindow;
16
+
17
+
15
18
  namespace Reflex
16
19
  {
17
20
 
18
21
 
19
- static Class cWindow;
20
-
21
22
  Class
22
23
  window_class ()
23
24
  {
@@ -28,127 +29,27 @@ namespace Reflex
28
29
  }// Reflex
29
30
 
30
31
 
31
- namespace Rucy
32
- {
33
-
34
-
35
- Value
36
- value (const Reflex::Window& window)
37
- {
38
- return new_type<Reflex::Window>(
39
- Reflex::window_class(), new Reflex::Window(window));
40
- }
41
-
32
+ typedef Reflex::RubyWindow<Reflex::Window> RubyWindow;
42
33
 
43
- }// Rucy
44
34
 
35
+ #define THIS to<Reflex::Window*>(self)
45
36
 
46
- class RubyWindow : public Reflex::Window
47
- {
37
+ #define CHECK RUCY_CHECK_OBJECT(self, Reflex::Window, cWindow)
48
38
 
49
- public:
50
-
51
- typedef Reflex::Window Super;
52
-
53
- Value self;
54
-
55
- void mark ()
56
- {
57
- self.mark();
58
- }
59
-
60
- virtual bool close ()
61
- {
62
- SYM(close);
63
- return self.call(close);
64
- }
65
-
66
- virtual bool show ()
67
- {
68
- SYM(show);
69
- return self.call(show);
70
- }
71
-
72
- virtual bool hide ()
73
- {
74
- SYM(hide);
75
- return self.call(hide);
76
- }
77
-
78
- virtual void update ()
79
- {
80
- SYM(update);
81
- self.call(update);
82
- }
83
-
84
- virtual void draw ()
85
- {
86
- SYM(draw);
87
- self.call(draw);
88
- }
89
-
90
- virtual void moved (coord x, coord y)
91
- {
92
- SYM(moved);
93
- self.call(moved, x, y);
94
- }
95
-
96
- virtual void resized (coord width, coord height)
97
- {
98
- SYM(resized);
99
- self.call(resized, width, height);
100
- }
101
-
102
- virtual void key_down (const Reflex::Key& key)
103
- {
104
- SYM(key_down);
105
- self.call(key_down, value(key));
106
- }
107
-
108
- virtual void key_up (const Reflex::Key& key)
109
- {
110
- SYM(key_up);
111
- self.call(key_up, value(key));
112
- }
113
-
114
- virtual void points_down (const Reflex::Points& points)
115
- {
116
- SYM(points_down);
117
- self.call(points_down, value(points));
118
- }
119
-
120
- virtual void points_up (const Reflex::Points& points)
121
- {
122
- SYM(points_up);
123
- self.call(points_up, value(points));
124
- }
125
-
126
- virtual void points_moved (const Reflex::Points& points)
127
- {
128
- SYM(points_moved);
129
- self.call(points_moved, value(points));
130
- }
131
-
132
- };// RubyWindow
133
-
134
-
135
- #define this ((RubyWindow*) to<Reflex::Window*>(self))
136
-
137
- #define CHECK CHECK_OBJECT(self, RubyWindow, Reflex::window_class())
39
+ #define CALL(fun) RUCY_WRAPPER_CALL(RubyWindow, THIS, fun)
138
40
 
139
41
 
140
42
  static
141
43
  VALUE alloc(VALUE klass)
142
44
  {
143
- RubyWindow* win = new RubyWindow;
144
- return win->self = new_type<RubyWindow>(klass, win, mark_type<RubyWindow>);
45
+ return value(new RubyWindow, klass);
145
46
  }
146
47
 
147
48
  static
148
49
  VALUE close(VALUE self)
149
50
  {
150
51
  CHECK;
151
- if (!this->Super::close())
52
+ if (!CALL(close()))
152
53
  system_error("failed to close window.");
153
54
  return self;
154
55
  }
@@ -157,7 +58,7 @@ static
157
58
  VALUE show(VALUE self)
158
59
  {
159
60
  CHECK;
160
- if (!this->Super::show())
61
+ if (!CALL(show()))
161
62
  system_error("failed to show window.");
162
63
  return self;
163
64
  }
@@ -166,91 +67,99 @@ static
166
67
  VALUE hide(VALUE self)
167
68
  {
168
69
  CHECK;
169
- if (!this->Super::hide())
70
+ if (!CALL(hide()))
170
71
  system_error("failed to hide window.");
171
72
  return self;
172
73
  }
173
74
 
174
75
  static
175
- VALUE hidden(VALUE self)
76
+ VALUE redraw(VALUE self)
176
77
  {
177
78
  CHECK;
178
- return value(this->hidden());
79
+ if (!THIS->redraw())
80
+ system_error("failed to redraw window.");
81
+ return self;
179
82
  }
180
83
 
181
84
  static
182
- VALUE update(VALUE self)
85
+ VALUE set_title(VALUE self, VALUE title)
183
86
  {
184
87
  CHECK;
185
- this->Super::update();
186
- return self;
88
+ if (!THIS->set_title(title.c_str()))
89
+ system_error("failed to set title of window.");
90
+ return title;
187
91
  }
188
92
 
189
93
  static
190
- VALUE draw(VALUE self)
94
+ VALUE get_title(VALUE self)
191
95
  {
192
96
  CHECK;
193
- this->Super::draw();
194
- return self;
97
+ const char* s = THIS->title();
98
+ if (!s) system_error("failed to get title of window.");
99
+ return value(s);
195
100
  }
196
101
 
197
102
  static
198
- VALUE redraw(VALUE self)
103
+ VALUE set_bounds(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
199
104
  {
200
105
  CHECK;
201
- if (!this->Super::redraw())
202
- system_error("failed to redraw window.");
203
- return self;
106
+ if (!THIS->set_bounds(
107
+ to<coord>(x), to<coord>(y), to<coord>(width), to<coord>(height)))
108
+ {
109
+ system_error("failed to set bounds of window.");
110
+ }
111
+ return value(THIS->bounds());
204
112
  }
205
113
 
206
114
  static
207
- VALUE get_title(VALUE self)
115
+ VALUE get_bounds(VALUE self)
208
116
  {
209
117
  CHECK;
210
- String s;
211
- if (!this->get_title(&s))
212
- system_error("failed to get title of window.");
213
- return value(s.c_str());
118
+ return value(THIS->bounds());
214
119
  }
215
120
 
216
121
  static
217
- VALUE set_title(VALUE self, VALUE title)
122
+ VALUE hidden(VALUE self)
218
123
  {
219
124
  CHECK;
220
- if (!this->set_title(title.c_str()))
221
- system_error("failed to set title of window.");
222
- return title;
125
+ return value(THIS->hidden());
223
126
  }
224
127
 
225
128
  static
226
- VALUE get_bounds(VALUE self)
129
+ VALUE root(VALUE self)
227
130
  {
228
131
  CHECK;
229
- coord x = 0, y = 0, width = 0, height = 0;
230
- if (!this->get_bounds(&x, &y, &width, &height))
231
- system_error("failed to get bounds of window.");
232
- Value ret[] = {x, y, width, height};
233
- return value(4, ret);
132
+ return value(THIS->root());
234
133
  }
235
134
 
236
135
  static
237
- VALUE set_bounds(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
136
+ VALUE painter(VALUE self)
238
137
  {
239
138
  CHECK;
240
- if (!this->set_bounds(
241
- to<coord>(x), to<coord>(y), to<coord>(width), to<coord>(height)))
242
- {
243
- system_error("failed to set bounds of window.");
244
- }
245
- Value ret[] = {x, y, width, height};
246
- return value(4, ret);
139
+ return value(THIS->painter());
140
+ }
141
+
142
+ static
143
+ VALUE update(VALUE self, VALUE dt)
144
+ {
145
+ CHECK;
146
+ CALL(update(to<float>(dt)));
147
+ return self;
148
+ }
149
+
150
+ static
151
+ VALUE draw(VALUE self)
152
+ {
153
+ CHECK;
154
+ CALL(draw());
155
+ return self;
247
156
  }
248
157
 
249
158
  static
250
159
  VALUE moved(VALUE self, VALUE x, VALUE y)
251
160
  {
252
161
  CHECK;
253
- this->Super::moved(to<coord>(x), to<coord>(y));
162
+ CALL(moved(to<coord>(x), to<coord>(y)));
254
163
  return self;
255
164
  }
256
165
 
@@ -258,7 +167,7 @@ static
258
167
  VALUE resized(VALUE self, VALUE width, VALUE height)
259
168
  {
260
169
  CHECK;
261
- this->Super::resized(to<coord>(width), to<coord>(height));
170
+ CALL(resized(to<coord>(width), to<coord>(height)));
262
171
  return self;
263
172
  }
264
173
 
@@ -268,7 +177,7 @@ VALUE key_down(VALUE self, VALUE key)
268
177
  CHECK;
269
178
  Reflex::Key* k = to<Reflex::Key*>(key);
270
179
  if (!k) argument_error();
271
- this->Super::key_down(*k);
180
+ CALL(key_down(*k));
272
181
  return self;
273
182
  }
274
183
 
@@ -278,7 +187,7 @@ VALUE key_up(VALUE self, VALUE key)
278
187
  CHECK;
279
188
  Reflex::Key* k = to<Reflex::Key*>(key);
280
189
  if (!k) argument_error();
281
- this->Super::key_up(*k);
190
+ CALL(key_up(*k));
282
191
  return self;
283
192
  }
284
193
 
@@ -288,7 +197,7 @@ VALUE points_down(VALUE self, VALUE points)
288
197
  CHECK;
289
198
  Reflex::Points* p = to<Reflex::Points*>(points);
290
199
  if (!p) argument_error();
291
- this->Super::points_down(*p);
200
+ CALL(points_down(*p));
292
201
  return self;
293
202
  }
294
203
 
@@ -298,7 +207,7 @@ VALUE points_up(VALUE self, VALUE points)
298
207
  CHECK;
299
208
  Reflex::Points* p = to<Reflex::Points*>(points);
300
209
  if (!p) argument_error();
301
- this->Super::points_up(*p);
210
+ CALL(points_up(*p));
302
211
  return self;
303
212
  }
304
213
 
@@ -308,7 +217,7 @@ VALUE points_moved(VALUE self, VALUE points)
308
217
  CHECK;
309
218
  Reflex::Points* p = to<Reflex::Points*>(points);
310
219
  if (!p) argument_error();
311
- this->Super::points_moved(*p);
220
+ CALL(points_moved(*p));
312
221
  return self;
313
222
  }
314
223
 
@@ -316,28 +225,28 @@ VALUE points_moved(VALUE self, VALUE points)
316
225
  void
317
226
  Init_window ()
318
227
  {
319
- Module m = rb_define_module("Reflex");
320
-
321
- Class c = rb_define_class_under(m, "Window", rb_cObject);
322
- Reflex::cWindow = c;
323
-
324
- rb_define_alloc_func(c, alloc);
325
- rb_define_method(c, "close", RUBY_METHOD_FUNC(close), 0);
326
- rb_define_method(c, "show", RUBY_METHOD_FUNC(show), 0);
327
- rb_define_method(c, "hide", RUBY_METHOD_FUNC(hide), 0);
328
- rb_define_method(c, "hidden", RUBY_METHOD_FUNC(hidden), 0);
329
- rb_define_method(c, "update", RUBY_METHOD_FUNC(update), 0);
330
- rb_define_method(c, "draw", RUBY_METHOD_FUNC(draw), 0);
331
- rb_define_method(c, "redraw", RUBY_METHOD_FUNC(redraw), 0);
332
- rb_define_method(c, "title", RUBY_METHOD_FUNC(get_title), 0);
333
- rb_define_method(c, "title=", RUBY_METHOD_FUNC(set_title), 1);
334
- rb_define_private_method(c, "get_bounds", RUBY_METHOD_FUNC(get_bounds), 0);
335
- rb_define_private_method(c, "set_bounds", RUBY_METHOD_FUNC(set_bounds), 4);
336
- rb_define_method(c, "moved", RUBY_METHOD_FUNC(moved), 2);
337
- rb_define_method(c, "resized", RUBY_METHOD_FUNC(resized), 2);
338
- rb_define_method(c, "key_down", RUBY_METHOD_FUNC(key_down), 1);
339
- rb_define_method(c, "key_up", RUBY_METHOD_FUNC(key_up), 1);
340
- rb_define_method(c, "points_down", RUBY_METHOD_FUNC(points_down), 1);
341
- rb_define_method(c, "points_up", RUBY_METHOD_FUNC(points_up), 1);
342
- rb_define_method(c, "points_moved", RUBY_METHOD_FUNC(points_moved), 1);
228
+ Module mReflex = rb_define_module("Reflex");
229
+
230
+ cWindow = rb_define_class_under(mReflex, "Window", rb_cObject);
231
+ rb_define_alloc_func(cWindow, alloc);
232
+ rb_define_method(cWindow, "close", RUBY_METHOD_FUNC(close), 0);
233
+ rb_define_method(cWindow, "show", RUBY_METHOD_FUNC(show), 0);
234
+ rb_define_method(cWindow, "hide", RUBY_METHOD_FUNC(hide), 0);
235
+ rb_define_method(cWindow, "redraw", RUBY_METHOD_FUNC(redraw), 0);
236
+ rb_define_method(cWindow, "title=", RUBY_METHOD_FUNC(set_title), 1);
237
+ rb_define_method(cWindow, "title", RUBY_METHOD_FUNC(get_title), 0);
238
+ rb_define_private_method(cWindow, "set_bounds", RUBY_METHOD_FUNC(set_bounds), 4);
239
+ rb_define_private_method(cWindow, "get_bounds", RUBY_METHOD_FUNC(get_bounds), 0);
240
+ rb_define_method(cWindow, "hidden", RUBY_METHOD_FUNC(hidden), 0);
241
+ rb_define_method(cWindow, "root", RUBY_METHOD_FUNC(root), 0);
242
+ rb_define_method(cWindow, "painter", RUBY_METHOD_FUNC(painter), 0);
243
+ rb_define_method(cWindow, "update", RUBY_METHOD_FUNC(update), 1);
244
+ rb_define_method(cWindow, "draw", RUBY_METHOD_FUNC(draw), 0);
245
+ rb_define_method(cWindow, "moved", RUBY_METHOD_FUNC(moved), 2);
246
+ rb_define_method(cWindow, "resized", RUBY_METHOD_FUNC(resized), 2);
247
+ rb_define_method(cWindow, "key_down", RUBY_METHOD_FUNC(key_down), 1);
248
+ rb_define_method(cWindow, "key_up", RUBY_METHOD_FUNC(key_up), 1);
249
+ rb_define_method(cWindow, "points_down", RUBY_METHOD_FUNC(points_down), 1);
250
+ rb_define_method(cWindow, "points_up", RUBY_METHOD_FUNC(points_up), 1);
251
+ rb_define_method(cWindow, "points_moved", RUBY_METHOD_FUNC(points_moved), 1);
343
252
  }
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ *.o
2
+ *.so
3
+ *.bundle
4
+ *.dll.a
5
+ *.gem
6
+ *.log
7
+ *.rdoc.cpp
8
+ *~
9
+ lib/*.a
10
+ .doc
11
+ .yardoc
12
+ .DS_Store
13
+ Makefile
14
+ depend.mf