rubysketch 0.5.9 → 0.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +11 -0
- data/VERSION +1 -1
- data/lib/rubysketch/context.rb +1 -0
- data/lib/rubysketch/sprite.rb +102 -0
- data/rubysketch.gemspec +1 -1
- data/test/test_sprite.rb +12 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 490ad6d83ad2f897ed160216fdb6c94483d8f34da226b494277545f4b36903f2
|
4
|
+
data.tar.gz: 3d8a65cead4ac68e5f1f77aa51207a9fa104285937658065f2ac9a381cac77c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3895b2de3b7f49a2e3081ea4997e62f9812898b114ea3882b7fddbc9112a5dd34938bc7b591d7952bf1d2496bb77426aa10fcefb32bc915e1590416b59e019fc
|
7
|
+
data.tar.gz: 2c98ad73d3314fe861ff8d9ab4a63e8ef82dd357e1771de77b336b54bfbe9c8263a3c25d48583f21c361bfc3d1d8c8314cebb4350615eb8b08f2da661bec5814
|
data/ChangeLog.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# rubysketch ChangeLog
|
2
2
|
|
3
3
|
|
4
|
+
## [v0.5.11] - 2023-05-26
|
5
|
+
|
6
|
+
- add left, top, right, and bottom accessors to Sprite class
|
7
|
+
- add show(), hide(), and hidden?() to Sprite class
|
8
|
+
|
9
|
+
|
10
|
+
## [v0.5.10] - 2023-05-21
|
11
|
+
|
12
|
+
- Update dependencies
|
13
|
+
|
14
|
+
|
4
15
|
## [v0.5.9] - 2023-05-19
|
5
16
|
|
6
17
|
- Add Sprite#clickCount()
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.11
|
data/lib/rubysketch/context.rb
CHANGED
@@ -74,6 +74,7 @@ module RubySketch
|
|
74
74
|
def sprite(*sprites)
|
75
75
|
sprites.flatten! if sprites.first&.is_a? Array
|
76
76
|
sprites.each do |sp|
|
77
|
+
next if sp.hidden?
|
77
78
|
view, draw = sp.getInternal__, sp.instance_variable_get(:@drawBlock__)
|
78
79
|
f, degrees, pivot = view.frame, view.angle, view.pivot
|
79
80
|
if draw
|
data/lib/rubysketch/sprite.rb
CHANGED
@@ -54,6 +54,35 @@ module RubySketch
|
|
54
54
|
self.offset = offset if offset
|
55
55
|
end
|
56
56
|
|
57
|
+
# Shows the sprite
|
58
|
+
#
|
59
|
+
# Since one call to "hide()" increases the hide count, it is necessary to call "show()" n times to make the sprite visible again after calling "hide()" n times.
|
60
|
+
#
|
61
|
+
# @return [Sprite] self
|
62
|
+
#
|
63
|
+
def show()
|
64
|
+
@view__.show
|
65
|
+
self
|
66
|
+
end
|
67
|
+
|
68
|
+
# Hides the sprite
|
69
|
+
#
|
70
|
+
# Since one call to "hide()" increases the hide count, it is necessary to call "show()" n times to make the sprite visible again after calling "hide()" n times.
|
71
|
+
#
|
72
|
+
# @return [Sprite] self
|
73
|
+
#
|
74
|
+
def hide()
|
75
|
+
@view__.hide
|
76
|
+
end
|
77
|
+
|
78
|
+
# Returns the sprite is visible
|
79
|
+
#
|
80
|
+
# @return [Boolean] true: invisible, false: visible
|
81
|
+
#
|
82
|
+
def hidden?()
|
83
|
+
@view__.hidden?
|
84
|
+
end
|
85
|
+
|
57
86
|
# Returns the position of the sprite.
|
58
87
|
#
|
59
88
|
# @return [Vector] position
|
@@ -137,6 +166,79 @@ module RubySketch
|
|
137
166
|
alias pos position
|
138
167
|
alias pos= position=
|
139
168
|
|
169
|
+
# Returns the left position of the sprite.
|
170
|
+
#
|
171
|
+
# @return [Numeric] left position
|
172
|
+
#
|
173
|
+
def left()
|
174
|
+
@view__.left
|
175
|
+
end
|
176
|
+
|
177
|
+
# Set the left position of the sprite.
|
178
|
+
#
|
179
|
+
# @param [Numeric] n sprite left position
|
180
|
+
#
|
181
|
+
# @return [Numeric] sprite left position
|
182
|
+
#
|
183
|
+
def left=(n)
|
184
|
+
@view__.left = n
|
185
|
+
n
|
186
|
+
end
|
187
|
+
|
188
|
+
# Returns the top position of the sprite.
|
189
|
+
#
|
190
|
+
# @return [Numeric] top position
|
191
|
+
#
|
192
|
+
def top()
|
193
|
+
@view__.top
|
194
|
+
end
|
195
|
+
|
196
|
+
# Set the top position of the sprite.
|
197
|
+
#
|
198
|
+
# @param [Numeric] n sprite top position
|
199
|
+
#
|
200
|
+
# @return [Numeric] sprite top position
|
201
|
+
#
|
202
|
+
def top=(n)
|
203
|
+
@view__.top = n
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the right position of the sprite.
|
207
|
+
#
|
208
|
+
# @return [Numeric] right position
|
209
|
+
#
|
210
|
+
def right()
|
211
|
+
@view__.right
|
212
|
+
end
|
213
|
+
|
214
|
+
# Set the right position of the sprite.
|
215
|
+
#
|
216
|
+
# @param [Numeric] n sprite right position
|
217
|
+
#
|
218
|
+
# @return [Numeric] sprite right position
|
219
|
+
#
|
220
|
+
def right=(n)
|
221
|
+
@view__.right = n
|
222
|
+
end
|
223
|
+
|
224
|
+
# Returns the bottom position of the sprite.
|
225
|
+
#
|
226
|
+
# @return [Numeric] bottom
|
227
|
+
#
|
228
|
+
def bottom()
|
229
|
+
@view__.bottom
|
230
|
+
end
|
231
|
+
|
232
|
+
# Set the bottom position of the sprite.
|
233
|
+
#
|
234
|
+
# @param [Numeric] n sprite bottom position
|
235
|
+
#
|
236
|
+
# @return [Numeric] sprite bottom position
|
237
|
+
#
|
238
|
+
def bottom=(bottom)
|
239
|
+
@view__.bottom = bottom
|
240
|
+
end
|
241
|
+
|
140
242
|
# Returns the center position of the sprite.
|
141
243
|
#
|
142
244
|
# @return [Vector] center position
|
data/rubysketch.gemspec
CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_runtime_dependency 'beeps', '~> 0.1.37'
|
34
34
|
s.add_runtime_dependency 'rays', '~> 0.1.37'
|
35
35
|
s.add_runtime_dependency 'reflexion', '~> 0.1.39'
|
36
|
-
s.add_runtime_dependency 'processing', '~> 0.5.
|
36
|
+
s.add_runtime_dependency 'processing', '~> 0.5.12'
|
37
37
|
|
38
38
|
s.add_development_dependency 'rake'
|
39
39
|
s.add_development_dependency 'test-unit'
|
data/test/test_sprite.rb
CHANGED
@@ -39,6 +39,18 @@ class TestSprite < Test::Unit::TestCase
|
|
39
39
|
assert_raise {sprite 0, 0, 0, -1}
|
40
40
|
end
|
41
41
|
|
42
|
+
def test_show_hide()
|
43
|
+
s = sprite; assert_false s.hidden?
|
44
|
+
s.hide; assert_true s.hidden?
|
45
|
+
s.show; assert_false s.hidden?
|
46
|
+
2.times {s.hide}; assert_true s.hidden?
|
47
|
+
s.show; assert_true s.hidden?
|
48
|
+
s.show; assert_false s.hidden?
|
49
|
+
s.show; assert_false s.hidden?
|
50
|
+
s.hide; assert_false s.hidden?
|
51
|
+
s.hide; assert_true s.hidden?
|
52
|
+
end
|
53
|
+
|
42
54
|
def test_position()
|
43
55
|
s = sprite
|
44
56
|
assert_equal vec(0, 0), s.pos
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysketch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xot
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.5.
|
89
|
+
version: 0.5.12
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.5.
|
96
|
+
version: 0.5.12
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|