special_input_device 0.1.0 → 0.2.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/ext/special_input_device/_mouse.c +22 -0
- data/ext/special_input_device/_mouse.h +12 -0
- data/ext/special_input_device/_vendor__interception.c +1 -1
- data/ext/special_input_device/_vendor__interception.h +1 -1
- data/ext/special_input_device/image.c +1 -1
- data/ext/special_input_device/interception.c +11 -9
- data/ext/special_input_device/keyboard.c +109 -119
- data/ext/special_input_device/mouse.c +273 -852
- data/ext/special_input_device/window.c +228 -352
- data/lib/special_input_device/color.rb +1 -1
- data/lib/special_input_device/point.rb +61 -0
- data/lib/special_input_device/rectangle.rb +16 -7
- data/lib/yard/attribute_handler.rb +17 -0
- data/lib/yard/init_handler.rb +22 -0
- data/lib/yard/templates/default/layout/html/setup.rb +3 -0
- data/lib/yard/yard.rb +2 -0
- metadata +12 -3
|
@@ -52,7 +52,7 @@ class SpecialInputDevice::Color
|
|
|
52
52
|
# @param [SpecialInputDevice::Color] other other color
|
|
53
53
|
# @return [Float] the similarity between 0.0 and 1.0
|
|
54
54
|
def =~(other)
|
|
55
|
-
raise(TypeError, "Expecting SpecialInputDevice::Color, #{other.class} gavin") unless other.is_a?(SpecialInputDevice::Color)
|
|
55
|
+
raise(TypeError, "Expecting SpecialInputDevice::Color for other, #{other.class} gavin") unless other.is_a?(SpecialInputDevice::Color)
|
|
56
56
|
case SpecialInputDevice.color_compare_method
|
|
57
57
|
when SpecialInputDevice::COLOR_COMPARE_METHOD::EUCLIDEAN_METRIC_IN_HSL_BIPYRAMIDAL
|
|
58
58
|
self_hsl = self.hsl
|
|
@@ -3,8 +3,69 @@ require_relative('attributes_equal_checker')
|
|
|
3
3
|
# <code>Point</code> object represent a point on a two direction plane.
|
|
4
4
|
class SpecialInputDevice::Point
|
|
5
5
|
|
|
6
|
+
class << self
|
|
7
|
+
|
|
8
|
+
# @!visibility private
|
|
9
|
+
def positive_negative(method)
|
|
10
|
+
define_method(method) do
|
|
11
|
+
return SpecialInputDevice::Point.new(x.send(method), y.send(method))
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private(:positive_negative)
|
|
16
|
+
|
|
17
|
+
# @!visibility private
|
|
18
|
+
def arithmetic_operations(method)
|
|
19
|
+
define_method(method) do |value|
|
|
20
|
+
case value
|
|
21
|
+
when Float
|
|
22
|
+
when Integer
|
|
23
|
+
return SpecialInputDevice::Point.new(x.send(method, value), y.send(method, value))
|
|
24
|
+
when SpecialInputDevice::Point
|
|
25
|
+
return SpecialInputDevice::Point.new(x.send(method, value.x), y.send(method, value.y))
|
|
26
|
+
else
|
|
27
|
+
raise(TypeError, "Expecting Float, Integer or SpecialInputDevice::Point for value, #{value.class} gavin")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private(:arithmetic_operations)
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
|
|
6
36
|
include(SpecialInputDevice::AttributesEqualChecker)
|
|
7
37
|
|
|
38
|
+
# @!method +@
|
|
39
|
+
# @return [SpecialInputDevice::Point]
|
|
40
|
+
positive_negative(:+@)
|
|
41
|
+
# @!method -@
|
|
42
|
+
# @return [SpecialInputDevice::Point]
|
|
43
|
+
positive_negative(:-@)
|
|
44
|
+
# @!method +(value)
|
|
45
|
+
# @param [Float, Integer, SpecialInputDevice::Point] value
|
|
46
|
+
# @return [SpecialInputDevice::Point]
|
|
47
|
+
arithmetic_operations(:+)
|
|
48
|
+
# @!method -(value)
|
|
49
|
+
# @param [Float, Integer, SpecialInputDevice::Point] value
|
|
50
|
+
# @return [SpecialInputDevice::Point]
|
|
51
|
+
arithmetic_operations(:-)
|
|
52
|
+
# @!method *(value)
|
|
53
|
+
# @param [Float, Integer, SpecialInputDevice::Point] value
|
|
54
|
+
# @return [SpecialInputDevice::Point]
|
|
55
|
+
arithmetic_operations(:*)
|
|
56
|
+
# @!method /(value)
|
|
57
|
+
# @param [Float, Integer, SpecialInputDevice::Point] value
|
|
58
|
+
# @return [SpecialInputDevice::Point]
|
|
59
|
+
arithmetic_operations(:/)
|
|
60
|
+
# @!method %(value)
|
|
61
|
+
# @param [Float, Integer, SpecialInputDevice::Point] value
|
|
62
|
+
# @return [SpecialInputDevice::Point]
|
|
63
|
+
arithmetic_operations(:%)
|
|
64
|
+
# @!method **(value)
|
|
65
|
+
# @param [Float, Integer, SpecialInputDevice::Point] value
|
|
66
|
+
# @return [SpecialInputDevice::Point]
|
|
67
|
+
arithmetic_operations(:**)
|
|
68
|
+
|
|
8
69
|
# @return [Integer] the x-coordinate of the point
|
|
9
70
|
attr_reader(:x)
|
|
10
71
|
# @param [Integer] value the x-coordinate of the point
|
|
@@ -112,14 +112,14 @@ class SpecialInputDevice::Rectangle
|
|
|
112
112
|
case count = arguments.size
|
|
113
113
|
when 2
|
|
114
114
|
@position = arguments[0]
|
|
115
|
-
raise(TypeError, "Expecting SpecialInputDevice::Point, #{@position.class} gavin") unless @position.is_a? SpecialInputDevice::Point
|
|
115
|
+
raise(TypeError, "Expecting SpecialInputDevice::Point for top_left, #{@position.class} gavin") unless @position.is_a? SpecialInputDevice::Point
|
|
116
116
|
end_point = arguments[1]
|
|
117
|
-
raise(TypeError, "Expecting SpecialInputDevice::Point, #{end_point.class} gavin") unless end_point.is_a? SpecialInputDevice::Point
|
|
117
|
+
raise(TypeError, "Expecting SpecialInputDevice::Point for bottom_right, #{end_point.class} gavin") unless end_point.is_a? SpecialInputDevice::Point
|
|
118
118
|
self.width = end_point.x - @position.x
|
|
119
119
|
self.height = end_point.y - @position.y
|
|
120
120
|
when 3
|
|
121
121
|
@position = arguments[0]
|
|
122
|
-
raise(TypeError, "Expecting SpecialInputDevice::Point, #{@position.class} gavin") unless @position.is_a? SpecialInputDevice::Point
|
|
122
|
+
raise(TypeError, "Expecting SpecialInputDevice::Point for top_left, #{@position.class} gavin") unless @position.is_a? SpecialInputDevice::Point
|
|
123
123
|
self.width = arguments[1]
|
|
124
124
|
self.height = arguments[2]
|
|
125
125
|
when 4
|
|
@@ -162,14 +162,23 @@ class SpecialInputDevice::Rectangle
|
|
|
162
162
|
# Moves the rectangle absolutely without changing the size.
|
|
163
163
|
# @param [Integer] x new x-coordinate
|
|
164
164
|
# @param [Integer] y new y-coordinate
|
|
165
|
-
# @return [SpecialInputDevice::Point] the
|
|
165
|
+
# @return [SpecialInputDevice::Point] the distance of movement
|
|
166
166
|
def move_to!(x, y)
|
|
167
|
-
|
|
167
|
+
current_position = @position
|
|
168
|
+
@position = SpecialInputDevice::Point.new(x, y)
|
|
169
|
+
@position - current_position
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# @param [Integer] x
|
|
173
|
+
# @param [Integer] y
|
|
174
|
+
# @return [SpecialInputDevice::Point] a point at (self.x + width * x, self.y + height * y)
|
|
175
|
+
def point_at(x, y)
|
|
176
|
+
SpecialInputDevice::Point.new(self.x + width * x, self.y + height * y)
|
|
168
177
|
end
|
|
169
178
|
|
|
170
|
-
# @return [
|
|
179
|
+
# @return [SpecialInputDevice::Point] a point(width, height)
|
|
171
180
|
def size
|
|
172
|
-
|
|
181
|
+
SpecialInputDevice::Point.new(width, height)
|
|
173
182
|
end
|
|
174
183
|
|
|
175
184
|
# @!visibility private
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module YARD::Handlers::C::Extension
|
|
3
|
+
class AttributeHandler < YARD::Handlers::C::Base
|
|
4
|
+
MATCH = /rb_define_attr\s*\(\s*([\w\.]+),\s*"([^"]+)",\s*(FALSE|TRUE)\s*,\s*(FALSE|TRUE)\s*\)/
|
|
5
|
+
handles MATCH
|
|
6
|
+
|
|
7
|
+
process do
|
|
8
|
+
return if ToplevelStatement == statement
|
|
9
|
+
return if Comment === statement && statement.type != :multi
|
|
10
|
+
statement.source.scan(MATCH) do |var_name, name, read, write|
|
|
11
|
+
read = 1 if read == 'TRUE'
|
|
12
|
+
write = 1 if write == 'TRUE'
|
|
13
|
+
handle_attribute(var_name, name, read, write)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Handles the Init_Libname() method
|
|
3
|
+
module YARD::Handlers::C::Extension
|
|
4
|
+
class InitHandler < YARD::Handlers::C::Base
|
|
5
|
+
MATCH = /\A\s*(?:\S+\s+)*VOID\s+(?:[Ii]nit_)?(\w+)\s*/
|
|
6
|
+
handles MATCH
|
|
7
|
+
statement_class ToplevelStatement
|
|
8
|
+
|
|
9
|
+
process do
|
|
10
|
+
parse_block
|
|
11
|
+
decl = statement.declaration[MATCH, 1]
|
|
12
|
+
if decl
|
|
13
|
+
ns = namespace_for_variable(decl)
|
|
14
|
+
if ns.is_a?(YARD::CodeObjects::NamespaceObject) && ns.docstring.blank?
|
|
15
|
+
if statement.comments
|
|
16
|
+
register_docstring(ns, statement.comments.source, statement)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/yard/yard.rb
ADDED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: special_input_device
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- 6y
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-01-
|
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email: tlserver6y@gmail.com
|
|
@@ -17,6 +17,8 @@ extensions:
|
|
|
17
17
|
- ext/special_input_device/extconf.rb
|
|
18
18
|
extra_rdoc_files: []
|
|
19
19
|
files:
|
|
20
|
+
- ext/special_input_device/_mouse.c
|
|
21
|
+
- ext/special_input_device/_mouse.h
|
|
20
22
|
- ext/special_input_device/_screen.c
|
|
21
23
|
- ext/special_input_device/_screen.h
|
|
22
24
|
- ext/special_input_device/_system_time.c
|
|
@@ -52,6 +54,10 @@ files:
|
|
|
52
54
|
- lib/special_input_device/point.rb
|
|
53
55
|
- lib/special_input_device/rectangle.rb
|
|
54
56
|
- lib/special_input_device/special_input_device.rb
|
|
57
|
+
- lib/yard/attribute_handler.rb
|
|
58
|
+
- lib/yard/init_handler.rb
|
|
59
|
+
- lib/yard/templates/default/layout/html/setup.rb
|
|
60
|
+
- lib/yard/yard.rb
|
|
55
61
|
homepage: http://tlserver6y.ddns.net/SpecialInputDevice
|
|
56
62
|
licenses:
|
|
57
63
|
- LGPL-3.0
|
|
@@ -75,5 +81,8 @@ rubyforge_project:
|
|
|
75
81
|
rubygems_version: 2.5.2
|
|
76
82
|
signing_key:
|
|
77
83
|
specification_version: 4
|
|
78
|
-
summary:
|
|
84
|
+
summary: This gem is a library provides methods to control mouse and keyboard input
|
|
85
|
+
for Windows. Unlike many other similar applications out there, this gem supports
|
|
86
|
+
all applications such as DirectX games. Besides, it is very easy to install and
|
|
87
|
+
comes with many functions.
|
|
79
88
|
test_files: []
|