spyglass 0.0.5 → 0.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/window_events.rb +5 -1
- data/ext/spyglass/window.cc +11 -0
- data/ext/spyglass/window.h +1 -0
- data/lib/spyglass/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b42c4ba13458e7bdf19c7320a303c5e81f23d8b7
|
4
|
+
data.tar.gz: a8991220588aa8e9a6b4c7816402fd779c98c845
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7ffbd9316f395b9f9a3c737fc345c70344f1e02c26434e03ff432a9319efc0c5b16f7415d383065bcda0b1d9c09203eb627abfc5ce19d95463fba07c57d6704
|
7
|
+
data.tar.gz: d6950330150b23122a1a86e19a211b0e271fa53f3ff15c90d8c6d5ba9663fb6495ad5a41aa47c94458fe29e50de47d2e34f912fb9e7f144a6d5f034d28fd4dc1
|
data/examples/window_events.rb
CHANGED
@@ -10,6 +10,10 @@ window.on_click do |x, y|
|
|
10
10
|
puts "CLICKED: #{ x }, #{ y }"
|
11
11
|
end
|
12
12
|
|
13
|
+
window.on_double_click do |x, y|
|
14
|
+
puts "DOUBLE CLICKED: #{ x }, #{ y }"
|
15
|
+
end
|
16
|
+
|
13
17
|
window.on_right_click do |x, y|
|
14
18
|
puts "RIGHT CLICKED: #{ x }, #{ y }"
|
15
19
|
end
|
@@ -17,6 +21,6 @@ end
|
|
17
21
|
window.show(card)
|
18
22
|
|
19
23
|
loop do
|
20
|
-
break if GUI::wait_key(
|
24
|
+
break if GUI::wait_key(500) > 0
|
21
25
|
end
|
22
26
|
|
data/ext/spyglass/window.cc
CHANGED
@@ -15,6 +15,7 @@ namespace Spyglass {
|
|
15
15
|
rb_define_method(WindowClass, "hide", RUBY_METHOD_FUNC(rb_hide), 0);
|
16
16
|
rb_define_method(WindowClass, "move", RUBY_METHOD_FUNC(rb_move), 2);
|
17
17
|
rb_define_method(WindowClass, "on_click", RUBY_METHOD_FUNC(rb_on_click), 0);
|
18
|
+
rb_define_method(WindowClass, "on_double_click", RUBY_METHOD_FUNC(rb_on_double_click), 0);
|
18
19
|
rb_define_method(WindowClass, "on_right_click", RUBY_METHOD_FUNC(rb_on_right_click), 0);
|
19
20
|
rb_define_method(WindowClass, "on_move", RUBY_METHOD_FUNC(rb_on_move), 0);
|
20
21
|
rb_define_method(WindowClass, "show", RUBY_METHOD_FUNC(rb_show), 1);
|
@@ -47,6 +48,10 @@ namespace Spyglass {
|
|
47
48
|
block = rb_ivar_get(self, rb_intern("@_click_block"));
|
48
49
|
break;
|
49
50
|
|
51
|
+
case cv::EVENT_LBUTTONDBLCLK:
|
52
|
+
block = rb_ivar_get(self, rb_intern("@_double_click_block"));
|
53
|
+
break;
|
54
|
+
|
50
55
|
case cv::EVENT_RBUTTONDOWN:
|
51
56
|
block = rb_ivar_get(self, rb_intern("@_right_click_block"));
|
52
57
|
break;
|
@@ -92,6 +97,12 @@ namespace Spyglass {
|
|
92
97
|
return self;
|
93
98
|
}
|
94
99
|
|
100
|
+
static VALUE rb_on_double_click(VALUE self) {
|
101
|
+
rb_need_block();
|
102
|
+
rb_ivar_set(self, rb_intern("@_double_click_block"), rb_block_proc());
|
103
|
+
return self;
|
104
|
+
}
|
105
|
+
|
95
106
|
static VALUE rb_on_right_click(VALUE self) {
|
96
107
|
rb_need_block();
|
97
108
|
rb_ivar_set(self, rb_intern("@_right_click_block"), rb_block_proc());
|
data/ext/spyglass/window.h
CHANGED
@@ -23,6 +23,7 @@ namespace Spyglass {
|
|
23
23
|
static VALUE rb_hide(VALUE self);
|
24
24
|
static VALUE rb_move(VALUE self, VALUE x, VALUE y);
|
25
25
|
static VALUE rb_on_click(VALUE self);
|
26
|
+
static VALUE rb_on_double_click(VALUE self);
|
26
27
|
static VALUE rb_on_right_click(VALUE self);
|
27
28
|
static VALUE rb_on_move(VALUE self);
|
28
29
|
static VALUE rb_show(VALUE self, VALUE image);
|
data/lib/spyglass/version.rb
CHANGED