reflexion 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.doc/ext/reflex/application.cpp +54 -39
- data/.doc/ext/reflex/capture_event.cpp +87 -0
- data/.doc/ext/reflex/draw_event.cpp +103 -0
- data/.doc/ext/reflex/event.cpp +73 -0
- data/.doc/ext/reflex/focus_event.cpp +98 -0
- data/.doc/ext/reflex/frame_event.cpp +133 -0
- data/.doc/ext/reflex/image_view.cpp +74 -0
- data/.doc/ext/reflex/key_event.cpp +124 -0
- data/.doc/ext/reflex/native.cpp +45 -6
- data/.doc/ext/reflex/pointer_event.cpp +181 -0
- data/.doc/ext/reflex/reflex.cpp +17 -41
- data/.doc/ext/reflex/scroll_event.cpp +141 -0
- data/.doc/ext/reflex/selector.cpp +135 -0
- data/.doc/ext/reflex/style.cpp +253 -0
- data/.doc/ext/reflex/style_length.cpp +133 -0
- data/.doc/ext/reflex/style_length2.cpp +149 -0
- data/.doc/ext/reflex/style_length4.cpp +192 -0
- data/.doc/ext/reflex/update_event.cpp +77 -0
- data/.doc/ext/reflex/view.cpp +408 -88
- data/.doc/ext/reflex/wheel_event.cpp +146 -0
- data/.doc/ext/reflex/window.cpp +95 -92
- data/Rakefile +6 -5
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +67 -49
- data/ext/reflex/capture_event.cpp +92 -0
- data/ext/reflex/draw_event.cpp +110 -0
- data/ext/reflex/event.cpp +77 -0
- data/ext/reflex/extconf.rb +18 -68
- data/ext/reflex/focus_event.cpp +104 -0
- data/ext/reflex/frame_event.cpp +143 -0
- data/ext/reflex/image_view.cpp +77 -0
- data/ext/reflex/key_event.cpp +133 -0
- data/ext/reflex/native.cpp +45 -6
- data/ext/reflex/pointer_event.cpp +195 -0
- data/ext/reflex/reflex.cpp +21 -47
- data/ext/reflex/scroll_event.cpp +152 -0
- data/ext/reflex/selector.cpp +144 -0
- data/ext/reflex/style.cpp +277 -0
- data/ext/reflex/style_length.cpp +140 -0
- data/ext/reflex/style_length2.cpp +157 -0
- data/ext/reflex/style_length4.cpp +204 -0
- data/ext/reflex/update_event.cpp +81 -0
- data/ext/reflex/view.cpp +469 -114
- data/ext/reflex/wheel_event.cpp +158 -0
- data/ext/reflex/window.cpp +130 -123
- data/include/reflex/application.h +12 -7
- data/include/reflex/defs.h +13 -89
- data/include/reflex/event.h +260 -0
- data/include/reflex/exception.h +17 -11
- data/include/reflex/image_view.h +45 -0
- data/include/reflex/reflex.h +2 -6
- data/include/reflex/ruby/application.h +40 -13
- data/include/reflex/ruby/event.h +72 -0
- data/include/reflex/ruby/image_view.h +25 -0
- data/include/reflex/ruby/selector.h +27 -0
- data/include/reflex/ruby/style.h +27 -0
- data/include/reflex/ruby/style_length.h +37 -0
- data/include/reflex/ruby/view.h +193 -38
- data/include/reflex/ruby/window.h +123 -39
- data/include/reflex/ruby.h +3 -2
- data/include/reflex/selector.h +64 -0
- data/include/reflex/style.h +144 -0
- data/include/reflex/style_length.h +147 -0
- data/include/reflex/view.h +182 -19
- data/include/reflex/window.h +35 -19
- data/include/reflex.h +7 -0
- data/lib/reflex/application.rb +14 -5
- data/lib/reflex/arc_shape.rb +20 -0
- data/lib/reflex/button.rb +75 -0
- data/lib/reflex/capture_event.rb +37 -0
- data/lib/reflex/color.rb +13 -0
- data/lib/reflex/color_space.rb +13 -0
- data/lib/reflex/draw_event.rb +19 -0
- data/lib/reflex/ellipse_shape.rb +20 -0
- data/lib/reflex/ext.rb +1 -1
- data/lib/reflex/flags.rb +18 -0
- data/lib/reflex/focus_event.rb +38 -0
- data/lib/reflex/font.rb +13 -0
- data/lib/reflex/frame_event.rb +42 -0
- data/lib/reflex/helper.rb +87 -30
- data/lib/reflex/image_view.rb +25 -0
- data/lib/reflex/key_event.rb +38 -0
- data/lib/reflex/line_shape.rb +20 -0
- data/lib/reflex/list_view.rb +15 -0
- data/lib/reflex/model.rb +149 -0
- data/lib/reflex/model_owner.rb +57 -0
- data/lib/reflex/model_view.rb +22 -0
- data/lib/reflex/module.rb +11 -7
- data/lib/reflex/pointer_event.rb +85 -0
- data/lib/reflex/rect_shape.rb +20 -0
- data/lib/reflex/reflex.rb +13 -2
- data/lib/reflex/scroll_event.rb +19 -0
- data/lib/reflex/selector.rb +31 -0
- data/lib/reflex/shader.rb +13 -0
- data/lib/reflex/shape.rb +34 -0
- data/lib/reflex/style.rb +55 -0
- data/lib/reflex/style_length.rb +30 -0
- data/lib/reflex/style_length2.rb +34 -0
- data/lib/reflex/style_length4.rb +38 -0
- data/lib/reflex/text_view.rb +55 -0
- data/lib/reflex/update_event.rb +19 -0
- data/lib/reflex/view.rb +38 -4
- data/lib/reflex/wheel_event.rb +19 -0
- data/lib/reflex/window.rb +7 -5
- data/lib/reflex.rb +38 -1
- data/lib/reflexion/include.rb +5 -0
- data/lib/reflexion.rb +100 -0
- data/reflex.gemspec +3 -4
- data/samples/app.rb +13 -0
- data/samples/bats.rb +91 -0
- data/samples/checker.rb +36 -0
- data/{examples/ruby/shapes.rb → samples/fans.rb} +12 -16
- data/samples/fps.rb +46 -0
- data/samples/grid.rb +60 -0
- data/{examples/ruby → samples}/hello.rb +14 -16
- data/samples/image.rb +44 -0
- data/samples/ios/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/samples/ios/hello/hello/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/samples/ios/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/ios/hello/hello/hello-Info.plist +47 -0
- data/samples/ios/hello/hello/hello-Prefix.pch +10 -0
- data/samples/ios/hello/hello/main.cpp +79 -0
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/{examples/ruby → samples}/key.rb +11 -14
- data/samples/layout.rb +89 -0
- data/samples/model.rb +86 -0
- data/samples/osx/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/samples/osx/hello/hello/en.lproj/Credits.rtf +29 -0
- data/samples/osx/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/osx/hello/hello/hello-Info.plist +32 -0
- data/samples/osx/hello/hello/hello-Prefix.pch +3 -0
- data/samples/osx/hello/hello/main.cpp +79 -0
- data/samples/osx/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/samples/reflexion/hello.rb +24 -0
- data/samples/reflexion/paint.rb +40 -0
- data/samples/reflexion/pulse.rb +34 -0
- data/samples/repl.rb +69 -0
- data/samples/shader.rb +41 -0
- data/samples/shapes.rb +30 -0
- data/{examples/ruby → samples}/text.rb +7 -8
- data/samples/tree.rb +71 -0
- data/samples/views.rb +41 -0
- data/samples/visuals.rb +22 -0
- data/src/event.cpp +225 -0
- data/src/exception.cpp +24 -15
- data/src/image_view.cpp +70 -0
- data/src/ios/app_delegate.h +17 -0
- data/src/ios/app_delegate.mm +120 -0
- data/src/ios/application.mm +116 -0
- data/src/{cocoa/applicationdata.h → ios/application_data.h} +6 -6
- data/src/ios/event.h +26 -0
- data/src/ios/event.mm +31 -0
- data/src/ios/native_window.h +37 -0
- data/src/ios/native_window.mm +220 -0
- data/src/ios/opengl_view.h +13 -0
- data/src/ios/opengl_view.mm +131 -0
- data/src/{cocoa → ios}/reflex.mm +8 -12
- data/src/ios/window.mm +303 -0
- data/src/ios/window_data.h +75 -0
- data/src/osx/app_delegate.h +17 -0
- data/src/{cocoa/cocoaapplication.mm → osx/app_delegate.mm} +90 -48
- data/src/osx/application.mm +132 -0
- data/src/osx/application_data.h +45 -0
- data/src/osx/event.h +42 -0
- data/src/osx/event.mm +112 -0
- data/src/osx/native_window.h +26 -0
- data/src/osx/native_window.mm +322 -0
- data/src/{cocoa/openglview.h → osx/opengl_view.h} +0 -4
- data/src/{cocoa/openglview.mm → osx/opengl_view.mm} +66 -23
- data/src/osx/reflex.mm +50 -0
- data/src/osx/window.mm +308 -0
- data/src/osx/window_data.h +75 -0
- data/src/selector.cpp +121 -0
- data/src/style.cpp +576 -0
- data/src/style_length.cpp +341 -0
- data/src/view.cpp +1228 -129
- data/src/win32/application.cpp +1 -1
- data/src/window.cpp +54 -26
- data/test/helper.rb +8 -4
- data/test/test_capture_event.rb +41 -0
- data/test/test_event.rb +20 -0
- data/test/test_has_frame.rb +45 -0
- data/test/test_model.rb +9 -0
- data/test/test_model_owner.rb +9 -0
- data/test/test_selector.rb +75 -0
- data/test/test_style.rb +70 -0
- data/test/test_style_length.rb +38 -0
- data/test/test_style_length2.rb +50 -0
- data/test/test_style_length4.rb +56 -0
- data/test/test_view.rb +97 -23
- data/test/test_window.rb +54 -46
- metadata +205 -84
- data/.doc/ext/reflex/defs.cpp +0 -8
- data/.doc/ext/reflex/key.cpp +0 -122
- data/.doc/ext/reflex/points.cpp +0 -151
- data/.gitignore +0 -14
- data/ChangeLog +0 -8
- data/examples/hello/.gitignore +0 -2
- data/examples/hello/Rakefile +0 -41
- data/examples/hello/main.cpp +0 -18
- data/examples/ruby/app.rb +0 -13
- data/examples/ruby/checker.rb +0 -41
- data/examples/ruby/fps.rb +0 -49
- data/examples/ruby/grid.rb +0 -65
- data/examples/ruby/views.rb +0 -88
- data/examples/ruby/visuals.rb +0 -27
- data/ext/reflex/defs.cpp +0 -8
- data/ext/reflex/key.cpp +0 -129
- data/ext/reflex/points.cpp +0 -161
- data/include/reflex/ruby/key.h +0 -39
- data/include/reflex/ruby/points.h +0 -39
- data/lib/reflex/visuals/string.rb +0 -53
- data/src/cocoa/application.mm +0 -101
- data/src/cocoa/cocoaapplication.h +0 -21
- data/src/cocoa/cocoawindow.h +0 -46
- data/src/cocoa/cocoawindow.mm +0 -230
- data/src/cocoa/defs.h +0 -34
- data/src/cocoa/defs.mm +0 -87
- data/src/cocoa/window.mm +0 -148
- data/src/cocoa/windowdata.h +0 -56
- data/src/defs.cpp +0 -47
- data/src/helper.h +0 -12
- data/src/reflex.cpp +0 -43
- /data/{README → README.md} +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4ab611843e39083046757ad8be7974cf3f08802b
|
4
|
+
data.tar.gz: 348a2e5773ec70a2a5215e3bc8783aead028a7d3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d1a4456dcf74b5d765fcc6819f2fe19a0d1a6bfc39bc610ff1e4d82f73cc23384f6f89fa735eb27c671b1cbc76f208326ecc1fcd63a5f70fe86986cb42ab594b
|
7
|
+
data.tar.gz: d52e858d9aa75386455b8f262bdc7666c92d3481dd9bd2ea7f3b55b5b3d3f9b8c9054e7cd5cd454ec77cf66aac52a3e452ebf1c415558377175c2ebeb2552b6e
|
@@ -10,43 +10,26 @@ using namespace Rucy;
|
|
10
10
|
|
11
11
|
static Class cApplication;
|
12
12
|
|
13
|
-
|
14
|
-
namespace Reflex
|
15
|
-
{
|
16
|
-
|
17
|
-
|
18
|
-
Class
|
19
|
-
application_class ()
|
20
|
-
{
|
21
|
-
return cApplication;
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
}// Reflex
|
26
|
-
|
27
|
-
|
28
|
-
typedef Reflex::RubyApplication<Reflex::Application> RubyApplication;
|
29
|
-
|
13
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Application, cApplication)
|
30
14
|
|
31
15
|
#define THIS to<Reflex::Application*>(self)
|
32
16
|
|
33
|
-
#define CHECK RUCY_CHECK_OBJECT(
|
17
|
+
#define CHECK RUCY_CHECK_OBJECT(Reflex::Application, cApplication, self)
|
34
18
|
|
35
|
-
#define CALL(fun) RUCY_WRAPPER_CALL(
|
19
|
+
#define CALL(fun) RUCY_WRAPPER_CALL(Reflex::Application, THIS, fun)
|
36
20
|
|
37
21
|
|
38
22
|
static
|
39
23
|
VALUE alloc(VALUE klass)
|
40
24
|
{
|
41
|
-
return value(new RubyApplication
|
25
|
+
return value(new Reflex::RubyApplication<Reflex::Application>, klass);
|
42
26
|
}
|
43
27
|
|
44
28
|
static
|
45
|
-
VALUE
|
29
|
+
VALUE start(VALUE self)
|
46
30
|
{
|
47
31
|
CHECK;
|
48
|
-
|
49
|
-
system_error("failed to run application.");
|
32
|
+
CALL(start());
|
50
33
|
return self;
|
51
34
|
}
|
52
35
|
|
@@ -54,36 +37,51 @@ static
|
|
54
37
|
VALUE quit(VALUE self)
|
55
38
|
{
|
56
39
|
CHECK;
|
57
|
-
|
58
|
-
system_error("failed to quit application.");
|
40
|
+
CALL(quit());
|
59
41
|
return self;
|
60
42
|
}
|
61
43
|
|
62
44
|
static
|
63
|
-
VALUE
|
45
|
+
VALUE set_name(VALUE self, VALUE name)
|
64
46
|
{
|
65
47
|
CHECK;
|
66
|
-
|
67
|
-
|
68
|
-
return self;
|
48
|
+
THIS->set_name(name.c_str());
|
49
|
+
return name;
|
69
50
|
}
|
70
51
|
|
71
52
|
static
|
72
|
-
VALUE
|
53
|
+
VALUE get_name(VALUE self)
|
73
54
|
{
|
74
55
|
CHECK;
|
75
|
-
|
76
|
-
system_error("failed to set name of application.");
|
77
|
-
return name;
|
56
|
+
return value(THIS->name());
|
78
57
|
}
|
79
58
|
|
80
59
|
static
|
81
|
-
VALUE
|
60
|
+
VALUE on_start(VALUE self, VALUE event)
|
61
|
+
{
|
62
|
+
CHECK;
|
63
|
+
CALL(on_start(to<Reflex::Event*>(event)));
|
64
|
+
}
|
65
|
+
|
66
|
+
static
|
67
|
+
VALUE on_quit(VALUE self, VALUE event)
|
68
|
+
{
|
69
|
+
CHECK;
|
70
|
+
CALL(on_quit(to<Reflex::Event*>(event)));
|
71
|
+
}
|
72
|
+
|
73
|
+
static
|
74
|
+
VALUE on_preference(VALUE self, VALUE event)
|
82
75
|
{
|
83
76
|
CHECK;
|
84
|
-
|
85
|
-
|
86
|
-
|
77
|
+
CALL(on_preference(to<Reflex::Event*>(event)));
|
78
|
+
}
|
79
|
+
|
80
|
+
static
|
81
|
+
VALUE on_about(VALUE self, VALUE event)
|
82
|
+
{
|
83
|
+
CHECK;
|
84
|
+
CALL(on_about(to<Reflex::Event*>(event)));
|
87
85
|
}
|
88
86
|
|
89
87
|
static
|
@@ -100,10 +98,27 @@ Init_application ()
|
|
100
98
|
|
101
99
|
cApplication = rb_define_class_under(mReflex, "Application", rb_cObject);
|
102
100
|
rb_define_alloc_func(cApplication, alloc);
|
103
|
-
rb_define_method(cApplication, "
|
101
|
+
rb_define_method(cApplication, "start", RUBY_METHOD_FUNC(start), 0);
|
104
102
|
rb_define_method(cApplication, "quit", RUBY_METHOD_FUNC(quit), 0);
|
105
|
-
rb_define_method(cApplication, "about", RUBY_METHOD_FUNC(about), 0);
|
106
103
|
rb_define_method(cApplication, "name=", RUBY_METHOD_FUNC(set_name), 1);
|
107
104
|
rb_define_method(cApplication, "name", RUBY_METHOD_FUNC(get_name), 0);
|
105
|
+
rb_define_method(cApplication, "on_start", RUBY_METHOD_FUNC(on_start), 1);
|
106
|
+
rb_define_method(cApplication, "on_quit", RUBY_METHOD_FUNC(on_quit), 1);
|
107
|
+
rb_define_method(cApplication, "on_preference", RUBY_METHOD_FUNC(on_preference), 1);
|
108
|
+
rb_define_method(cApplication, "on_about", RUBY_METHOD_FUNC(on_about), 1);
|
108
109
|
rb_define_singleton_method(cApplication, "instance", RUBY_METHOD_FUNC(instance), 0);
|
109
110
|
}
|
111
|
+
|
112
|
+
|
113
|
+
namespace Reflex
|
114
|
+
{
|
115
|
+
|
116
|
+
|
117
|
+
Class
|
118
|
+
application_class ()
|
119
|
+
{
|
120
|
+
return cApplication;
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
}// Reflex
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#include "reflex/ruby/event.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rucy.h>
|
5
|
+
#include "rays/ruby/point.h"
|
6
|
+
#include "defs.h"
|
7
|
+
|
8
|
+
|
9
|
+
using namespace Rucy;
|
10
|
+
|
11
|
+
|
12
|
+
static Class cCaptureEvent;
|
13
|
+
|
14
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::CaptureEvent, cCaptureEvent)
|
15
|
+
|
16
|
+
#define THIS to<Reflex::CaptureEvent*>(self)
|
17
|
+
|
18
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::CaptureEvent, cCaptureEvent, self)
|
19
|
+
|
20
|
+
|
21
|
+
static
|
22
|
+
VALUE alloc(VALUE klass)
|
23
|
+
{
|
24
|
+
return new_type<Reflex::CaptureEvent>(klass);
|
25
|
+
}
|
26
|
+
|
27
|
+
static
|
28
|
+
VALUE initialize(VALUE self)
|
29
|
+
{
|
30
|
+
CHECK;
|
31
|
+
check_arg_count(__FILE__, __LINE__, "CaptureEvent#initialize", argc, 0, 1, 2);
|
32
|
+
|
33
|
+
THIS->begin = (argc >= 1) ? to<uint>(argv[0]) : 0;
|
34
|
+
THIS->end = (argc >= 2) ? to<uint>(argv[1]) : 0;
|
35
|
+
|
36
|
+
return rb_call_super(0, NULL);
|
37
|
+
}
|
38
|
+
|
39
|
+
static
|
40
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
41
|
+
{
|
42
|
+
CHECK;
|
43
|
+
*THIS = to<Reflex::CaptureEvent&>(obj);
|
44
|
+
return self;
|
45
|
+
}
|
46
|
+
|
47
|
+
static
|
48
|
+
VALUE begin(VALUE self)
|
49
|
+
{
|
50
|
+
CHECK;
|
51
|
+
return value(THIS->begin);
|
52
|
+
}
|
53
|
+
|
54
|
+
static
|
55
|
+
VALUE end(VALUE self)
|
56
|
+
{
|
57
|
+
CHECK;
|
58
|
+
return value(THIS->end);
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
void
|
63
|
+
Init_capture_event ()
|
64
|
+
{
|
65
|
+
Module mReflex = rb_define_module("Reflex");
|
66
|
+
|
67
|
+
cCaptureEvent = mReflex.define_class("CaptureEvent", Reflex::event_class());
|
68
|
+
rb_define_alloc_func(cCaptureEvent, alloc);
|
69
|
+
rb_define_private_method(cCaptureEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
|
70
|
+
rb_define_private_method(cCaptureEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
71
|
+
rb_define_private_method(cCaptureEvent, "get_begin", RUBY_METHOD_FUNC(begin), 0);
|
72
|
+
rb_define_private_method(cCaptureEvent, "get_end", RUBY_METHOD_FUNC(end), 0);
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
namespace Reflex
|
77
|
+
{
|
78
|
+
|
79
|
+
|
80
|
+
Class
|
81
|
+
capture_event_class ()
|
82
|
+
{
|
83
|
+
return cCaptureEvent;
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
}// Reflex
|
@@ -0,0 +1,103 @@
|
|
1
|
+
#include "reflex/ruby/event.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rucy.h>
|
5
|
+
#include <rays/ruby/painter.h>
|
6
|
+
#include <rays/ruby/bounds.h>
|
7
|
+
#include "defs.h"
|
8
|
+
|
9
|
+
|
10
|
+
using namespace Rucy;
|
11
|
+
|
12
|
+
|
13
|
+
static Class cDrawEvent;
|
14
|
+
|
15
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::DrawEvent, cDrawEvent)
|
16
|
+
|
17
|
+
#define THIS to<Reflex::DrawEvent*>(self)
|
18
|
+
|
19
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::DrawEvent, cDrawEvent, self)
|
20
|
+
|
21
|
+
|
22
|
+
static
|
23
|
+
VALUE alloc(VALUE klass)
|
24
|
+
{
|
25
|
+
return new_type<Reflex::DrawEvent>(klass);
|
26
|
+
}
|
27
|
+
|
28
|
+
static
|
29
|
+
VALUE initialize(VALUE self)
|
30
|
+
{
|
31
|
+
CHECK;
|
32
|
+
check_arg_count(__FILE__, __LINE__, "DrawEvent#initialize", argc, 0, 1);
|
33
|
+
|
34
|
+
THIS->dt = (argc >= 1) ? argv[0].as_f() : 0;
|
35
|
+
|
36
|
+
return rb_call_super(0, NULL);
|
37
|
+
}
|
38
|
+
|
39
|
+
static
|
40
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
41
|
+
{
|
42
|
+
CHECK;
|
43
|
+
*THIS = to<Reflex::DrawEvent&>(obj);
|
44
|
+
return self;
|
45
|
+
}
|
46
|
+
|
47
|
+
static
|
48
|
+
VALUE painter(VALUE self)
|
49
|
+
{
|
50
|
+
CHECK;
|
51
|
+
return value(THIS->painter);
|
52
|
+
}
|
53
|
+
|
54
|
+
static
|
55
|
+
VALUE bounds(VALUE self)
|
56
|
+
{
|
57
|
+
CHECK;
|
58
|
+
return value(THIS->bounds);
|
59
|
+
}
|
60
|
+
|
61
|
+
static
|
62
|
+
VALUE dt(VALUE self)
|
63
|
+
{
|
64
|
+
CHECK;
|
65
|
+
return value(THIS->dt);
|
66
|
+
}
|
67
|
+
|
68
|
+
static
|
69
|
+
VALUE fps(VALUE self)
|
70
|
+
{
|
71
|
+
CHECK;
|
72
|
+
return value(THIS->fps);
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
void
|
77
|
+
Init_draw_event ()
|
78
|
+
{
|
79
|
+
Module mReflex = rb_define_module("Reflex");
|
80
|
+
|
81
|
+
cDrawEvent = mReflex.define_class("DrawEvent", Reflex::event_class());
|
82
|
+
rb_define_alloc_func(cDrawEvent, alloc);
|
83
|
+
rb_define_private_method(cDrawEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
|
84
|
+
rb_define_private_method(cDrawEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
85
|
+
rb_define_method(cDrawEvent, "painter", RUBY_METHOD_FUNC(painter), 0);
|
86
|
+
rb_define_method(cDrawEvent, "bounds", RUBY_METHOD_FUNC(bounds), 0);
|
87
|
+
rb_define_method(cDrawEvent, "dt", RUBY_METHOD_FUNC(dt), 0);
|
88
|
+
rb_define_method(cDrawEvent, "fps", RUBY_METHOD_FUNC(fps), 0);
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
namespace Reflex
|
93
|
+
{
|
94
|
+
|
95
|
+
|
96
|
+
Class
|
97
|
+
draw_event_class ()
|
98
|
+
{
|
99
|
+
return cDrawEvent;
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
}// Reflex
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#include "reflex/ruby/event.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rucy.h>
|
5
|
+
#include "defs.h"
|
6
|
+
|
7
|
+
|
8
|
+
using namespace Rucy;
|
9
|
+
|
10
|
+
|
11
|
+
static Class cEvent;
|
12
|
+
|
13
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::Event, cEvent)
|
14
|
+
|
15
|
+
#define THIS to<Reflex::Event*>(self)
|
16
|
+
|
17
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::Event, cEvent, self)
|
18
|
+
|
19
|
+
|
20
|
+
static
|
21
|
+
VALUE alloc(VALUE klass)
|
22
|
+
{
|
23
|
+
return new_type<Reflex::Event>(klass);
|
24
|
+
}
|
25
|
+
|
26
|
+
static
|
27
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
28
|
+
{
|
29
|
+
CHECK;
|
30
|
+
*THIS = to<Reflex::Event&>(obj);
|
31
|
+
return self;
|
32
|
+
}
|
33
|
+
|
34
|
+
static
|
35
|
+
VALUE block(VALUE self)
|
36
|
+
{
|
37
|
+
CHECK;
|
38
|
+
THIS->block();
|
39
|
+
}
|
40
|
+
|
41
|
+
static
|
42
|
+
VALUE is_blocked(VALUE self)
|
43
|
+
{
|
44
|
+
CHECK;
|
45
|
+
return value(THIS->is_blocked());
|
46
|
+
}
|
47
|
+
|
48
|
+
|
49
|
+
void
|
50
|
+
Init_event ()
|
51
|
+
{
|
52
|
+
Module mReflex = rb_define_module("Reflex");
|
53
|
+
|
54
|
+
cEvent = rb_define_class_under(mReflex, "Event", rb_cObject);
|
55
|
+
rb_define_alloc_func(cEvent, alloc);
|
56
|
+
rb_define_private_method(cEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
57
|
+
rb_define_method(cEvent, "block", RUBY_METHOD_FUNC(block), 0);
|
58
|
+
cEvent.define_method("block?", is_blocked);
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
namespace Reflex
|
63
|
+
{
|
64
|
+
|
65
|
+
|
66
|
+
Class
|
67
|
+
event_class ()
|
68
|
+
{
|
69
|
+
return cEvent;
|
70
|
+
}
|
71
|
+
|
72
|
+
|
73
|
+
}// Reflex
|
@@ -0,0 +1,98 @@
|
|
1
|
+
#include "reflex/ruby/event.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rucy.h>
|
5
|
+
#include "reflex/ruby/view.h"
|
6
|
+
#include "defs.h"
|
7
|
+
|
8
|
+
|
9
|
+
using namespace Rucy;
|
10
|
+
|
11
|
+
|
12
|
+
static Class cFocusEvent;
|
13
|
+
|
14
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::FocusEvent, cFocusEvent)
|
15
|
+
|
16
|
+
#define THIS to<Reflex::FocusEvent*>(self)
|
17
|
+
|
18
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::FocusEvent, cFocusEvent, self)
|
19
|
+
|
20
|
+
|
21
|
+
static
|
22
|
+
VALUE alloc(VALUE klass)
|
23
|
+
{
|
24
|
+
return new_type<Reflex::FocusEvent>(klass);
|
25
|
+
}
|
26
|
+
|
27
|
+
static
|
28
|
+
VALUE initialize(VALUE self, VALUE type, VALUE focus, VALUE last)
|
29
|
+
{
|
30
|
+
CHECK;
|
31
|
+
|
32
|
+
THIS->focus = to<Reflex::View*>(focus);
|
33
|
+
THIS->focus = to<Reflex::View*>(focus);
|
34
|
+
THIS->last = to<Reflex::View*>(last);
|
35
|
+
|
36
|
+
return rb_call_super(0, NULL);
|
37
|
+
}
|
38
|
+
|
39
|
+
static
|
40
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
41
|
+
{
|
42
|
+
CHECK;
|
43
|
+
*THIS = to<Reflex::FocusEvent&>(obj);
|
44
|
+
return self;
|
45
|
+
}
|
46
|
+
|
47
|
+
static
|
48
|
+
VALUE get_type(VALUE self)
|
49
|
+
{
|
50
|
+
CHECK;
|
51
|
+
return value(THIS->type);
|
52
|
+
}
|
53
|
+
|
54
|
+
static
|
55
|
+
VALUE focus(VALUE self)
|
56
|
+
{
|
57
|
+
CHECK;
|
58
|
+
return THIS->focus ? value(THIS->focus) : nil();
|
59
|
+
}
|
60
|
+
|
61
|
+
static
|
62
|
+
VALUE last(VALUE self)
|
63
|
+
{
|
64
|
+
CHECK;
|
65
|
+
return THIS->last ? value(THIS->last) : nil();
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
void
|
70
|
+
Init_focus_event ()
|
71
|
+
{
|
72
|
+
Module mReflex = rb_define_module("Reflex");
|
73
|
+
|
74
|
+
cFocusEvent = mReflex.define_class("FocusEvent", Reflex::event_class());
|
75
|
+
rb_define_alloc_func(cFocusEvent, alloc);
|
76
|
+
rb_define_private_method(cFocusEvent, "initialize", RUBY_METHOD_FUNC(initialize), 3);
|
77
|
+
rb_define_private_method(cFocusEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
78
|
+
rb_define_method(cFocusEvent, "get_type", RUBY_METHOD_FUNC(get_type), 0);
|
79
|
+
rb_define_method(cFocusEvent, "focus", RUBY_METHOD_FUNC(focus), 0);
|
80
|
+
rb_define_method(cFocusEvent, "last", RUBY_METHOD_FUNC(last), 0);
|
81
|
+
cFocusEvent.define_const("TYPE_NONE", Reflex::FocusEvent::NONE);
|
82
|
+
cFocusEvent.define_const("TYPE_FOCUS", Reflex::FocusEvent::FOCUS);
|
83
|
+
cFocusEvent.define_const("TYPE_BLUR", Reflex::FocusEvent::BLUR);
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
namespace Reflex
|
88
|
+
{
|
89
|
+
|
90
|
+
|
91
|
+
Class
|
92
|
+
focus_event_class ()
|
93
|
+
{
|
94
|
+
return cFocusEvent;
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
}// Reflex
|
@@ -0,0 +1,133 @@
|
|
1
|
+
#include "reflex/ruby/event.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rucy.h>
|
5
|
+
#include "rays/ruby/point.h"
|
6
|
+
#include "rays/ruby/bounds.h"
|
7
|
+
#include "defs.h"
|
8
|
+
|
9
|
+
|
10
|
+
using namespace Rucy;
|
11
|
+
|
12
|
+
using Reflex::coord;
|
13
|
+
|
14
|
+
|
15
|
+
static Class cFrameEvent;
|
16
|
+
|
17
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::FrameEvent, cFrameEvent)
|
18
|
+
|
19
|
+
#define THIS to<Reflex::FrameEvent*>(self)
|
20
|
+
|
21
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::FrameEvent, cFrameEvent, self)
|
22
|
+
|
23
|
+
|
24
|
+
static
|
25
|
+
VALUE alloc(VALUE klass)
|
26
|
+
{
|
27
|
+
return new_type<Reflex::FrameEvent>(klass);
|
28
|
+
}
|
29
|
+
|
30
|
+
static
|
31
|
+
VALUE initialize(VALUE self)
|
32
|
+
{
|
33
|
+
CHECK;
|
34
|
+
check_arg_count(__FILE__, __LINE__, "FrameEvent#initialize", argc, 0, 1, 2, 3, 4, 5);
|
35
|
+
|
36
|
+
THIS->frame = (argc >= 1) ? to<Rays::Bounds&>(argv[0]) : Rays::Bounds(0);
|
37
|
+
THIS->dx = (argc >= 2) ? to<coord>(argv[1]) : 0;
|
38
|
+
THIS->dy = (argc >= 3) ? to<coord>(argv[2]) : 0;
|
39
|
+
THIS->dwidth = (argc >= 4) ? to<coord>(argv[3]) : 0;
|
40
|
+
THIS->dheight = (argc >= 5) ? to<coord>(argv[4]) : 0;
|
41
|
+
|
42
|
+
return rb_call_super(0, NULL);
|
43
|
+
}
|
44
|
+
|
45
|
+
static
|
46
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
47
|
+
{
|
48
|
+
CHECK;
|
49
|
+
*THIS = to<Reflex::FrameEvent&>(obj);
|
50
|
+
return self;
|
51
|
+
}
|
52
|
+
|
53
|
+
static
|
54
|
+
VALUE frame(VALUE self)
|
55
|
+
{
|
56
|
+
CHECK;
|
57
|
+
return value(THIS->frame);
|
58
|
+
}
|
59
|
+
|
60
|
+
static
|
61
|
+
VALUE dx(VALUE self)
|
62
|
+
{
|
63
|
+
CHECK;
|
64
|
+
return value(THIS->dx);
|
65
|
+
}
|
66
|
+
|
67
|
+
static
|
68
|
+
VALUE dy(VALUE self)
|
69
|
+
{
|
70
|
+
CHECK;
|
71
|
+
return value(THIS->dy);
|
72
|
+
}
|
73
|
+
|
74
|
+
static
|
75
|
+
VALUE dwidth(VALUE self)
|
76
|
+
{
|
77
|
+
CHECK;
|
78
|
+
return value(THIS->dwidth);
|
79
|
+
}
|
80
|
+
|
81
|
+
static
|
82
|
+
VALUE dheight(VALUE self)
|
83
|
+
{
|
84
|
+
CHECK;
|
85
|
+
return value(THIS->dheight);
|
86
|
+
}
|
87
|
+
|
88
|
+
static
|
89
|
+
VALUE dposition(VALUE self)
|
90
|
+
{
|
91
|
+
CHECK;
|
92
|
+
return value(Rays::Point(THIS->dx, THIS->dy));
|
93
|
+
}
|
94
|
+
|
95
|
+
static
|
96
|
+
VALUE dsize(VALUE self)
|
97
|
+
{
|
98
|
+
CHECK;
|
99
|
+
return value(Rays::Point(THIS->dw, THIS->dh));
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
void
|
104
|
+
Init_frame_event ()
|
105
|
+
{
|
106
|
+
Module mReflex = rb_define_module("Reflex");
|
107
|
+
|
108
|
+
cFrameEvent = mReflex.define_class("FrameEvent", Reflex::event_class());
|
109
|
+
rb_define_alloc_func(cFrameEvent, alloc);
|
110
|
+
rb_define_private_method(cFrameEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
|
111
|
+
rb_define_private_method(cFrameEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
112
|
+
rb_define_method(cFrameEvent, "frame", RUBY_METHOD_FUNC(frame), 0);
|
113
|
+
rb_define_method(cFrameEvent, "dx", RUBY_METHOD_FUNC(dx), 0);
|
114
|
+
rb_define_method(cFrameEvent, "dy", RUBY_METHOD_FUNC(dy), 0);
|
115
|
+
rb_define_method(cFrameEvent, "dwidth", RUBY_METHOD_FUNC(dwidth), 0);
|
116
|
+
rb_define_method(cFrameEvent, "dheight", RUBY_METHOD_FUNC(dheight), 0);
|
117
|
+
rb_define_method(cFrameEvent, "dposition", RUBY_METHOD_FUNC(dposition), 0);
|
118
|
+
rb_define_method(cFrameEvent, "dsize", RUBY_METHOD_FUNC(dsize), 0);
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
namespace Reflex
|
123
|
+
{
|
124
|
+
|
125
|
+
|
126
|
+
Class
|
127
|
+
frame_event_class ()
|
128
|
+
{
|
129
|
+
return cFrameEvent;
|
130
|
+
}
|
131
|
+
|
132
|
+
|
133
|
+
}// Reflex
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#include "reflex/ruby/image_view.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rucy.h>
|
5
|
+
#include "reflex/ruby/view.h"
|
6
|
+
|
7
|
+
|
8
|
+
using namespace Rucy;
|
9
|
+
|
10
|
+
using Reflex::coord;
|
11
|
+
|
12
|
+
|
13
|
+
static Class cImageView;
|
14
|
+
|
15
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::ImageView, cImageView)
|
16
|
+
|
17
|
+
#define THIS to<Reflex::ImageView*>(self)
|
18
|
+
|
19
|
+
#define CHECK RUCY_CHECK_OBJECT(Reflex::ImageView, cImageView, self)
|
20
|
+
|
21
|
+
#define CALL(fun) RUCY_WRAPPER_CALL(Reflex::ImageView, THIS, fun)
|
22
|
+
|
23
|
+
|
24
|
+
static
|
25
|
+
VALUE alloc(VALUE klass)
|
26
|
+
{
|
27
|
+
return value(new Reflex::RubyView<Reflex::ImageView>, klass);
|
28
|
+
}
|
29
|
+
|
30
|
+
static
|
31
|
+
VALUE get_image(VALUE self)
|
32
|
+
{
|
33
|
+
CHECK;
|
34
|
+
Rays::Image image = THIS->get_image();
|
35
|
+
return image ? value(image) : nil();
|
36
|
+
}
|
37
|
+
|
38
|
+
static
|
39
|
+
VALUE set_image(VALUE self, VALUE image)
|
40
|
+
{
|
41
|
+
CHECK;
|
42
|
+
THIS->set_image(image ? to<Rays::Image&>(image) : Rays::Image());
|
43
|
+
return image;
|
44
|
+
}
|
45
|
+
|
46
|
+
static
|
47
|
+
RUCY_DEF_clear_override_flags(cof, Reflex::ImageView, cImageView);
|
48
|
+
|
49
|
+
|
50
|
+
void
|
51
|
+
Init_image_view ()
|
52
|
+
{
|
53
|
+
Module mReflex = rb_define_module("Reflex");
|
54
|
+
|
55
|
+
cImageView = mReflex.define_class("ImageView", Reflex::view_class());
|
56
|
+
rb_define_alloc_func(cImageView, alloc);
|
57
|
+
rb_define_private_method(cImageView, "set_image", RUBY_METHOD_FUNC(set_image), 1);
|
58
|
+
rb_define_method(cImageView, "image", RUBY_METHOD_FUNC(get_image), 0);
|
59
|
+
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
namespace Reflex
|
64
|
+
{
|
65
|
+
|
66
|
+
|
67
|
+
Class
|
68
|
+
image_view_class ()
|
69
|
+
{
|
70
|
+
return cImageView;
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
}// Reflex
|