reflexion 0.5.2 → 0.6.0
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 +19 -1
- data/.doc/ext/reflex/chase_constraint.cpp +84 -0
- data/.doc/ext/reflex/clipboard.cpp +65 -0
- data/.doc/ext/reflex/constraint.cpp +135 -0
- data/.doc/ext/reflex/key_event.cpp +6 -6
- data/.doc/ext/reflex/link_constraint.cpp +178 -0
- data/.doc/ext/reflex/menu.cpp +302 -0
- data/.doc/ext/reflex/native.cpp +22 -4
- data/.doc/ext/reflex/pin.cpp +156 -0
- data/.doc/ext/reflex/pointer.cpp +2 -0
- data/.doc/ext/reflex/pointer_event.cpp +1 -1
- data/.doc/ext/reflex/reflex.cpp +42 -7
- data/.doc/ext/reflex/selector.cpp +4 -4
- data/.doc/ext/reflex/snap_constraint.cpp +125 -0
- data/.doc/ext/reflex/style_length.cpp +3 -2
- data/.doc/ext/reflex/view.cpp +96 -23
- data/.doc/ext/reflex/wheel_constraint.cpp +142 -0
- data/.doc/ext/reflex/window.cpp +59 -17
- data/.github/workflows/release-gem.yml +10 -1
- data/.github/workflows/test.yml +9 -0
- data/ChangeLog.md +30 -0
- data/README.md +1 -0
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +21 -1
- data/ext/reflex/chase_constraint.cpp +89 -0
- data/ext/reflex/clipboard.cpp +69 -0
- data/ext/reflex/constraint.cpp +146 -0
- data/ext/reflex/key_event.cpp +6 -6
- data/ext/reflex/link_constraint.cpp +194 -0
- data/ext/reflex/menu.cpp +330 -0
- data/ext/reflex/native.cpp +22 -4
- data/ext/reflex/pin.cpp +165 -0
- data/ext/reflex/pointer.cpp +2 -0
- data/ext/reflex/pointer_event.cpp +1 -1
- data/ext/reflex/reflex.cpp +42 -7
- data/ext/reflex/selector.cpp +4 -4
- data/ext/reflex/selector.h +1 -1
- data/ext/reflex/snap_constraint.cpp +135 -0
- data/ext/reflex/style_length.cpp +3 -2
- data/ext/reflex/view.cpp +117 -37
- data/ext/reflex/wheel_constraint.cpp +154 -0
- data/ext/reflex/window.cpp +65 -18
- data/include/reflex/application.h +9 -0
- data/include/reflex/clipboard.h +53 -0
- data/include/reflex/constraint.h +275 -0
- data/include/reflex/defs.h +204 -195
- data/include/reflex/event.h +2 -0
- data/include/reflex/menu.h +120 -0
- data/include/reflex/pin.h +68 -0
- data/include/reflex/pointer.h +4 -0
- data/include/reflex/ruby/clipboard.h +23 -0
- data/include/reflex/ruby/constraint.h +94 -0
- data/include/reflex/ruby/menu.h +103 -0
- data/include/reflex/ruby/pin.h +40 -0
- data/include/reflex/ruby/view.h +36 -0
- data/include/reflex/ruby/window.h +36 -18
- data/include/reflex/view.h +39 -12
- data/include/reflex/window.h +17 -4
- data/include/reflex.h +5 -0
- data/lib/reflex/chase_constraint.rb +15 -0
- data/lib/reflex/clipboard.rb +19 -0
- data/lib/reflex/constraint.rb +29 -0
- data/lib/reflex/extension.rb +1 -1
- data/lib/reflex/helper.rb +28 -0
- data/lib/reflex/key_event.rb +7 -12
- data/lib/reflex/link_constraint.rb +31 -0
- data/lib/reflex/menu.rb +76 -0
- data/lib/reflex/pin.rb +39 -0
- data/lib/reflex/pointer.rb +18 -0
- data/lib/reflex/pointer_event.rb +1 -1
- data/lib/reflex/snap_constraint.rb +28 -0
- data/lib/reflex/view.rb +56 -4
- data/lib/reflex/wheel_constraint.rb +28 -0
- data/lib/reflex/wheel_event.rb +9 -0
- data/lib/reflex.rb +15 -6
- data/pod.rake +4 -2
- data/reflex.gemspec +3 -3
- data/samples/constraint.rb +152 -0
- data/samples/menu.rb +29 -0
- data/src/application.cpp +21 -2
- data/src/application.h +5 -0
- data/src/clipboard.cpp +81 -0
- data/src/constraint.cpp +1662 -0
- data/src/constraint.h +64 -0
- data/src/event.cpp +7 -1
- data/src/event.h +1 -2
- data/src/ios/application.mm +5 -0
- data/src/ios/clipboard.mm +44 -0
- data/src/ios/event.h +6 -2
- data/src/ios/event.mm +31 -12
- data/src/ios/menu.mm +36 -0
- data/src/ios/view_controller.mm +45 -12
- data/src/ios/window.mm +6 -0
- data/src/menu.cpp +325 -0
- data/src/menu.h +65 -0
- data/src/osx/app_delegate.mm +74 -125
- data/src/osx/application.mm +16 -0
- data/src/osx/clipboard.mm +45 -0
- data/src/osx/event.mm +40 -10
- data/src/osx/menu.h +25 -0
- data/src/osx/menu.mm +372 -0
- data/src/osx/native_window.mm +27 -0
- data/src/osx/opengl_view.mm +51 -0
- data/src/osx/window.mm +11 -0
- data/src/pin.cpp +137 -0
- data/src/pointer.cpp +27 -16
- data/src/pointer.h +6 -0
- data/src/sdl/application.cpp +5 -0
- data/src/sdl/clipboard.cpp +39 -0
- data/src/sdl/event.cpp +20 -3
- data/src/sdl/event.h +6 -3
- data/src/sdl/menu.cpp +35 -0
- data/src/sdl/window.cpp +26 -8
- data/src/view.cpp +313 -52
- data/src/view.h +18 -2
- data/src/win32/application.cpp +5 -0
- data/src/win32/clipboard.cpp +210 -0
- data/src/win32/event.cpp +11 -1
- data/src/win32/event.h +2 -0
- data/src/win32/menu.cpp +352 -0
- data/src/win32/menu.h +27 -0
- data/src/win32/window.cpp +62 -0
- data/src/win32/window.h +3 -0
- data/src/window.cpp +235 -22
- data/src/window.h +13 -2
- data/src/world.cpp +77 -14
- data/src/world.h +9 -2
- data/test/helper.rb +7 -0
- data/test/test_application.rb +11 -0
- data/test/test_chase_constraint.rb +124 -0
- data/test/test_clipboard.rb +54 -0
- data/test/test_constraint.rb +186 -0
- data/test/test_key_event.rb +6 -0
- data/test/test_link_constraint.rb +239 -0
- data/test/test_menu.rb +207 -0
- data/test/test_pin.rb +65 -0
- data/test/test_pointer.rb +23 -9
- data/test/test_pointer_event.rb +1 -1
- data/test/test_snap_constraint.rb +142 -0
- data/test/test_view.rb +113 -23
- data/test/test_wheel_constraint.rb +127 -0
- data/test/test_wheel_event.rb +15 -9
- data/test/test_window.rb +10 -0
- metadata +82 -8
data/ChangeLog.md
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
# reflex ChangeLog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## [v0.6.0] - 2026-08-04
|
|
5
|
+
|
|
6
|
+
- [BREAKING] Read modifiers as symbols from every event that carries them
|
|
7
|
+
- [BREAKING] Rename KEY_APPS to KEY_CONTEXT_MENU and fix its macOS keycode
|
|
8
|
+
- [BREAKING] Sync view frames on View#update_world, drop its duration argument
|
|
9
|
+
- Add Menu class and Application#menu
|
|
10
|
+
- Add Constraint classes backed by Box2D joints
|
|
11
|
+
- Add Clipboard class
|
|
12
|
+
- Add on_pointer_enter/leave event handlers to View and Window
|
|
13
|
+
- Add on_activate/deactivate event handlers to View
|
|
14
|
+
- Add index argument to View#add_child and #add_shape
|
|
15
|
+
- Add locks: option to modifiers for excluding caps/num/scroll lock
|
|
16
|
+
- Add midi and gamepad to the umbrella header
|
|
17
|
+
- Add menu and constraint samples
|
|
18
|
+
- Give View#each_* an enumerator form and array-returning plural accessors
|
|
19
|
+
- Make View#each_* safe against removals during iteration
|
|
20
|
+
- Fill in the Windows virtual-key codes for punctuation and numpad operators
|
|
21
|
+
- Report fn+return as the keypad enter on macOS
|
|
22
|
+
|
|
23
|
+
- Fix crash when an empty array is passed where a Pin or Selector is expected
|
|
24
|
+
- Fix get_modifiers reporting only the first modifier held
|
|
25
|
+
- Fix reversed selector match in find_shapes and find_styles
|
|
26
|
+
- Fix view clipping to track ancestor zoom and position in screen space
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [v0.5.3] - 2026-06-23
|
|
30
|
+
|
|
31
|
+
- Run vendor and erb for reflex itself in pod.rake setup
|
|
32
|
+
|
|
33
|
+
|
|
4
34
|
## [v0.5.2] - 2026-06-23
|
|
5
35
|
|
|
6
36
|
- Add include, ext, vendor to podspec preserve_paths
|
data/README.md
CHANGED
|
@@ -74,6 +74,7 @@ $ gem install reflexion
|
|
|
74
74
|
| `Reflex::Window` | OS-level window with title, frame, flags (closable / resizable / fullscreen / portrait / landscape) |
|
|
75
75
|
| `Reflex::View` | Recursive UI node: position, size, transform, styles, child views, optional clipping / caching |
|
|
76
76
|
| `Reflex::Screen` | Information about a display monitor |
|
|
77
|
+
| `Reflex::Clipboard` | Read and write the system clipboard |
|
|
77
78
|
| `Reflex::Timer` | One-shot or interval timer that delivers `TimerEvent` |
|
|
78
79
|
|
|
79
80
|
### Shapes (drawing + physics body)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.6.0
|
data/ext/reflex/application.cpp
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#include "reflex/ruby/application.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
#include "reflex/ruby/menu.h"
|
|
4
5
|
#include "reflex/ruby/window.h"
|
|
5
6
|
#include "defs.h"
|
|
6
7
|
|
|
@@ -57,6 +58,23 @@ RUCY_DEF0(get_name)
|
|
|
57
58
|
}
|
|
58
59
|
RUCY_END
|
|
59
60
|
|
|
61
|
+
static
|
|
62
|
+
RUCY_DEF1(set_menu, menu)
|
|
63
|
+
{
|
|
64
|
+
CHECK;
|
|
65
|
+
THIS->set_menu(menu ? to<Reflex::Menu*>(menu) : NULL);
|
|
66
|
+
return menu;
|
|
67
|
+
}
|
|
68
|
+
RUCY_END
|
|
69
|
+
|
|
70
|
+
static
|
|
71
|
+
RUCY_DEF0(get_menu)
|
|
72
|
+
{
|
|
73
|
+
CHECK;
|
|
74
|
+
return value(THIS->menu());
|
|
75
|
+
}
|
|
76
|
+
RUCY_END
|
|
77
|
+
|
|
60
78
|
static
|
|
61
79
|
RUCY_DEF0(each_window)
|
|
62
80
|
{
|
|
@@ -64,7 +82,7 @@ RUCY_DEF0(each_window)
|
|
|
64
82
|
|
|
65
83
|
Value ret;
|
|
66
84
|
for (auto it = THIS->window_begin(), end = THIS->window_end(); it != end; ++it)
|
|
67
|
-
ret =
|
|
85
|
+
ret = yield(value(it->get()));
|
|
68
86
|
return ret;
|
|
69
87
|
}
|
|
70
88
|
RUCY_END
|
|
@@ -150,6 +168,8 @@ Init_reflex_application ()
|
|
|
150
168
|
cApplication.define_method("quit", quit);
|
|
151
169
|
cApplication.define_method("name=", set_name);
|
|
152
170
|
cApplication.define_method("name", get_name);
|
|
171
|
+
cApplication.define_method("menu=", set_menu);
|
|
172
|
+
cApplication.define_method("menu", get_menu);
|
|
153
173
|
cApplication.define_method("each_window", each_window);
|
|
154
174
|
cApplication.define_method("on_start", on_start);
|
|
155
175
|
cApplication.define_method("on_quit", on_quit);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#include "reflex/ruby/constraint.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include <rays/ruby/point.h>
|
|
5
|
+
#include "reflex/exception.h"
|
|
6
|
+
#include "reflex/ruby/pin.h"
|
|
7
|
+
#include "reflex/ruby/view.h"
|
|
8
|
+
#include "defs.h"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::ChaseConstraint)
|
|
12
|
+
|
|
13
|
+
#define THIS to<Reflex::ChaseConstraint*>(self)
|
|
14
|
+
|
|
15
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::ChaseConstraint, self)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
static
|
|
19
|
+
RUCY_DEF_ALLOC(alloc, klass)
|
|
20
|
+
{
|
|
21
|
+
Reflex::reflex_error(
|
|
22
|
+
__FILE__, __LINE__, "can not instantiate ChaseConstraint class");
|
|
23
|
+
}
|
|
24
|
+
RUCY_END
|
|
25
|
+
|
|
26
|
+
static
|
|
27
|
+
RUCY_DEFN(set_target)
|
|
28
|
+
{
|
|
29
|
+
CHECK;
|
|
30
|
+
THIS->set_target(to<Reflex::Pin>(argc, argv));
|
|
31
|
+
}
|
|
32
|
+
RUCY_END
|
|
33
|
+
|
|
34
|
+
static
|
|
35
|
+
RUCY_DEF0(get_target)
|
|
36
|
+
{
|
|
37
|
+
CHECK;
|
|
38
|
+
return value(THIS->target());
|
|
39
|
+
}
|
|
40
|
+
RUCY_END
|
|
41
|
+
|
|
42
|
+
static
|
|
43
|
+
RUCY_DEF1(set_force, max_force)
|
|
44
|
+
{
|
|
45
|
+
CHECK;
|
|
46
|
+
if (max_force.is_nil())
|
|
47
|
+
THIS->clear_force();
|
|
48
|
+
else
|
|
49
|
+
THIS->set_force(to<float>(max_force));
|
|
50
|
+
}
|
|
51
|
+
RUCY_END
|
|
52
|
+
|
|
53
|
+
static
|
|
54
|
+
RUCY_DEF0(get_force)
|
|
55
|
+
{
|
|
56
|
+
CHECK;
|
|
57
|
+
return THIS->has_force() ? value(THIS->force()) : nil();
|
|
58
|
+
}
|
|
59
|
+
RUCY_END
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
static Class cChaseConstraint;
|
|
63
|
+
|
|
64
|
+
void
|
|
65
|
+
Init_reflex_chase_constraint ()
|
|
66
|
+
{
|
|
67
|
+
Module mReflex = define_module("Reflex");
|
|
68
|
+
|
|
69
|
+
cChaseConstraint = mReflex.define_class("ChaseConstraint", Reflex::constraint_class());
|
|
70
|
+
cChaseConstraint.define_alloc_func(alloc);
|
|
71
|
+
cChaseConstraint.define_method("target=", set_target);
|
|
72
|
+
cChaseConstraint.define_method("target", get_target);
|
|
73
|
+
cChaseConstraint.define_method("force=", set_force);
|
|
74
|
+
cChaseConstraint.define_method("force", get_force);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
namespace Reflex
|
|
79
|
+
{
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
Class
|
|
83
|
+
chase_constraint_class ()
|
|
84
|
+
{
|
|
85
|
+
return cChaseConstraint;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
}// Reflex
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#include "reflex/ruby/clipboard.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include "reflex/exception.h"
|
|
5
|
+
#include "defs.h"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
static
|
|
9
|
+
RUCY_DEF_ALLOC(alloc, klass)
|
|
10
|
+
{
|
|
11
|
+
Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Clipboard class.");
|
|
12
|
+
}
|
|
13
|
+
RUCY_END
|
|
14
|
+
|
|
15
|
+
static
|
|
16
|
+
RUCY_DEF1(set_text, text)
|
|
17
|
+
{
|
|
18
|
+
Reflex::Clipboard clipboard;
|
|
19
|
+
if (!text.is_nil()) clipboard.set_text(text.c_str());
|
|
20
|
+
Reflex::set_clipboard(clipboard);
|
|
21
|
+
return text;
|
|
22
|
+
}
|
|
23
|
+
RUCY_END
|
|
24
|
+
|
|
25
|
+
static
|
|
26
|
+
RUCY_DEF0(get_text)
|
|
27
|
+
{
|
|
28
|
+
Reflex::Clipboard clipboard = Reflex::get_clipboard();
|
|
29
|
+
const char* text = clipboard.text();
|
|
30
|
+
return text ? value(text, rb_utf8_encoding()) : nil();
|
|
31
|
+
}
|
|
32
|
+
RUCY_END
|
|
33
|
+
|
|
34
|
+
static
|
|
35
|
+
RUCY_DEF0(clear)
|
|
36
|
+
{
|
|
37
|
+
Reflex::set_clipboard(Reflex::Clipboard());
|
|
38
|
+
return self;
|
|
39
|
+
}
|
|
40
|
+
RUCY_END
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
static Class cClipboard;
|
|
44
|
+
|
|
45
|
+
void
|
|
46
|
+
Init_reflex_clipboard ()
|
|
47
|
+
{
|
|
48
|
+
Module mReflex = define_module("Reflex");
|
|
49
|
+
|
|
50
|
+
cClipboard = mReflex.define_class("Clipboard");
|
|
51
|
+
cClipboard.define_alloc_func(alloc);
|
|
52
|
+
cClipboard.define_singleton_method("text=", set_text);
|
|
53
|
+
cClipboard.define_singleton_method("text", get_text);
|
|
54
|
+
cClipboard.define_singleton_method("clear", clear);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
namespace Reflex
|
|
59
|
+
{
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Class
|
|
63
|
+
clipboard_class ()
|
|
64
|
+
{
|
|
65
|
+
return cClipboard;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
}// Reflex
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#include "reflex/ruby/constraint.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include <rays/ruby/point.h>
|
|
5
|
+
#include "reflex/exception.h"
|
|
6
|
+
#include "reflex/ruby/view.h"
|
|
7
|
+
#include "reflex/ruby/pin.h"
|
|
8
|
+
#include "defs.h"
|
|
9
|
+
#include "selector.h"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::Constraint)
|
|
13
|
+
|
|
14
|
+
#define THIS to<Reflex::Constraint*>(self)
|
|
15
|
+
|
|
16
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::Constraint, self)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
static
|
|
20
|
+
RUCY_DEF_ALLOC(alloc, klass)
|
|
21
|
+
{
|
|
22
|
+
Reflex::reflex_error(
|
|
23
|
+
__FILE__, __LINE__, "can not instantiate Constraint class");
|
|
24
|
+
}
|
|
25
|
+
RUCY_END
|
|
26
|
+
|
|
27
|
+
static
|
|
28
|
+
RUCY_DEF0(remove)
|
|
29
|
+
{
|
|
30
|
+
CHECK;
|
|
31
|
+
THIS->remove();
|
|
32
|
+
return self;
|
|
33
|
+
}
|
|
34
|
+
RUCY_END
|
|
35
|
+
|
|
36
|
+
static
|
|
37
|
+
RUCY_DEF1(get_pin, index)
|
|
38
|
+
{
|
|
39
|
+
CHECK;
|
|
40
|
+
return value(THIS->pin(to<int>(index)));
|
|
41
|
+
}
|
|
42
|
+
RUCY_END
|
|
43
|
+
|
|
44
|
+
static
|
|
45
|
+
RUCY_DEF1(set_spring, hertz)
|
|
46
|
+
{
|
|
47
|
+
CHECK;
|
|
48
|
+
THIS->set_spring(hertz ? to<float>(hertz) : 0);
|
|
49
|
+
}
|
|
50
|
+
RUCY_END
|
|
51
|
+
|
|
52
|
+
static
|
|
53
|
+
RUCY_DEF0(get_spring)
|
|
54
|
+
{
|
|
55
|
+
CHECK;
|
|
56
|
+
float hertz = THIS->spring();
|
|
57
|
+
return hertz > 0 ? value(hertz) : nil();
|
|
58
|
+
}
|
|
59
|
+
RUCY_END
|
|
60
|
+
|
|
61
|
+
static
|
|
62
|
+
RUCY_DEF1(set_damping, ratio)
|
|
63
|
+
{
|
|
64
|
+
CHECK;
|
|
65
|
+
THIS->set_damping(to<float>(ratio));
|
|
66
|
+
}
|
|
67
|
+
RUCY_END
|
|
68
|
+
|
|
69
|
+
static
|
|
70
|
+
RUCY_DEF0(get_damping)
|
|
71
|
+
{
|
|
72
|
+
CHECK;
|
|
73
|
+
return value(THIS->damping());
|
|
74
|
+
}
|
|
75
|
+
RUCY_END
|
|
76
|
+
|
|
77
|
+
static
|
|
78
|
+
RUCY_DEF1(set_collide, state)
|
|
79
|
+
{
|
|
80
|
+
CHECK;
|
|
81
|
+
THIS->set_collide(to<bool>(state));
|
|
82
|
+
}
|
|
83
|
+
RUCY_END
|
|
84
|
+
|
|
85
|
+
static
|
|
86
|
+
RUCY_DEF0(can_collide)
|
|
87
|
+
{
|
|
88
|
+
CHECK;
|
|
89
|
+
return value(THIS->can_collide());
|
|
90
|
+
}
|
|
91
|
+
RUCY_END
|
|
92
|
+
|
|
93
|
+
static
|
|
94
|
+
RUCY_DEF0(is_removed)
|
|
95
|
+
{
|
|
96
|
+
CHECK;
|
|
97
|
+
return value(THIS->is_removed());
|
|
98
|
+
}
|
|
99
|
+
RUCY_END
|
|
100
|
+
|
|
101
|
+
static
|
|
102
|
+
RUCY_DEF0(is_active)
|
|
103
|
+
{
|
|
104
|
+
CHECK;
|
|
105
|
+
return value(THIS->operator bool());
|
|
106
|
+
}
|
|
107
|
+
RUCY_END
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
static Class cConstraint;
|
|
111
|
+
|
|
112
|
+
void
|
|
113
|
+
Init_reflex_constraint ()
|
|
114
|
+
{
|
|
115
|
+
Module mReflex = define_module("Reflex");
|
|
116
|
+
|
|
117
|
+
cConstraint = mReflex.define_class("Constraint");
|
|
118
|
+
cConstraint.define_alloc_func(alloc);
|
|
119
|
+
cConstraint.define_method("remove", remove);
|
|
120
|
+
cConstraint.define_private_method("get_pin", get_pin);
|
|
121
|
+
cConstraint.define_method("spring=", set_spring);
|
|
122
|
+
cConstraint.define_method("spring", get_spring);
|
|
123
|
+
cConstraint.define_method("damping=", set_damping);
|
|
124
|
+
cConstraint.define_method("damping", get_damping);
|
|
125
|
+
cConstraint.define_method("collide=", set_collide);
|
|
126
|
+
cConstraint.define_method("collide?", can_collide);
|
|
127
|
+
cConstraint.define_method("removed?", is_removed);
|
|
128
|
+
cConstraint.define_method("active?", is_active);
|
|
129
|
+
|
|
130
|
+
define_selector_methods<Reflex::Constraint>(cConstraint);
|
|
131
|
+
define_wrapper_equality_methods<Reflex::Constraint>(cConstraint);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
namespace Reflex
|
|
136
|
+
{
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
Class
|
|
140
|
+
constraint_class ()
|
|
141
|
+
{
|
|
142
|
+
return cConstraint;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
}// Reflex
|
data/ext/reflex/key_event.cpp
CHANGED
|
@@ -232,12 +232,12 @@ RUCY_DEF0(get_key)
|
|
|
232
232
|
CASE(VOLUME_DOWN): SYMBOL1(volume_down);
|
|
233
233
|
CASE(MUTE): SYMBOL1(mute);
|
|
234
234
|
|
|
235
|
-
CASE(SLEEP):
|
|
236
|
-
CASE(EXEC):
|
|
237
|
-
CASE(PRINT):
|
|
238
|
-
CASE(
|
|
239
|
-
CASE(SELECT):
|
|
240
|
-
CASE(CLEAR):
|
|
235
|
+
CASE(SLEEP): SYMBOL1(sleep);
|
|
236
|
+
CASE(EXEC): SYMBOL1(exec);
|
|
237
|
+
CASE(PRINT): SYMBOL1(print);
|
|
238
|
+
CASE(CONTEXT_MENU): SYMBOL1(context_menu);
|
|
239
|
+
CASE(SELECT): SYMBOL1(select);
|
|
240
|
+
CASE(CLEAR): SYMBOL1(clear);
|
|
241
241
|
|
|
242
242
|
CASE(NAVIGATION_VIEW): SYMBOL1(navigation_view);
|
|
243
243
|
CASE(NAVIGATION_MENU): SYMBOL1(navigation_menu);
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
#include "reflex/ruby/constraint.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include <rays/ruby/point.h>
|
|
5
|
+
#include "reflex/exception.h"
|
|
6
|
+
#include "defs.h"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::LinkConstraint)
|
|
10
|
+
|
|
11
|
+
#define THIS to<Reflex::LinkConstraint*>(self)
|
|
12
|
+
|
|
13
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::LinkConstraint, self)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
static
|
|
17
|
+
RUCY_DEF_ALLOC(alloc, klass)
|
|
18
|
+
{
|
|
19
|
+
Reflex::reflex_error(
|
|
20
|
+
__FILE__, __LINE__, "can not instantiate LinkConstraint class");
|
|
21
|
+
}
|
|
22
|
+
RUCY_END
|
|
23
|
+
|
|
24
|
+
static
|
|
25
|
+
RUCY_DEFN(set_axis)
|
|
26
|
+
{
|
|
27
|
+
CHECK;
|
|
28
|
+
if (argc == 1 && argv[0].is_nil())
|
|
29
|
+
THIS->clear_axis();
|
|
30
|
+
else
|
|
31
|
+
THIS->set_axis(to<Rays::Point>(argc, argv));
|
|
32
|
+
}
|
|
33
|
+
RUCY_END
|
|
34
|
+
|
|
35
|
+
static
|
|
36
|
+
RUCY_DEF0(get_axis)
|
|
37
|
+
{
|
|
38
|
+
CHECK;
|
|
39
|
+
return THIS->has_axis() ? value(THIS->axis()) : nil();
|
|
40
|
+
}
|
|
41
|
+
RUCY_END
|
|
42
|
+
|
|
43
|
+
static
|
|
44
|
+
RUCY_DEF1(set_distance, distance)
|
|
45
|
+
{
|
|
46
|
+
CHECK;
|
|
47
|
+
if (distance.is_nil())
|
|
48
|
+
THIS->clear_distance();
|
|
49
|
+
else
|
|
50
|
+
THIS->set_distance(to<coord>(distance));
|
|
51
|
+
}
|
|
52
|
+
RUCY_END
|
|
53
|
+
|
|
54
|
+
static
|
|
55
|
+
RUCY_DEF0(get_distance)
|
|
56
|
+
{
|
|
57
|
+
CHECK;
|
|
58
|
+
return value(THIS->distance());
|
|
59
|
+
}
|
|
60
|
+
RUCY_END
|
|
61
|
+
|
|
62
|
+
static
|
|
63
|
+
RUCY_DEF0(has_distance)
|
|
64
|
+
{
|
|
65
|
+
CHECK;
|
|
66
|
+
return value(THIS->has_distance());
|
|
67
|
+
}
|
|
68
|
+
RUCY_END
|
|
69
|
+
|
|
70
|
+
static
|
|
71
|
+
RUCY_DEF0(current_distance)
|
|
72
|
+
{
|
|
73
|
+
CHECK;
|
|
74
|
+
return value(THIS->current_distance());
|
|
75
|
+
}
|
|
76
|
+
RUCY_END
|
|
77
|
+
|
|
78
|
+
static
|
|
79
|
+
RUCY_DEF2(set_range, min, max)
|
|
80
|
+
{
|
|
81
|
+
CHECK;
|
|
82
|
+
THIS->set_range(to<coord>(min), to<coord>(max));
|
|
83
|
+
}
|
|
84
|
+
RUCY_END
|
|
85
|
+
|
|
86
|
+
static
|
|
87
|
+
RUCY_DEF0(clear_range)
|
|
88
|
+
{
|
|
89
|
+
CHECK;
|
|
90
|
+
THIS->clear_range();
|
|
91
|
+
}
|
|
92
|
+
RUCY_END
|
|
93
|
+
|
|
94
|
+
static
|
|
95
|
+
RUCY_DEF0(range_min)
|
|
96
|
+
{
|
|
97
|
+
CHECK;
|
|
98
|
+
return value(THIS->range_min());
|
|
99
|
+
}
|
|
100
|
+
RUCY_END
|
|
101
|
+
|
|
102
|
+
static
|
|
103
|
+
RUCY_DEF0(range_max)
|
|
104
|
+
{
|
|
105
|
+
CHECK;
|
|
106
|
+
return value(THIS->range_max());
|
|
107
|
+
}
|
|
108
|
+
RUCY_END
|
|
109
|
+
|
|
110
|
+
static
|
|
111
|
+
RUCY_DEF0(has_range)
|
|
112
|
+
{
|
|
113
|
+
CHECK;
|
|
114
|
+
return value(THIS->has_range());
|
|
115
|
+
}
|
|
116
|
+
RUCY_END
|
|
117
|
+
|
|
118
|
+
static
|
|
119
|
+
RUCY_DEF1(set_motor, pixels_per_second)
|
|
120
|
+
{
|
|
121
|
+
CHECK;
|
|
122
|
+
if (pixels_per_second.is_nil())
|
|
123
|
+
THIS->clear_motor();
|
|
124
|
+
else
|
|
125
|
+
THIS->set_motor(to<coord>(pixels_per_second));
|
|
126
|
+
}
|
|
127
|
+
RUCY_END
|
|
128
|
+
|
|
129
|
+
static
|
|
130
|
+
RUCY_DEF0(get_motor)
|
|
131
|
+
{
|
|
132
|
+
CHECK;
|
|
133
|
+
return THIS->has_motor() ? value(THIS->motor()) : nil();
|
|
134
|
+
}
|
|
135
|
+
RUCY_END
|
|
136
|
+
|
|
137
|
+
static
|
|
138
|
+
RUCY_DEF1(set_force, max_force)
|
|
139
|
+
{
|
|
140
|
+
CHECK;
|
|
141
|
+
if (max_force.is_nil())
|
|
142
|
+
THIS->clear_force();
|
|
143
|
+
else
|
|
144
|
+
THIS->set_force(to<float>(max_force));
|
|
145
|
+
}
|
|
146
|
+
RUCY_END
|
|
147
|
+
|
|
148
|
+
static
|
|
149
|
+
RUCY_DEF0(get_force)
|
|
150
|
+
{
|
|
151
|
+
CHECK;
|
|
152
|
+
return THIS->has_force() ? value(THIS->force()) : nil();
|
|
153
|
+
}
|
|
154
|
+
RUCY_END
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
static Class cLinkConstraint;
|
|
158
|
+
|
|
159
|
+
void
|
|
160
|
+
Init_reflex_link_constraint ()
|
|
161
|
+
{
|
|
162
|
+
Module mReflex = define_module("Reflex");
|
|
163
|
+
|
|
164
|
+
cLinkConstraint = mReflex.define_class("LinkConstraint", Reflex::constraint_class());
|
|
165
|
+
cLinkConstraint.define_alloc_func(alloc);
|
|
166
|
+
cLinkConstraint.define_method("axis=", set_axis);
|
|
167
|
+
cLinkConstraint.define_method("axis", get_axis);
|
|
168
|
+
cLinkConstraint.define_method( "distance=", set_distance);
|
|
169
|
+
cLinkConstraint.define_method( "distance", get_distance);
|
|
170
|
+
cLinkConstraint.define_method("current_distance", current_distance);
|
|
171
|
+
cLinkConstraint.define_private_method( "set_range!", set_range);
|
|
172
|
+
cLinkConstraint.define_private_method("clear_range!", clear_range);
|
|
173
|
+
cLinkConstraint.define_private_method( "range_min!", range_min);
|
|
174
|
+
cLinkConstraint.define_private_method( "range_max!", range_max);
|
|
175
|
+
cLinkConstraint.define_private_method( "has_range!", has_range);
|
|
176
|
+
cLinkConstraint.define_method("motor=", set_motor);
|
|
177
|
+
cLinkConstraint.define_method("motor", get_motor);
|
|
178
|
+
cLinkConstraint.define_method("force=", set_force);
|
|
179
|
+
cLinkConstraint.define_method("force", get_force);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
namespace Reflex
|
|
184
|
+
{
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
Class
|
|
188
|
+
link_constraint_class ()
|
|
189
|
+
{
|
|
190
|
+
return cLinkConstraint;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
}// Reflex
|