rubysketch 0.5.11 → 0.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +12 -0
- data/VERSION +1 -1
- data/lib/rubysketch/sprite.rb +34 -15
- data/rubysketch.gemspec +14 -17
- data/test/test_sprite.rb +14 -0
- metadata +17 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9ff22808787263a56e71165d0d8f21f1865aa6e6c513ad42a64e19926e17dca
|
4
|
+
data.tar.gz: fbb2cb7acab26bb79c47e23479fbe956511ce17996df5b30beba4d646cef175e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fc6252a4d104f5c8300ec904b7de9823c859103141469b926ceb7493253dd4b46a9a5d614314b2b417d20135b46b50efb5706b3eeaa5f3baa17b79f38c62fb3
|
7
|
+
data.tar.gz: 4dc519cb74d2bb0910618ba601da2207b6dfbe9604c0a7ebc931432c40d8e5af95e84bbb21cc4ff4c8f7583f9d77aedbfd248fb3ece8facc7e89fd76b8cdc100
|
data/ChangeLog.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
# rubysketch ChangeLog
|
2
2
|
|
3
3
|
|
4
|
+
## [v0.5.13] - 2023-05-29
|
5
|
+
|
6
|
+
- Update dependencies
|
7
|
+
|
8
|
+
|
9
|
+
## [v0.5.12] - 2023-05-27
|
10
|
+
|
11
|
+
- required_ruby_version >= 3.0.0
|
12
|
+
- Add spec.license
|
13
|
+
- Add fixAngle() and angleFixed() to Sprite class
|
14
|
+
|
15
|
+
|
4
16
|
## [v0.5.11] - 2023-05-26
|
5
17
|
|
6
18
|
- add left, top, right, and bottom accessors to Sprite class
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.13
|
data/lib/rubysketch/sprite.rb
CHANGED
@@ -15,25 +15,25 @@ module RubySketch
|
|
15
15
|
#
|
16
16
|
# @overload new(x, y, image: img)
|
17
17
|
# pos: [x, y], size: [image.width, image.height]
|
18
|
-
# @param [Numeric] x x of sprite position
|
19
|
-
# @param [Numeric] y y of sprite position
|
18
|
+
# @param [Numeric] x x of the sprite position
|
19
|
+
# @param [Numeric] y y of the sprite position
|
20
20
|
# @param [Image] img sprite image
|
21
21
|
#
|
22
22
|
# @overload new(x, y, w, h)
|
23
23
|
# pos(x, y), size: [w, h]
|
24
|
-
# @param [Numeric] x x of sprite position
|
25
|
-
# @param [Numeric] y y of sprite position
|
26
|
-
# @param [Numeric] w width of sprite
|
27
|
-
# @param [Numeric] h height of sprite
|
24
|
+
# @param [Numeric] x x of the sprite position
|
25
|
+
# @param [Numeric] y y of the sprite position
|
26
|
+
# @param [Numeric] w width of the sprite
|
27
|
+
# @param [Numeric] h height of the sprite
|
28
28
|
#
|
29
29
|
# @overload new(x, y, w, h, image: img, offset: off)
|
30
30
|
# pos: [x, y], size: [w, h], offset: [offset.x, offset.x]
|
31
|
-
# @param [Numeric] x x of sprite position
|
32
|
-
# @param [Numeric] y y of sprite position
|
33
|
-
# @param [Numeric] w width of sprite
|
34
|
-
# @param [Numeric] h height of sprite
|
31
|
+
# @param [Numeric] x x of the sprite position
|
32
|
+
# @param [Numeric] y y of the sprite position
|
33
|
+
# @param [Numeric] w width of the sprite
|
34
|
+
# @param [Numeric] h height of the sprite
|
35
35
|
# @param [Image] img sprite image
|
36
|
-
# @param [Vector] off offset of sprite image
|
36
|
+
# @param [Vector] off offset of the sprite image
|
37
37
|
#
|
38
38
|
def initialize(
|
39
39
|
x = 0, y = 0, w = nil, h = nil, image: nil, offset: nil,
|
@@ -321,7 +321,7 @@ module RubySketch
|
|
321
321
|
alias h height
|
322
322
|
alias h= height=
|
323
323
|
|
324
|
-
# Returns the rotation angle of sprite.
|
324
|
+
# Returns the rotation angle of the sprite.
|
325
325
|
#
|
326
326
|
# @return [Numeric] radians or degrees depending on angleMode()
|
327
327
|
#
|
@@ -330,7 +330,7 @@ module RubySketch
|
|
330
330
|
c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__
|
331
331
|
end
|
332
332
|
|
333
|
-
# Sets the rotation angle of sprite.
|
333
|
+
# Sets the rotation angle of the sprite.
|
334
334
|
#
|
335
335
|
# @param [Numeric] angle radians or degrees depending on angleMode()
|
336
336
|
#
|
@@ -343,7 +343,26 @@ module RubySketch
|
|
343
343
|
angle
|
344
344
|
end
|
345
345
|
|
346
|
-
#
|
346
|
+
# Fixes the angle of the sprite.
|
347
|
+
#
|
348
|
+
# @param [Boolean] fix fix rotation or not
|
349
|
+
#
|
350
|
+
# @return [Sprite] self
|
351
|
+
#
|
352
|
+
def fixAngle(fix = true)
|
353
|
+
@view__.fix_angle = fix
|
354
|
+
self
|
355
|
+
end
|
356
|
+
|
357
|
+
# Returns the angle of the sprite is fixed or not.
|
358
|
+
#
|
359
|
+
# @return [Boolean] whether the rotation is fixed or not
|
360
|
+
#
|
361
|
+
def angleFixed?()
|
362
|
+
@view__.fix_angle?
|
363
|
+
end
|
364
|
+
|
365
|
+
# Returns the rotation center of the sprite.
|
347
366
|
#
|
348
367
|
# @return [Array<Numeric>] [pivotX, pivotY]
|
349
368
|
#
|
@@ -351,7 +370,7 @@ module RubySketch
|
|
351
370
|
@view__.pivot.to_a[0, 2]
|
352
371
|
end
|
353
372
|
|
354
|
-
# Sets the rotation center of sprite.
|
373
|
+
# Sets the rotation center of the sprite.
|
355
374
|
# [0.0, 0.0] is the left-top, [1.0, 1.0] is the right-bottom, and [0.5, 0.5] is the center.
|
356
375
|
#
|
357
376
|
# @param [Array<Numeric>] ary an array of pivotX and pivotY
|
data/rubysketch.gemspec
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
# -*- mode: ruby -*-
|
2
2
|
|
3
3
|
|
4
|
-
|
5
|
-
.tap {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}
|
6
|
-
|
7
|
-
require 'rubysketch/extension'
|
4
|
+
require_relative 'lib/rubysketch/extension'
|
8
5
|
|
9
6
|
|
10
7
|
Gem::Specification.new do |s|
|
@@ -17,23 +14,23 @@ Gem::Specification.new do |s|
|
|
17
14
|
rdocs = glob.call *%w[README]
|
18
15
|
|
19
16
|
s.name = name
|
17
|
+
s.version = ext.version
|
18
|
+
s.license = 'MIT'
|
20
19
|
s.summary = 'A game engine based on the Processing API.'
|
21
20
|
s.description = 'A game engine based on the Processing API.'
|
22
|
-
s.
|
23
|
-
|
24
|
-
s.
|
25
|
-
s.email = 'xordog@gmail.com'
|
26
|
-
s.homepage = "https://github.com/xord/rubysketch"
|
21
|
+
s.authors = %w[xordog]
|
22
|
+
s.email = 'xordog@gmail.com'
|
23
|
+
s.homepage = "https://github.com/xord/rubysketch"
|
27
24
|
|
28
25
|
s.platform = Gem::Platform::RUBY
|
29
|
-
s.required_ruby_version = '>=
|
30
|
-
|
31
|
-
s.add_runtime_dependency 'xot', '~> 0.1.
|
32
|
-
s.add_runtime_dependency 'rucy', '~> 0.1.
|
33
|
-
s.add_runtime_dependency 'beeps', '~> 0.1.
|
34
|
-
s.add_runtime_dependency 'rays', '~> 0.1.
|
35
|
-
s.add_runtime_dependency 'reflexion', '~> 0.1.
|
36
|
-
s.add_runtime_dependency 'processing', '~> 0.5.
|
26
|
+
s.required_ruby_version = '>= 3.0.0'
|
27
|
+
|
28
|
+
s.add_runtime_dependency 'xot', '~> 0.1.38'
|
29
|
+
s.add_runtime_dependency 'rucy', '~> 0.1.38'
|
30
|
+
s.add_runtime_dependency 'beeps', '~> 0.1.39'
|
31
|
+
s.add_runtime_dependency 'rays', '~> 0.1.39'
|
32
|
+
s.add_runtime_dependency 'reflexion', '~> 0.1.41'
|
33
|
+
s.add_runtime_dependency 'processing', '~> 0.5.14'
|
37
34
|
|
38
35
|
s.add_development_dependency 'rake'
|
39
36
|
s.add_development_dependency 'test-unit'
|
data/test/test_sprite.rb
CHANGED
@@ -129,6 +129,20 @@ class TestSprite < Test::Unit::TestCase
|
|
129
129
|
assert_in_epsilon Math::PI, s.angle
|
130
130
|
end
|
131
131
|
|
132
|
+
def test_fixAngle()
|
133
|
+
s = sprite
|
134
|
+
assert_false s.angleFixed?
|
135
|
+
|
136
|
+
s.fixAngle true
|
137
|
+
assert_true s.angleFixed?
|
138
|
+
|
139
|
+
s.fixAngle false
|
140
|
+
assert_false s.angleFixed?
|
141
|
+
|
142
|
+
s.fixAngle
|
143
|
+
assert_true s.angleFixed?
|
144
|
+
end
|
145
|
+
|
132
146
|
def test_pivot()
|
133
147
|
s = sprite
|
134
148
|
assert_each_in_epsilon [0, 0], s.pivot
|
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.13
|
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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xot
|
@@ -16,84 +16,84 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.38
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.38
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rucy
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1.
|
33
|
+
version: 0.1.38
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1.
|
40
|
+
version: 0.1.38
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: beeps
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.1.
|
47
|
+
version: 0.1.39
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.
|
54
|
+
version: 0.1.39
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rays
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.1.
|
61
|
+
version: 0.1.39
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.1.
|
68
|
+
version: 0.1.39
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: reflexion
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.1.
|
75
|
+
version: 0.1.41
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.1.
|
82
|
+
version: 0.1.41
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: processing
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.5.
|
89
|
+
version: 0.5.14
|
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.14
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,7 +172,8 @@ files:
|
|
172
172
|
- test/helper.rb
|
173
173
|
- test/test_sprite.rb
|
174
174
|
homepage: https://github.com/xord/rubysketch
|
175
|
-
licenses:
|
175
|
+
licenses:
|
176
|
+
- MIT
|
176
177
|
metadata: {}
|
177
178
|
post_install_message:
|
178
179
|
rdoc_options: []
|
@@ -182,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
183
|
requirements:
|
183
184
|
- - ">="
|
184
185
|
- !ruby/object:Gem::Version
|
185
|
-
version:
|
186
|
+
version: 3.0.0
|
186
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
188
|
requirements:
|
188
189
|
- - ">="
|