sugarcube 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/sugarcube.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  unless defined?(Motion::Project::Config)
2
- raise "This file must be required within a RubyMotion project Rakefile."
2
+ raise "This file (sugarcube) must be required within a RubyMotion project Rakefile."
3
3
  end
4
4
 
5
5
 
@@ -0,0 +1,79 @@
1
+
2
+ class CGRectArray < Array
3
+
4
+ def origin
5
+ return CGPointArray.new(self[0])
6
+ end
7
+
8
+ def size
9
+ return CGSizeArray.new(self[1])
10
+ end
11
+
12
+ end
13
+
14
+
15
+ class CGPointArray < Array
16
+
17
+ def x
18
+ return self[0]
19
+ end
20
+
21
+ def y
22
+ return self[1]
23
+ end
24
+
25
+ end
26
+
27
+ class CGSizeArray < Array
28
+
29
+ def width
30
+ return self[0]
31
+ end
32
+
33
+ def height
34
+ return self[1]
35
+ end
36
+
37
+ end
38
+
39
+
40
+ class Kernel
41
+
42
+ def Size(w, h)
43
+ retun CGSizeArray.new([w, h])
44
+ end
45
+
46
+ def Point(x, y)
47
+ retun CGPointArray.new([x, y])
48
+ end
49
+
50
+ # Accepts 2 or 4 arguments. 2 arguments should be a point and a size,
51
+ # 4 should be x, y, w, h
52
+ def Rect(x_or_origin, y_or_size=nil, w=nil, h=nil)
53
+ if not y_or_size
54
+ if CGRect === x_or_origin
55
+ x = x_or_origin.origin.x
56
+ y = x_or_origin.origin.y
57
+ w = x_or_origin.size.width
58
+ h = x_or_origin.size.height
59
+ elsif Array === x_or_origin
60
+ x = x_or_origin[0]
61
+ y = x_or_origin[1]
62
+ w = x_or_origin[2]
63
+ h = x_or_origin[3]
64
+ else
65
+ raise RuntimeError.new("Invalid argument sent to Rect(#{x_or_origin.inspect})")
66
+ end
67
+ elsif not w and not h
68
+ x = x_or_origin.x
69
+ y = x_or_origin.y
70
+ w = y_or_size.width
71
+ h = y_or_size.height
72
+ else
73
+ x = x_or_origin
74
+ y = y_or_size
75
+ end
76
+ return CGRectArray.new([[x, y], [w, h]])
77
+ end
78
+
79
+ end
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '0.1.1'
2
+ Version = '0.1.2'
3
3
  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: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2012-07-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
- requirement: &70117501802540 !ruby/object:Gem::Requirement
17
+ requirement: &70279926017200 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70117501802540
25
+ version_requirements: *70279926017200
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &70117501801900 !ruby/object:Gem::Requirement
28
+ requirement: &70279926016620 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70117501801900
36
+ version_requirements: *70279926016620
37
37
  description: ! 'CocoaTouch/iOS is a *verbose* framework. These extensions hope to
38
38
  make
39
39
 
@@ -63,6 +63,7 @@ files:
63
63
  - README.md
64
64
  - Rakefile
65
65
  - lib/sugarcube.rb
66
+ - lib/sugarcube/core_graphics.rb
66
67
  - lib/sugarcube/exceptions.rb
67
68
  - lib/sugarcube/fixnum.rb
68
69
  - lib/sugarcube/float.rb