zyps 0.2.1 → 0.3.1

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.
Files changed (66) hide show
  1. data/README.txt +0 -14
  2. data/bin/zyps +240 -28
  3. data/bin/zyps_demo +18 -2
  4. data/doc/classes/Behavior.html +205 -0
  5. data/doc/classes/Behavior.src/M000003.html +18 -0
  6. data/doc/classes/Behavior.src/M000004.html +19 -0
  7. data/doc/classes/Clock.html +165 -0
  8. data/doc/classes/Clock.src/M000026.html +18 -0
  9. data/doc/classes/Clock.src/M000027.html +21 -0
  10. data/doc/classes/Color.html +299 -0
  11. data/doc/classes/Color.src/M000015.html +18 -0
  12. data/doc/classes/Color.src/M000016.html +16 -0
  13. data/doc/classes/Color.src/M000017.html +16 -0
  14. data/doc/classes/Color.src/M000018.html +16 -0
  15. data/doc/classes/Color.src/M000019.html +18 -0
  16. data/doc/classes/Color.src/M000020.html +22 -0
  17. data/doc/classes/Creature.html +176 -0
  18. data/doc/classes/Creature.src/M000005.html +19 -0
  19. data/doc/classes/Environment.html +203 -0
  20. data/doc/classes/Environment.src/M000028.html +19 -0
  21. data/doc/classes/Environment.src/M000029.html +45 -0
  22. data/doc/classes/EnvironmentalFactor.html +167 -0
  23. data/doc/classes/EnvironmentalFactor.src/M000021.html +18 -0
  24. data/doc/classes/GameObject.html +256 -0
  25. data/doc/classes/GameObject.src/M000022.html +20 -0
  26. data/doc/classes/GameObject.src/M000023.html +19 -0
  27. data/doc/classes/GameObject.src/M000024.html +16 -0
  28. data/doc/classes/GameObject.src/M000025.html +16 -0
  29. data/doc/classes/Location.html +167 -0
  30. data/doc/classes/Location.src/M000014.html +18 -0
  31. data/doc/classes/Responsive.html +143 -0
  32. data/doc/classes/Responsive.src/M000030.html +18 -0
  33. data/doc/classes/TrailsView.html +217 -0
  34. data/doc/classes/TrailsView.src/M000001.html +40 -0
  35. data/doc/classes/TrailsView.src/M000002.html +76 -0
  36. data/doc/classes/Utility.html +264 -0
  37. data/doc/classes/Utility.src/M000031.html +26 -0
  38. data/doc/classes/Utility.src/M000032.html +22 -0
  39. data/doc/classes/Utility.src/M000033.html +18 -0
  40. data/doc/classes/Utility.src/M000034.html +21 -0
  41. data/doc/classes/Utility.src/M000035.html +25 -0
  42. data/doc/classes/Utility.src/M000036.html +21 -0
  43. data/doc/classes/Utility.src/M000037.html +22 -0
  44. data/doc/classes/Vector.html +281 -0
  45. data/doc/classes/Vector.src/M000006.html +19 -0
  46. data/doc/classes/Vector.src/M000007.html +16 -0
  47. data/doc/classes/Vector.src/M000008.html +21 -0
  48. data/doc/classes/Vector.src/M000009.html +16 -0
  49. data/doc/classes/Vector.src/M000010.html +18 -0
  50. data/doc/classes/Vector.src/M000011.html +16 -0
  51. data/doc/classes/Vector.src/M000012.html +18 -0
  52. data/doc/classes/Vector.src/M000013.html +25 -0
  53. data/doc/created.rid +1 -0
  54. data/doc/files/COPYING_LESSER_txt.html +311 -0
  55. data/doc/files/COPYING_txt.html +1003 -0
  56. data/doc/files/README_txt.html +214 -0
  57. data/doc/files/lib/zyps/views/trails_rb.html +134 -0
  58. data/doc/files/lib/zyps_rb.html +134 -0
  59. data/doc/fr_class_index.html +38 -0
  60. data/doc/fr_file_index.html +31 -0
  61. data/doc/fr_method_index.html +63 -0
  62. data/doc/index.html +24 -0
  63. data/doc/rdoc-style.css +208 -0
  64. data/lib/zyps/views/trails.rb +3 -3
  65. metadata +81 -6
  66. data/bin/zyps_server +0 -178
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>act (Responsive)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 117</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">act</span>(<span class="ruby-identifier">target</span>)
15
+ <span class="ruby-identifier">behaviors</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">behavior</span><span class="ruby-operator">|</span> <span class="ruby-identifier">behavior</span>.<span class="ruby-identifier">perform</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">target</span>)}
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,217 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: TrailsView</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">TrailsView</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/zyps/views/trails_rb.html">
59
+ lib/zyps/views/trails.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ A view of game objects.
84
+ </p>
85
+
86
+ </div>
87
+
88
+
89
+ </div>
90
+
91
+ <div id="method-list">
92
+ <h3 class="section-bar">Methods</h3>
93
+
94
+ <div class="name-list">
95
+ <a href="#M000001">new</a>&nbsp;&nbsp;
96
+ <a href="#M000002">update</a>&nbsp;&nbsp;
97
+ </div>
98
+ </div>
99
+
100
+ </div>
101
+
102
+
103
+ <!-- if includes -->
104
+
105
+ <div id="section">
106
+
107
+
108
+
109
+
110
+
111
+ <div id="attribute-list">
112
+ <h3 class="section-bar">Attributes</h3>
113
+
114
+ <div class="name-list">
115
+ <table>
116
+ <tr class="top-aligned-row context-row">
117
+ <td class="context-item-name">canvas</td>
118
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
119
+ <td class="context-item-desc">
120
+ A Gtk::DrawingArea to render objects on.
121
+
122
+ </td>
123
+ </tr>
124
+ <tr class="top-aligned-row context-row">
125
+ <td class="context-item-name">height</td>
126
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
127
+ <td class="context-item-desc">
128
+ Dimensions of the view.
129
+
130
+ </td>
131
+ </tr>
132
+ <tr class="top-aligned-row context-row">
133
+ <td class="context-item-name">trail_length</td>
134
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
135
+ <td class="context-item-desc">
136
+ Number of line segments to draw for each object.
137
+
138
+ </td>
139
+ </tr>
140
+ <tr class="top-aligned-row context-row">
141
+ <td class="context-item-name">trail_width</td>
142
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
143
+ <td class="context-item-desc">
144
+ Width of the trail behind each object.
145
+
146
+ </td>
147
+ </tr>
148
+ <tr class="top-aligned-row context-row">
149
+ <td class="context-item-name">width</td>
150
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
151
+ <td class="context-item-desc">
152
+ Dimensions of the view.
153
+
154
+ </td>
155
+ </tr>
156
+ </table>
157
+ </div>
158
+ </div>
159
+
160
+
161
+
162
+ <!-- if method_list -->
163
+ <div id="methods">
164
+ <h3 class="section-bar">Public Class methods</h3>
165
+
166
+ <div id="method-M000001" class="method-detail">
167
+ <a name="M000001"></a>
168
+
169
+ <div class="method-heading">
170
+ <a href="TrailsView.src/M000001.html" target="Code" class="method-signature"
171
+ onclick="popupCode('TrailsView.src/M000001.html');return false;">
172
+ <span class="method-name">new</span><span class="method-args">(width = 600, height = 400, trail_length = 5, trail_width = trail_length)</span>
173
+ </a>
174
+ </div>
175
+
176
+ <div class="method-description">
177
+ </div>
178
+ </div>
179
+
180
+ <h3 class="section-bar">Public Instance methods</h3>
181
+
182
+ <div id="method-M000002" class="method-detail">
183
+ <a name="M000002"></a>
184
+
185
+ <div class="method-heading">
186
+ <a href="TrailsView.src/M000002.html" target="Code" class="method-signature"
187
+ onclick="popupCode('TrailsView.src/M000002.html');return false;">
188
+ <span class="method-name">update</span><span class="method-args">(environment)</span>
189
+ </a>
190
+ </div>
191
+
192
+ <div class="method-description">
193
+ <p>
194
+ Takes an <a href="Environment.html">Environment</a>, and draws it to the
195
+ canvas. Tracks the position of each <a
196
+ href="GameObject.html">GameObject</a> over time so it can draw a trail
197
+ behind it. The head will match the object&#8216;s <a
198
+ href="Color.html">Color</a> exactly, fading to black at the tail.
199
+ trail_width will be used as the line thickness at the object&#8216;s head,
200
+ diminishing to 1 at the tail.
201
+ </p>
202
+ </div>
203
+ </div>
204
+
205
+
206
+ </div>
207
+
208
+
209
+ </div>
210
+
211
+
212
+ <div id="validator-badges">
213
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
214
+ </div>
215
+
216
+ </body>
217
+ </html>
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>new (TrailsView)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/zyps/views/trails.rb, line 34</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> (<span class="ruby-identifier">width</span> = <span class="ruby-value">600</span>, <span class="ruby-identifier">height</span> = <span class="ruby-value">400</span>, <span class="ruby-identifier">trail_length</span> = <span class="ruby-value">5</span>, <span class="ruby-identifier">trail_width</span> = <span class="ruby-identifier">trail_length</span>)
15
+
16
+ <span class="ruby-ivar">@width</span>, <span class="ruby-ivar">@height</span>, <span class="ruby-ivar">@trail_length</span>, <span class="ruby-ivar">@trail_width</span> = <span class="ruby-identifier">width</span>, <span class="ruby-identifier">height</span>, <span class="ruby-identifier">trail_length</span>, <span class="ruby-identifier">trail_width</span>
17
+
18
+ <span class="ruby-comment cmt">#Create a drawing area.</span>
19
+ <span class="ruby-ivar">@canvas</span> = <span class="ruby-constant">Gtk</span><span class="ruby-operator">::</span><span class="ruby-constant">DrawingArea</span>.<span class="ruby-identifier">new</span>
20
+ <span class="ruby-comment cmt">#Set to correct size.</span>
21
+ <span class="ruby-identifier">resize</span>
22
+
23
+ <span class="ruby-comment cmt">#Whenever the drawing area needs updating...</span>
24
+ <span class="ruby-ivar">@canvas</span>.<span class="ruby-identifier">signal_connect</span>(<span class="ruby-value str">&quot;expose_event&quot;</span>) <span class="ruby-keyword kw">do</span>
25
+ <span class="ruby-comment cmt">#Copy buffer bitmap to canvas.</span>
26
+ <span class="ruby-ivar">@canvas</span>.<span class="ruby-identifier">window</span>.<span class="ruby-identifier">draw_drawable</span>(
27
+ <span class="ruby-ivar">@canvas</span>.<span class="ruby-identifier">style</span>.<span class="ruby-identifier">fg_gc</span>(<span class="ruby-ivar">@canvas</span>.<span class="ruby-identifier">state</span>), <span class="ruby-comment cmt">#Gdk::GC (graphics context) to use when drawing.</span>
28
+ <span class="ruby-identifier">buffer</span>, <span class="ruby-comment cmt">#Gdk::Drawable source to copy onto canvas.</span>
29
+ <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-comment cmt">#Pull from upper left of source.</span>
30
+ <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-comment cmt">#Copy to upper left of canvas.</span>
31
+ <span class="ruby-value">-1</span>, <span class="ruby-value">-1</span> <span class="ruby-comment cmt">#-1 width and height signals to copy entire source over.</span>
32
+ )
33
+ <span class="ruby-keyword kw">end</span>
34
+
35
+ <span class="ruby-comment cmt">#Track a list of locations for each object.</span>
36
+ <span class="ruby-ivar">@locations</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>}
37
+
38
+ <span class="ruby-keyword kw">end</span></pre>
39
+ </body>
40
+ </html>
@@ -0,0 +1,76 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>update (TrailsView)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/zyps/views/trails.rb, line 73</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">environment</span>)
15
+
16
+ <span class="ruby-comment cmt">#Clear the background on the buffer.</span>
17
+ <span class="ruby-identifier">graphics_context</span> = <span class="ruby-constant">Gdk</span><span class="ruby-operator">::</span><span class="ruby-constant">GC</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">buffer</span>)
18
+ <span class="ruby-identifier">graphics_context</span>.<span class="ruby-identifier">rgb_fg_color</span> = <span class="ruby-constant">Gdk</span><span class="ruby-operator">::</span><span class="ruby-constant">Color</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)
19
+ <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">draw_rectangle</span>(
20
+ <span class="ruby-identifier">graphics_context</span>,
21
+ <span class="ruby-keyword kw">true</span>, <span class="ruby-comment cmt">#Filled.</span>
22
+ <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-comment cmt">#Lower-left corner.</span>
23
+ <span class="ruby-ivar">@width</span>, <span class="ruby-ivar">@height</span> <span class="ruby-comment cmt">#Upper-right corner.</span>
24
+ )
25
+
26
+ <span class="ruby-comment cmt">#For each GameObject in the environment:</span>
27
+ <span class="ruby-identifier">environment</span>.<span class="ruby-identifier">objects</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">object</span><span class="ruby-operator">|</span>
28
+
29
+ <span class="ruby-comment cmt">#Add the object's current location to the list.</span>
30
+ <span class="ruby-ivar">@locations</span>[<span class="ruby-identifier">object</span>.<span class="ruby-identifier">identifier</span>] <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">object</span>.<span class="ruby-identifier">location</span>.<span class="ruby-identifier">x</span>, <span class="ruby-identifier">object</span>.<span class="ruby-identifier">location</span>.<span class="ruby-identifier">y</span>]
31
+ <span class="ruby-comment cmt">#If the list is larger than the number of tail segments, delete the first position.</span>
32
+ <span class="ruby-ivar">@locations</span>[<span class="ruby-identifier">object</span>.<span class="ruby-identifier">identifier</span>].<span class="ruby-identifier">shift</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@locations</span>[<span class="ruby-identifier">object</span>.<span class="ruby-identifier">identifier</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@trail_length</span>
33
+
34
+ <span class="ruby-comment cmt">#For each location in this object's list:</span>
35
+ <span class="ruby-ivar">@locations</span>[<span class="ruby-identifier">object</span>.<span class="ruby-identifier">identifier</span>].<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">location</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
36
+
37
+ <span class="ruby-comment cmt">#Skip first location.</span>
38
+ <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
39
+
40
+ <span class="ruby-comment cmt">#Divide the current segment number by trail segment count to get the multiplier to use for brightness and width.</span>
41
+ <span class="ruby-identifier">multiplier</span> = <span class="ruby-identifier">index</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-ivar">@locations</span>[<span class="ruby-identifier">object</span>.<span class="ruby-identifier">identifier</span>].<span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_f</span>
42
+
43
+ <span class="ruby-comment cmt">#Set the drawing color to use the object's colors, adjusted by the multiplier.</span>
44
+ <span class="ruby-identifier">graphics_context</span>.<span class="ruby-identifier">rgb_fg_color</span> = <span class="ruby-constant">Gdk</span><span class="ruby-operator">::</span><span class="ruby-constant">Color</span>.<span class="ruby-identifier">new</span>( <span class="ruby-comment cmt">#Don't use Gdk::GC.foreground= here, as that requires a color to be in the color map already.</span>
45
+ <span class="ruby-identifier">object</span>.<span class="ruby-identifier">color</span>.<span class="ruby-identifier">red</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">multiplier</span> <span class="ruby-operator">*</span> <span class="ruby-value">65535</span>,
46
+ <span class="ruby-identifier">object</span>.<span class="ruby-identifier">color</span>.<span class="ruby-identifier">green</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">multiplier</span> <span class="ruby-operator">*</span> <span class="ruby-value">65535</span>,
47
+ <span class="ruby-identifier">object</span>.<span class="ruby-identifier">color</span>.<span class="ruby-identifier">blue</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">multiplier</span> <span class="ruby-operator">*</span> <span class="ruby-value">65535</span>
48
+ )
49
+
50
+ <span class="ruby-comment cmt">#Multiply the actual drawing width by the current multiplier to get the current drawing width.</span>
51
+ <span class="ruby-identifier">graphics_context</span>.<span class="ruby-identifier">set_line_attributes</span>(
52
+ (<span class="ruby-ivar">@trail_width</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">multiplier</span>).<span class="ruby-identifier">ceil</span>,
53
+ <span class="ruby-constant">Gdk</span><span class="ruby-operator">::</span><span class="ruby-constant">GC</span><span class="ruby-operator">::</span><span class="ruby-constant">LINE_SOLID</span>,
54
+ <span class="ruby-constant">Gdk</span><span class="ruby-operator">::</span><span class="ruby-constant">GC</span><span class="ruby-operator">::</span><span class="ruby-constant">CAP_ROUND</span>, <span class="ruby-comment cmt">#Line ends drawn as semicircles.</span>
55
+ <span class="ruby-constant">Gdk</span><span class="ruby-operator">::</span><span class="ruby-constant">GC</span><span class="ruby-operator">::</span><span class="ruby-constant">JOIN_MITER</span> <span class="ruby-comment cmt">#Only used for polygons.</span>
56
+ )
57
+
58
+ <span class="ruby-comment cmt">#Get previous location so we can draw a line from it.</span>
59
+ <span class="ruby-identifier">previous_location</span> = <span class="ruby-ivar">@locations</span>[<span class="ruby-identifier">object</span>.<span class="ruby-identifier">identifier</span>][<span class="ruby-identifier">index</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
60
+
61
+ <span class="ruby-comment cmt">#Draw a line with the current width from the prior location to the current location.</span>
62
+ <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">draw_line</span>(
63
+ <span class="ruby-identifier">graphics_context</span>,
64
+ <span class="ruby-identifier">previous_location</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">previous_location</span>[<span class="ruby-value">1</span>],
65
+ <span class="ruby-identifier">location</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">location</span>[<span class="ruby-value">1</span>]
66
+ )
67
+
68
+ <span class="ruby-keyword kw">end</span>
69
+
70
+ <span class="ruby-keyword kw">end</span>
71
+
72
+ <span class="ruby-ivar">@canvas</span>.<span class="ruby-identifier">queue_draw_area</span>(<span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-ivar">@width</span>, <span class="ruby-ivar">@height</span>)
73
+
74
+ <span class="ruby-keyword kw">end</span></pre>
75
+ </body>
76
+ </html>
@@ -0,0 +1,264 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Utility</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Utility</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/zyps_rb.html">
59
+ lib/zyps.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ Various methods for working with Vectors, etc.
78
+ </p>
79
+
80
+ </div>
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000035">constrain_value</a>&nbsp;&nbsp;
90
+ <a href="#M000031">find_angle</a>&nbsp;&nbsp;
91
+ <a href="#M000032">find_distance</a>&nbsp;&nbsp;
92
+ <a href="#M000036">find_reflection_angle</a>&nbsp;&nbsp;
93
+ <a href="#M000037">inside_box?</a>&nbsp;&nbsp;
94
+ <a href="#M000033">to_degrees</a>&nbsp;&nbsp;
95
+ <a href="#M000034">to_radians</a>&nbsp;&nbsp;
96
+ </div>
97
+ </div>
98
+
99
+ </div>
100
+
101
+
102
+ <!-- if includes -->
103
+
104
+ <div id="section">
105
+
106
+
107
+ <div id="constants-list">
108
+ <h3 class="section-bar">Constants</h3>
109
+
110
+ <div class="name-list">
111
+ <table summary="Constants">
112
+ <tr class="top-aligned-row context-row">
113
+ <td class="context-item-name">PI2</td>
114
+ <td>=</td>
115
+ <td class="context-item-value">Math::PI * 2.0</td>
116
+ </tr>
117
+ </table>
118
+ </div>
119
+ </div>
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <!-- if method_list -->
127
+ <div id="methods">
128
+ <h3 class="section-bar">Public Class methods</h3>
129
+
130
+ <div id="method-M000035" class="method-detail">
131
+ <a name="M000035"></a>
132
+
133
+ <div class="method-heading">
134
+ <a href="Utility.src/M000035.html" target="Code" class="method-signature"
135
+ onclick="popupCode('Utility.src/M000035.html');return false;">
136
+ <span class="method-name">constrain_value</span><span class="method-args">(value, absolute_maximum)</span>
137
+ </a>
138
+ </div>
139
+
140
+ <div class="method-description">
141
+ <p>
142
+ Reduce a number to within an allowed maximum (or minimum, if the number is
143
+ negative).
144
+ </p>
145
+ </div>
146
+ </div>
147
+
148
+ <div id="method-M000031" class="method-detail">
149
+ <a name="M000031"></a>
150
+
151
+ <div class="method-heading">
152
+ <a href="Utility.src/M000031.html" target="Code" class="method-signature"
153
+ onclick="popupCode('Utility.src/M000031.html');return false;">
154
+ <span class="method-name">find_angle</span><span class="method-args">(origin, target)</span>
155
+ </a>
156
+ </div>
157
+
158
+ <div class="method-description">
159
+ <p>
160
+ Get the angle (in degrees) from one <a href="Location.html">Location</a> to
161
+ another.
162
+ </p>
163
+ </div>
164
+ </div>
165
+
166
+ <div id="method-M000032" class="method-detail">
167
+ <a name="M000032"></a>
168
+
169
+ <div class="method-heading">
170
+ <a href="Utility.src/M000032.html" target="Code" class="method-signature"
171
+ onclick="popupCode('Utility.src/M000032.html');return false;">
172
+ <span class="method-name">find_distance</span><span class="method-args">(origin, target)</span>
173
+ </a>
174
+ </div>
175
+
176
+ <div class="method-description">
177
+ <p>
178
+ Get the distance from one <a href="Location.html">Location</a> to another.
179
+ </p>
180
+ </div>
181
+ </div>
182
+
183
+ <div id="method-M000036" class="method-detail">
184
+ <a name="M000036"></a>
185
+
186
+ <div class="method-heading">
187
+ <a href="Utility.src/M000036.html" target="Code" class="method-signature"
188
+ onclick="popupCode('Utility.src/M000036.html');return false;">
189
+ <span class="method-name">find_reflection_angle</span><span class="method-args">(normal, angle)</span>
190
+ </a>
191
+ </div>
192
+
193
+ <div class="method-description">
194
+ <p>
195
+ Given a normal and an angle, find the reflection angle.
196
+ </p>
197
+ </div>
198
+ </div>
199
+
200
+ <div id="method-M000037" class="method-detail">
201
+ <a name="M000037"></a>
202
+
203
+ <div class="method-heading">
204
+ <a href="Utility.src/M000037.html" target="Code" class="method-signature"
205
+ onclick="popupCode('Utility.src/M000037.html');return false;">
206
+ <span class="method-name">inside_box?</span><span class="method-args">(point, upper_left, lower_right)</span>
207
+ </a>
208
+ </div>
209
+
210
+ <div class="method-description">
211
+ <p>
212
+ Given a location and the upper left and lower right corners of a box,
213
+ determine if the point is within the box.
214
+ </p>
215
+ </div>
216
+ </div>
217
+
218
+ <div id="method-M000033" class="method-detail">
219
+ <a name="M000033"></a>
220
+
221
+ <div class="method-heading">
222
+ <a href="Utility.src/M000033.html" target="Code" class="method-signature"
223
+ onclick="popupCode('Utility.src/M000033.html');return false;">
224
+ <span class="method-name">to_degrees</span><span class="method-args">(radians)</span>
225
+ </a>
226
+ </div>
227
+
228
+ <div class="method-description">
229
+ <p>
230
+ Convert radians to degrees.
231
+ </p>
232
+ </div>
233
+ </div>
234
+
235
+ <div id="method-M000034" class="method-detail">
236
+ <a name="M000034"></a>
237
+
238
+ <div class="method-heading">
239
+ <a href="Utility.src/M000034.html" target="Code" class="method-signature"
240
+ onclick="popupCode('Utility.src/M000034.html');return false;">
241
+ <span class="method-name">to_radians</span><span class="method-args">(degrees)</span>
242
+ </a>
243
+ </div>
244
+
245
+ <div class="method-description">
246
+ <p>
247
+ Convert degrees to radians.
248
+ </p>
249
+ </div>
250
+ </div>
251
+
252
+
253
+ </div>
254
+
255
+
256
+ </div>
257
+
258
+
259
+ <div id="validator-badges">
260
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
261
+ </div>
262
+
263
+ </body>
264
+ </html>