salamander 0.1.1 → 0.1.2

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.
@@ -27,10 +27,15 @@ module Salamander
27
27
  [@x, @y]
28
28
  end
29
29
 
30
- # Move a given distance in the current direction.
31
- def move (distance)
32
- x = distance * Math.cos(angle) + @x
33
- y = distance * Math.sin(angle) + @y
30
+ # Move a given distance
31
+ def move (distance, direction=nil)
32
+ if direction
33
+ theta = (direction.is_a?(Symbol) ? COMPASS[direction] : direction)
34
+ else
35
+ theta = angle
36
+ end
37
+ x = distance * Math.cos(theta) + @x
38
+ y = distance * Math.sin(theta) + @y
34
39
  move_to(x, y)
35
40
  end
36
41
 
@@ -69,6 +74,7 @@ module Salamander
69
74
  if not color then
70
75
  @color
71
76
  else
77
+ color = COLORS[color] if color.is_a? Symbol
72
78
  color = color.to_str
73
79
  if color[0] == ?# and color.length == 7
74
80
  color = color[1..-1].to_i(16)
@@ -21,4 +21,13 @@ module Salamander
21
21
  COMPASS.each_pair do |k, v|
22
22
  COMPASS[k] = v / 180.0 * Math::PI
23
23
  end
24
+
25
+ COLORS = {
26
+ :red => "#FF0000",
27
+ :green => "#00FF00",
28
+ :blue => "#0000FF",
29
+ :yellow => "#FFF00",
30
+ :magenta => "#FF00FF",
31
+ :cyan => "#00FFFF",
32
+ }
24
33
  end
@@ -1,3 +1,3 @@
1
1
  module Salamander
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salamander
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Jonathan Castello
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-01-13 00:00:00 -08:00
17
+ date: 2011-01-14 00:00:00 -08:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 25
30
28
  segments:
31
29
  - 1
32
30
  - 0
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ~>
44
42
  - !ruby/object:Gem::Version
45
- hash: 13
46
43
  segments:
47
44
  - 0
48
45
  - 3
@@ -59,16 +56,16 @@ extra_rdoc_files: []
59
56
 
60
57
  files:
61
58
  - lib/salamander.rb
59
+ - lib/salamander/support/radians.rb
62
60
  - lib/salamander/constants.rb
63
61
  - lib/salamander/actor.rb
62
+ - lib/salamander/drawing/point.rb
63
+ - lib/salamander/drawing/line.rb
64
+ - lib/salamander/drawing/shapes.rb
64
65
  - lib/salamander/version.rbc
65
66
  - lib/salamander/support.rb
66
67
  - lib/salamander/drawing.rb
67
68
  - lib/salamander/version.rb
68
- - lib/salamander/support/radians.rb
69
- - lib/salamander/drawing/point.rb
70
- - lib/salamander/drawing/line.rb
71
- - lib/salamander/drawing/shapes.rb
72
69
  - bin/salamander
73
70
  has_rdoc: true
74
71
  homepage:
@@ -82,20 +79,16 @@ require_paths:
82
79
  required_ruby_version: !ruby/object:Gem::Requirement
83
80
  none: false
84
81
  requirements:
85
- - - ~>
82
+ - - ">="
86
83
  - !ruby/object:Gem::Version
87
- hash: 55
88
84
  segments:
89
- - 1
90
- - 8
91
85
  - 0
92
- version: 1.8.0
86
+ version: "0"
93
87
  required_rubygems_version: !ruby/object:Gem::Requirement
94
88
  none: false
95
89
  requirements:
96
90
  - - ">="
97
91
  - !ruby/object:Gem::Version
98
- hash: 3
99
92
  segments:
100
93
  - 0
101
94
  version: "0"