sugarcube 3.3.6 → 3.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -3
- data/lib/cocoa/sugarcube-foundation/nsstring.rb +1 -5
- data/lib/cocoa/sugarcube-nscoder/nscoder.rb +0 -27
- data/lib/ios/sugarcube-nscoder/nscoder.rb +30 -0
- data/lib/osx/sugarcube-attributedstring/nsattributedstring.rb +11 -1
- data/lib/osx/sugarcube-color/fixnum.rb +1 -1
- data/lib/osx/sugarcube-color/nsarray.rb +1 -1
- data/lib/osx/sugarcube-color/nscolor.rb +22 -12
- data/lib/osx/sugarcube-nscoder/nscoder.rb +30 -0
- data/lib/osx/sugarcube-ui/symbol.rb +1 -0
- data/lib/version.rb +1 -1
- data/spec/cocoa/base64_spec.rb +0 -8
- data/spec/cocoa/nscoder_spec.rb +11 -3
- data/spec/cocoa/nsindexpath_spec.rb +1 -13
- data/spec/helpers/attributed_string.rb +4 -1
- data/spec/ios/base64_spec.rb +11 -0
- data/spec/ios/nsindexpath_spec.rb +15 -0
- data/spec/{cocoa → ios}/spritekit_spec.rb +0 -0
- data/spec/osx/base64_spec.rb +11 -0
- data/spec/osx/frameable_spec.rb +4 -4
- data/spec/osx/spritekit_spec.rb +110 -0
- metadata +14 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d3fac9ee41dbe6575a593c28e8ca78d4c4845cb
|
4
|
+
data.tar.gz: 4337469e97bb91230469148a7e43b7c033d5e1bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b73398655be28dce273a7ac5eafcb45572246feacddba87ba090db204576760a1d31f2969615868dbf78d57be732f878b851da3b0c14088bb094a076ba3dc34f
|
7
|
+
data.tar.gz: e9f30fdbaba910e761e6f146ca9bc3b6a376f0594cb714f496e50e64dc588298776f0f268f7806837d467d2c49f7e154a28af12704c955839c58af31846f0669
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ SugarCube
|
|
9
9
|
About
|
10
10
|
-----
|
11
11
|
|
12
|
-
CocoaTouch
|
12
|
+
Cocoa and CocoaTouch are *verbose* frameworks. These extensions hope to make
|
13
13
|
development in rubymotion more enjoyable. With SugarCube, you can create a color
|
14
14
|
from an integer or symbol, or create a UIFont or UIImage from a string.
|
15
15
|
|
@@ -1882,8 +1882,6 @@ Contributions
|
|
1882
1882
|
If you want to see new features, please fork, commit, and pull-request! :smiley:
|
1883
1883
|
|
1884
1884
|
[BubbleWrap]: https://github.com/rubymotion/BubbleWrap
|
1885
|
-
[SweetKit]: https://github.com/motion-kit/sweet-kit
|
1886
|
-
[MotionKit]: https://github.com/motion-kit/motion-kit
|
1887
1885
|
[nsnulldammit]: https://github.com/colinta/nsnulldammit
|
1888
1886
|
[geomotion]: https://github.com/clayallsopp/geomotion
|
1889
1887
|
|
@@ -30,18 +30,6 @@ class NSCoder
|
|
30
30
|
self.decodeIntegerForKey(key.to_s)
|
31
31
|
end
|
32
32
|
|
33
|
-
def point(key)
|
34
|
-
CGPointFromString(self.decodeObjectForKey(key.to_s))
|
35
|
-
end
|
36
|
-
|
37
|
-
def rect(key)
|
38
|
-
CGRectFromString(self.decodeObjectForKey(key.to_s))
|
39
|
-
end
|
40
|
-
|
41
|
-
def size(key)
|
42
|
-
CGSizeFromString(self.decodeObjectForKey(key.to_s))
|
43
|
-
end
|
44
|
-
|
45
33
|
def set(key, toBool: value)
|
46
34
|
self.encodeBool(value, forKey: key.to_s)
|
47
35
|
self
|
@@ -62,21 +50,6 @@ class NSCoder
|
|
62
50
|
self
|
63
51
|
end
|
64
52
|
|
65
|
-
def set(key, toPoint: value)
|
66
|
-
self.encodeObject(NSStringFromCGPoint(value), forKey: key.to_s)
|
67
|
-
self
|
68
|
-
end
|
69
|
-
|
70
|
-
def set(key, toRect: value)
|
71
|
-
self.encodeObject(NSStringFromCGRect(value), forKey: key.to_s)
|
72
|
-
self
|
73
|
-
end
|
74
|
-
|
75
|
-
def set(key, toSize: value)
|
76
|
-
self.encodeObject(NSStringFromCGSize(value), forKey: key.to_s)
|
77
|
-
self
|
78
|
-
end
|
79
|
-
|
80
53
|
end
|
81
54
|
|
82
55
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class NSCoder
|
2
|
+
|
3
|
+
def point(key)
|
4
|
+
CGPointFromString(self.decodeObjectForKey(key.to_s))
|
5
|
+
end
|
6
|
+
|
7
|
+
def rect(key)
|
8
|
+
CGRectFromString(self.decodeObjectForKey(key.to_s))
|
9
|
+
end
|
10
|
+
|
11
|
+
def size(key)
|
12
|
+
CGSizeFromString(self.decodeObjectForKey(key.to_s))
|
13
|
+
end
|
14
|
+
|
15
|
+
def set(key, toPoint: value)
|
16
|
+
self.encodeObject(NSStringFromCGPoint(value), forKey: key.to_s)
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def set(key, toRect: value)
|
21
|
+
self.encodeObject(NSStringFromCGRect(value), forKey: key.to_s)
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def set(key, toSize: value)
|
26
|
+
self.encodeObject(NSStringFromCGSize(value), forKey: key.to_s)
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -4,6 +4,10 @@ class NSString
|
|
4
4
|
nsattributedstring.bold(size)
|
5
5
|
end
|
6
6
|
|
7
|
+
def italic(size=nil)
|
8
|
+
nsattributedstring.italic(size)
|
9
|
+
end
|
10
|
+
|
7
11
|
def monospace(size=nil)
|
8
12
|
nsattributedstring.monospace(size)
|
9
13
|
end
|
@@ -32,6 +36,12 @@ class NSAttributedString
|
|
32
36
|
self.font(font)
|
33
37
|
end
|
34
38
|
|
39
|
+
def italic(size=nil)
|
40
|
+
size ||= NSFont.systemFontSize
|
41
|
+
font = NSFont.fontWithName('HelveticaNeue-Italic', size: size)
|
42
|
+
self.font(font)
|
43
|
+
end
|
44
|
+
|
35
45
|
def font(value)
|
36
46
|
value = value.nsfont if value.respond_to?(:nsfont)
|
37
47
|
with_attributes({ NSFontAttributeName => value })
|
@@ -40,7 +50,7 @@ class NSAttributedString
|
|
40
50
|
def monospace(size=nil)
|
41
51
|
size ||= NSFont.systemFontSize
|
42
52
|
font = NSFont.fontWithName('Courier New', size: size)
|
43
|
-
self.font(
|
53
|
+
self.font(font)
|
44
54
|
end
|
45
55
|
|
46
56
|
def underline
|
@@ -15,16 +15,25 @@ class NSColor
|
|
15
15
|
def nscolor(alpha=nil)
|
16
16
|
if alpha
|
17
17
|
if named_color_space?
|
18
|
-
self.colorUsingColorSpace(NSColorSpace.genericRGBColorSpace)
|
19
|
-
|
20
|
-
|
18
|
+
color = self.colorUsingColorSpace(NSColorSpace.genericRGBColorSpace)
|
19
|
+
if color
|
20
|
+
return color.colorWithAlphaComponent(alpha.to_f)
|
21
|
+
end
|
21
22
|
end
|
23
|
+
return self.colorWithAlphaComponent(alpha.to_f)
|
24
|
+
elsif named_color_space?
|
25
|
+
color = self.colorUsingColorSpace(NSColorSpace.genericRGBColorSpace)
|
26
|
+
return color if color
|
27
|
+
end
|
28
|
+
|
29
|
+
return self
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.rgba(r, g, b, a)
|
33
|
+
if NSColor.respond_to?('colorWithRed:green:blue:alpha:')
|
34
|
+
NSColor.colorWithRed(r, green: g, blue: b, alpha: a)
|
22
35
|
else
|
23
|
-
|
24
|
-
self.colorUsingColorSpace(NSColorSpace.genericRGBColorSpace)
|
25
|
-
else
|
26
|
-
self
|
27
|
-
end
|
36
|
+
NSColor.colorWithCalibratedRed(r, green: g, blue: b, alpha: a)
|
28
37
|
end
|
29
38
|
end
|
30
39
|
|
@@ -59,7 +68,8 @@ class NSColor
|
|
59
68
|
g = [1.0, color.green * color.alpha + self.green].min
|
60
69
|
b = [1.0, color.blue * color.alpha + self.blue].min
|
61
70
|
a = self.alpha
|
62
|
-
|
71
|
+
|
72
|
+
NSColor.rgba(r, g, b, a)
|
63
73
|
end
|
64
74
|
|
65
75
|
# a more generic color mixing method. mixes two colors, but a second
|
@@ -80,7 +90,7 @@ class NSColor
|
|
80
90
|
g = (self.green + color.green) / 2
|
81
91
|
b = (self.blue + color.blue) / 2
|
82
92
|
a = self.alpha
|
83
|
-
NSColor.
|
93
|
+
NSColor.rgba(r, g, b, a)
|
84
94
|
else
|
85
95
|
a = (color.alpha - self.alpha) * amount + self.alpha
|
86
96
|
return NSColor.clearColor if a == 0
|
@@ -95,7 +105,7 @@ class NSColor
|
|
95
105
|
r = (color_red - self_red) * amount + self_red
|
96
106
|
g = (color_green - self_green) * amount + self_green
|
97
107
|
b = (color_blue - self_blue) * amount + self_blue
|
98
|
-
NSColor.
|
108
|
+
NSColor.rgba(r, g, b, a)
|
99
109
|
end
|
100
110
|
end
|
101
111
|
|
@@ -107,7 +117,7 @@ class NSColor
|
|
107
117
|
g = 1.0 - self.green
|
108
118
|
b = 1.0 - self.blue
|
109
119
|
a = self.alpha
|
110
|
-
NSColor.
|
120
|
+
NSColor.rgba(r, g, b, a)
|
111
121
|
end
|
112
122
|
|
113
123
|
# Cannot define method `hue' because no Objective-C stub was pre-compiled for
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class NSCoder
|
2
|
+
|
3
|
+
def point(key)
|
4
|
+
self.decodeObjectForKey(key.to_s).pointValue
|
5
|
+
end
|
6
|
+
|
7
|
+
def rect(key)
|
8
|
+
self.decodeObjectForKey(key.to_s).rectValue
|
9
|
+
end
|
10
|
+
|
11
|
+
def size(key)
|
12
|
+
self.decodeObjectForKey(key.to_s).sizeValue
|
13
|
+
end
|
14
|
+
|
15
|
+
def set(key, toPoint: value)
|
16
|
+
self.encodeObject(NSValue.valueWithPoint(value), forKey: key.to_s)
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def set(key, toRect: value)
|
21
|
+
self.encodeObject(NSValue.valueWithRect(value), forKey: key.to_s)
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def set(key, toSize: value)
|
26
|
+
self.encodeObject(NSValue.valueWithSize(value), forKey: key.to_s)
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/lib/version.rb
CHANGED
data/spec/cocoa/base64_spec.rb
CHANGED
@@ -30,12 +30,4 @@ describe 'Base64' do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
describe 'UIImage' do
|
34
|
-
|
35
|
-
it 'should convert image data (PNG) to base64' do
|
36
|
-
'test'.uiimage.nsdata.to_base64.should == 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAHgCAIAAADrGJBNAAAAAXNSR0IArs4c6QAAABxpRE9UAAAAAgAAAAAAAADwAAAAKAAAAPAAAADwAAAAS9r5uVEAAAAXSURBVEgNYrhrxMAwikfDYDQNDMk0AAAAAP//6TQa9AAAABVJREFUY7hrxMAwikfDYDQNDMk0AACNnfwwqs717AAAAABJRU5ErkJggg=='
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
33
|
end
|
data/spec/cocoa/nscoder_spec.rb
CHANGED
@@ -67,9 +67,17 @@ describe "NSCoder" do
|
|
67
67
|
test.double.should == @subject.double
|
68
68
|
test.float.should == @subject.float
|
69
69
|
test.int.should == @subject.int
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
val = test.point
|
71
|
+
val.x.should == @subject.point.x
|
72
|
+
val.y.should == @subject.point.y
|
73
|
+
val = test.rect
|
74
|
+
val.origin.x.should == @subject.rect.origin.x
|
75
|
+
val.origin.y.should == @subject.rect.origin.y
|
76
|
+
val.size.width.should == @subject.rect.size.width
|
77
|
+
val.size.height.should == @subject.rect.size.height
|
78
|
+
val = test.size
|
79
|
+
val.width.should == @subject.size.width
|
80
|
+
val.height.should == @subject.size.height
|
73
81
|
end
|
74
82
|
|
75
83
|
end
|
@@ -6,21 +6,9 @@ describe NSIndexPath do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should have to_ary' do
|
9
|
-
a, b = NSIndexPath.indexPathWithIndex(1).indexPathByAddingIndex(3)
|
9
|
+
a, b = NSIndexPath.indexPathWithIndex(1).indexPathByAddingIndex(3).to_ary
|
10
10
|
a.should == 1
|
11
11
|
b.should == 3
|
12
12
|
end
|
13
13
|
|
14
|
-
it 'should support indexPathForRow(inSection:)' do
|
15
|
-
path = NSIndexPath.indexPathForRow(1, inSection: 3).to_a
|
16
|
-
path[0].should == 3
|
17
|
-
path[1].should == 1
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should support indexPathForItem(inSection:)' do
|
21
|
-
path = NSIndexPath.indexPathForItem(1, inSection: 3).to_a
|
22
|
-
path[0].should == 3
|
23
|
-
path[1].should == 1
|
24
|
-
end
|
25
|
-
|
26
14
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
class Should
|
2
2
|
def have_string_attributes(attributes)
|
3
3
|
@object.should.be.kind_of(NSAttributedString)
|
4
|
-
@object.attributesAtIndex(0, effectiveRange:nil)
|
4
|
+
has_attrs = @object.attributesAtIndex(0, effectiveRange: nil)
|
5
|
+
attributes.each do |key, value|
|
6
|
+
has_attrs[key].should == attributes[key]
|
7
|
+
end
|
5
8
|
end
|
6
9
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
describe 'Base64' do
|
2
|
+
|
3
|
+
describe 'UIImage' do
|
4
|
+
|
5
|
+
it 'should convert image data (PNG) to base64' do
|
6
|
+
'test'.uiimage.nsdata.to_base64.should == 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAHgCAIAAADrGJBNAAAAAXNSR0IArs4c6QAAABxpRE9UAAAAAgAAAAAAAADwAAAAKAAAAPAAAADwAAAAS9r5uVEAAAAXSURBVEgNYrhrxMAwikfDYDQNDMk0AAAAAP//6TQa9AAAABVJREFUY7hrxMAwikfDYDQNDMk0AACNnfwwqs717AAAAABJRU5ErkJggg=='
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
describe NSIndexPath do
|
2
|
+
|
3
|
+
it 'should support indexPathForRow(inSection:)' do
|
4
|
+
path = NSIndexPath.indexPathForRow(1, inSection: 3).to_a
|
5
|
+
path[0].should == 3
|
6
|
+
path[1].should == 1
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should support indexPathForItem(inSection:)' do
|
10
|
+
path = NSIndexPath.indexPathForItem(1, inSection: 3).to_a
|
11
|
+
path[0].should == 3
|
12
|
+
path[1].should == 1
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
describe 'Base64' do
|
2
|
+
|
3
|
+
describe 'NSImage' do
|
4
|
+
|
5
|
+
it 'should convert image data (PNG) to base64' do
|
6
|
+
'test'.nsimage.nsdata.to_base64.should == 'iVBORw0KGgoAAAANSUhEUgAAAAIAAAPACAYAAAAffqgGAAAKB2lDQ1BJQ0MgUHJvZmlsZQAASImFlndUVNcWxs+90xtthqH3MvReBpDem/QqKsMAQxcGBhAbIkEFIoqICCgBCVXBaKixIKJYCAIKWNCABAElBgugovIukJf4spL19l1nnd/61j7f3ffMH/MBQHJjJSbGwQIAxCekcL0dbWQDg4Jlcb8APCABAhAAcix2cqK1p6cb+NdaHAHQ6n5Pc9Xr3/v+sQTDI5LZAECeCDPZidwUhA8g7JuWkrjKYwjTuMhQCM+vMmeNYfQqh62z6FqPr7ctwhoA4MksFpcDAJGJ6LKpbA7iQwxEWCchPDoB4VV/C3YUKxzhmwhrRMbx0hF+t9oTH78N0UmKCKuEfeXJ+R//sD/9WSzOnxwfx2P/8V2rN0KOSPDzQXZxZEmCSKAF4gAPpANZkAi4YBuiRCNKBHL3/3yOuXbOFulMBNuRE9GAA6JACnLe4SsvnzWnFJAGWEhPBKK4IY/t6u+4bvmWvuYK0W//pSV1AWCSi4icvzSWAgAdzwGgLv6lKbxBxjkMwKUBNo+buq6tXj3AACLgBzQgBqSBAlABmkAPGAEzYAXsgQvwAL4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W93zO/r68Rr8mr+VybUDte513XU29cX98g2VDQCDfyGmfPhJwZOGt3tr1Js6mymd6cdw6c45178UPoDyPnXc93X2BeaPpR6cfyFmpLbivUur11vi2qbbw9qH2ww6Wju9Oss+UnrZ9qL8pdLLskfKngMvFy9uWVKxlXFroSu+aucq5Odm/tfnwt8Nr9Hq+e/uuu12/ecLhxrde698pN85sXb5ne6rjNvN12x+hOa59hX8vPhj+39Bv1t941vts+YDLQObhh8PKQ5dDVe3b3btx3vn9neOPw4IjfyIPRkNHxB+EPZh7GPXz9KPXR8uPMMcxY7hOBJ8VPJZ9W/aL6S/O40filCbuJvmc+zx5Psidf/pr866ep7OeU58XTMtP1M3ozF2cdZgdebHox9TLx5fJczm+Cv5W/Unn14+9Wv/fNB85Pvea+XnmT/1bsbe07g3fdC54LTxfjF5eXct+Lva/7wPzQ+zHg4/Ry2ifcp5LPqp87v7h+GVuJX1lJZHFZa1EAhSw4MhKAN7UAUIKQ7DCAZCG+9cz1R56Bvko2/2Ww8vwrHlnPZWtlBECtFQB+mQC4IRnlFLKUECYj+2pE9LUCsL7+n+uPSo7U11t/B5mLRJP3KytvpQDAdQLwmbuysnxyZeVzNTLsQwC6kv7vbH/j9Ty4WlgkJRcyRNVotwfY0Zngb/UfmNe/mkvfW+8AAAAJcEhZcwAAFiUAABYlAUlSJPAAAABXSURBVGgF7dNBEQAgCABBNQVB7F/EMCqYwd/yYHgzt33N2O3OyJXj8IQKQQk4vBCUoAQlUEABBRRQQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEDBdwUHOmIJpvu7oywAAAAASUVORK5CYII='
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
data/spec/osx/frameable_spec.rb
CHANGED
@@ -154,22 +154,22 @@ describe SugarCube::Frameable do
|
|
154
154
|
describe NSScreen do
|
155
155
|
|
156
156
|
it 'should return x' do
|
157
|
-
view = NSScreen.
|
157
|
+
view = NSScreen.mainScreen
|
158
158
|
view.x.should == view.frame.origin.x
|
159
159
|
end
|
160
160
|
|
161
161
|
it 'should return y' do
|
162
|
-
view = NSScreen.
|
162
|
+
view = NSScreen.mainScreen
|
163
163
|
view.y.should == view.frame.origin.y
|
164
164
|
end
|
165
165
|
|
166
166
|
it 'should return width' do
|
167
|
-
view = NSScreen.
|
167
|
+
view = NSScreen.mainScreen
|
168
168
|
view.width.should == view.frame.size.width
|
169
169
|
end
|
170
170
|
|
171
171
|
it 'should return height' do
|
172
|
-
view = NSScreen.
|
172
|
+
view = NSScreen.mainScreen
|
173
173
|
view.height.should == view.frame.size.height
|
174
174
|
end
|
175
175
|
|
@@ -0,0 +1,110 @@
|
|
1
|
+
describe 'SpriteKit' do
|
2
|
+
|
3
|
+
before do
|
4
|
+
scene = SKScene.alloc.initWithSize([10, 10])
|
5
|
+
path = CGPathCreateWithRect([[0, 0], [10, 10]], nil)
|
6
|
+
|
7
|
+
@node_a = SKShapeNode.shapeNodeWithPath(path, centered: true)
|
8
|
+
@node_a.position = [100, 100]
|
9
|
+
@node_a.name = 'parent'
|
10
|
+
scene.addChild(@node_a)
|
11
|
+
|
12
|
+
@node_b = SKShapeNode.shapeNodeWithPath(path, centered: true)
|
13
|
+
@node_b.position = [0, 20]
|
14
|
+
@node_b.name = 'child'
|
15
|
+
@node_c = SKShapeNode.shapeNodeWithPath(path, centered: true)
|
16
|
+
@node_c.position = [20, 20]
|
17
|
+
@node_c.name = 'child'
|
18
|
+
@node_d = SKShapeNode.shapeNodeWithPath(path, centered: true)
|
19
|
+
@node_d.position = [20, 0]
|
20
|
+
@node_d.name = 'not a child!'
|
21
|
+
|
22
|
+
|
23
|
+
main_window = NSWindow.alloc.initWithContentRect([[240, 180], [480, 360]],
|
24
|
+
styleMask: NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask,
|
25
|
+
backing: NSBackingStoreBuffered,
|
26
|
+
defer: false)
|
27
|
+
main_window.orderFrontRegardless
|
28
|
+
|
29
|
+
view = SKView.new
|
30
|
+
main_window.contentView.addSubview(view)
|
31
|
+
view.presentScene(scene)
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '<< method' do
|
35
|
+
it 'should add child nodes' do
|
36
|
+
@node_a << @node_b
|
37
|
+
@node_a << @node_c
|
38
|
+
@node_b.parent.should == @node_a
|
39
|
+
@node_c.parent.should == @node_a
|
40
|
+
@node_a.children.should == [@node_b, @node_c]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'run_action method' do
|
45
|
+
it 'should run an action and then call the completion block' do
|
46
|
+
@completed = false
|
47
|
+
|
48
|
+
@node_a.run_action(SKAction.moveTo([1, 1], duration: 1)) do
|
49
|
+
@completed = true
|
50
|
+
end
|
51
|
+
|
52
|
+
wait 2 do
|
53
|
+
@completed.should == true
|
54
|
+
@node_a.position.x.should == 1
|
55
|
+
@node_a.position.y.should == 1
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '[] and []= methods' do
|
61
|
+
it 'should assign user data with []=' do
|
62
|
+
@node_a['life'] = 100
|
63
|
+
@node_a.userData['life'].should == 100
|
64
|
+
end
|
65
|
+
it 'should assign user data and convert symbols to strings' do
|
66
|
+
@node_a[:life] = 100
|
67
|
+
@node_a.userData['life'].should == 100
|
68
|
+
end
|
69
|
+
it 'should get user data with []' do
|
70
|
+
@node_a['life'] = 100
|
71
|
+
@node_a['life'].should == 100
|
72
|
+
end
|
73
|
+
it 'should get user data and convert symbols to strings' do
|
74
|
+
@node_a[:life] = 100
|
75
|
+
@node_a[:life].should == 100
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe 'each_named method' do
|
80
|
+
before do
|
81
|
+
@node_a << @node_b
|
82
|
+
@node_a << @node_c
|
83
|
+
@node_a << @node_d
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should iterate over child nodes (arity: 1)' do
|
87
|
+
@found_b = false
|
88
|
+
@found_c = false
|
89
|
+
@found_d = false
|
90
|
+
@node_a.each_named('child') do |node|
|
91
|
+
@found_b = true if node == @node_b
|
92
|
+
@found_c = true if node == @node_c
|
93
|
+
@found_d = true if node == @node_d
|
94
|
+
end
|
95
|
+
@found_b.should == true
|
96
|
+
@found_c.should == true
|
97
|
+
@found_d.should == false
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'should iterate over child nodes and stop with stop-pointer (arity: 2)' do
|
101
|
+
@found = 0
|
102
|
+
@node_a.each_named('child') do |node, stop_ptr|
|
103
|
+
@found += 1
|
104
|
+
stop_ptr.assign(true)
|
105
|
+
end
|
106
|
+
@found.should == 1
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugarcube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin T.A. Gray
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: |
|
18
18
|
== Description
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/ios/sugarcube-image/uicolor.rb
|
134
134
|
- lib/ios/sugarcube-image/uiimage.rb
|
135
135
|
- lib/ios/sugarcube-modal/modal.rb
|
136
|
+
- lib/ios/sugarcube-nscoder/nscoder.rb
|
136
137
|
- lib/ios/sugarcube-nsdata/nsdata.rb
|
137
138
|
- lib/ios/sugarcube-nsdata/uiimage.rb
|
138
139
|
- lib/ios/sugarcube-numbers/nsnumber.rb
|
@@ -167,6 +168,7 @@ files:
|
|
167
168
|
- lib/osx/sugarcube-color/nsstring.rb
|
168
169
|
- lib/osx/sugarcube-color/symbol.rb
|
169
170
|
- lib/osx/sugarcube-constants/symbol.rb
|
171
|
+
- lib/osx/sugarcube-nscoder/nscoder.rb
|
170
172
|
- lib/osx/sugarcube-nsdata/nsdata.rb
|
171
173
|
- lib/osx/sugarcube-nsdata/nsimage.rb
|
172
174
|
- lib/osx/sugarcube-numbers/nsnumber.rb
|
@@ -233,11 +235,11 @@ files:
|
|
233
235
|
- spec/cocoa/nsdictionary_files_spec.rb
|
234
236
|
- spec/cocoa/nsindexpath_spec.rb
|
235
237
|
- spec/cocoa/numeric_time_spec.rb
|
236
|
-
- spec/cocoa/spritekit_spec.rb
|
237
238
|
- spec/cocoa/timer_spec.rb
|
238
239
|
- spec/helpers/attributed_string.rb
|
239
240
|
- spec/ios/568_spec.rb
|
240
241
|
- spec/ios/animation_chain_spec.rb
|
242
|
+
- spec/ios/base64_spec.rb
|
241
243
|
- spec/ios/color_components_spec.rb
|
242
244
|
- spec/ios/color_other_representations_spec.rb
|
243
245
|
- spec/ios/color_spec.rb
|
@@ -259,6 +261,7 @@ files:
|
|
259
261
|
- spec/ios/nsdate_delta_spec.rb
|
260
262
|
- spec/ios/nsdate_spec.rb
|
261
263
|
- spec/ios/nsdate_upto_spec.rb
|
264
|
+
- spec/ios/nsindexpath_spec.rb
|
262
265
|
- spec/ios/nsorderedset_spec.rb
|
263
266
|
- spec/ios/nsset_spec.rb
|
264
267
|
- spec/ios/nsstring_files_spec.rb
|
@@ -267,6 +270,7 @@ files:
|
|
267
270
|
- spec/ios/nsurl_spec.rb
|
268
271
|
- spec/ios/numeric_spec.rb
|
269
272
|
- spec/ios/pipes_spec.rb
|
273
|
+
- spec/ios/spritekit_spec.rb
|
270
274
|
- spec/ios/symbol_constants_spec.rb
|
271
275
|
- spec/ios/symbol_uicolor_spec.rb
|
272
276
|
- spec/ios/symbol_uifont_spec.rb
|
@@ -289,12 +293,14 @@ files:
|
|
289
293
|
- spec/ios/uiviewcontroller_spec.rb
|
290
294
|
- spec/ios/uiwebview_spec.rb
|
291
295
|
- spec/ios/unholy_spec.rb
|
296
|
+
- spec/osx/base64_spec.rb
|
292
297
|
- spec/osx/color_components_spec.rb
|
293
298
|
- spec/osx/color_other_representations_spec.rb
|
294
299
|
- spec/osx/color_spec.rb
|
295
300
|
- spec/osx/frameable_spec.rb
|
296
301
|
- spec/osx/nsattributedstring_spec.rb
|
297
302
|
- spec/osx/nsview_spec.rb
|
303
|
+
- spec/osx/spritekit_spec.rb
|
298
304
|
- spec/osx/symbol_constants_spec.rb
|
299
305
|
homepage: https://github.com/rubymotion/sugarcube
|
300
306
|
licenses:
|
@@ -334,11 +340,11 @@ test_files:
|
|
334
340
|
- spec/cocoa/nsdictionary_files_spec.rb
|
335
341
|
- spec/cocoa/nsindexpath_spec.rb
|
336
342
|
- spec/cocoa/numeric_time_spec.rb
|
337
|
-
- spec/cocoa/spritekit_spec.rb
|
338
343
|
- spec/cocoa/timer_spec.rb
|
339
344
|
- spec/helpers/attributed_string.rb
|
340
345
|
- spec/ios/568_spec.rb
|
341
346
|
- spec/ios/animation_chain_spec.rb
|
347
|
+
- spec/ios/base64_spec.rb
|
342
348
|
- spec/ios/color_components_spec.rb
|
343
349
|
- spec/ios/color_other_representations_spec.rb
|
344
350
|
- spec/ios/color_spec.rb
|
@@ -360,6 +366,7 @@ test_files:
|
|
360
366
|
- spec/ios/nsdate_delta_spec.rb
|
361
367
|
- spec/ios/nsdate_spec.rb
|
362
368
|
- spec/ios/nsdate_upto_spec.rb
|
369
|
+
- spec/ios/nsindexpath_spec.rb
|
363
370
|
- spec/ios/nsorderedset_spec.rb
|
364
371
|
- spec/ios/nsset_spec.rb
|
365
372
|
- spec/ios/nsstring_files_spec.rb
|
@@ -368,6 +375,7 @@ test_files:
|
|
368
375
|
- spec/ios/nsurl_spec.rb
|
369
376
|
- spec/ios/numeric_spec.rb
|
370
377
|
- spec/ios/pipes_spec.rb
|
378
|
+
- spec/ios/spritekit_spec.rb
|
371
379
|
- spec/ios/symbol_constants_spec.rb
|
372
380
|
- spec/ios/symbol_uicolor_spec.rb
|
373
381
|
- spec/ios/symbol_uifont_spec.rb
|
@@ -390,10 +398,12 @@ test_files:
|
|
390
398
|
- spec/ios/uiviewcontroller_spec.rb
|
391
399
|
- spec/ios/uiwebview_spec.rb
|
392
400
|
- spec/ios/unholy_spec.rb
|
401
|
+
- spec/osx/base64_spec.rb
|
393
402
|
- spec/osx/color_components_spec.rb
|
394
403
|
- spec/osx/color_other_representations_spec.rb
|
395
404
|
- spec/osx/color_spec.rb
|
396
405
|
- spec/osx/frameable_spec.rb
|
397
406
|
- spec/osx/nsattributedstring_spec.rb
|
398
407
|
- spec/osx/nsview_spec.rb
|
408
|
+
- spec/osx/spritekit_spec.rb
|
399
409
|
- spec/osx/symbol_constants_spec.rb
|