zyps 0.4.1 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/zyps +32 -80
- data/lib/zyps/actions.rb +74 -2
- data/lib/zyps/environmental_factors.rb +16 -0
- data/lib/zyps.rb +90 -17
- data/test/test_zyps.rb +111 -8
- data/test/zyps/test_actions.rb +111 -46
- data/test/zyps/test_behaviors.rb +0 -0
- data/test/zyps/test_environmental_factors.rb +33 -0
- metadata +3 -134
- data/doc/classes/AccelerateAction.html +0 -182
- data/doc/classes/AccelerateAction.src/M000009.html +0 -19
- data/doc/classes/AccelerateAction.src/M000010.html +0 -18
- data/doc/classes/Action.html +0 -118
- data/doc/classes/AgeCondition.html +0 -181
- data/doc/classes/AgeCondition.src/M000039.html +0 -18
- data/doc/classes/AgeCondition.src/M000040.html +0 -18
- data/doc/classes/ApproachAction.html +0 -189
- data/doc/classes/ApproachAction.src/M000048.html +0 -19
- data/doc/classes/ApproachAction.src/M000049.html +0 -38
- data/doc/classes/Behavior.html +0 -202
- data/doc/classes/Behavior.src/M000001.html +0 -18
- data/doc/classes/Behavior.src/M000002.html +0 -19
- data/doc/classes/BlendAction.html +0 -181
- data/doc/classes/BlendAction.src/M000043.html +0 -18
- data/doc/classes/BlendAction.src/M000044.html +0 -18
- data/doc/classes/Clock.html +0 -165
- data/doc/classes/Clock.src/M000041.html +0 -18
- data/doc/classes/Clock.src/M000042.html +0 -21
- data/doc/classes/CollisionCondition.html +0 -148
- data/doc/classes/CollisionCondition.src/M000053.html +0 -18
- data/doc/classes/Color.html +0 -299
- data/doc/classes/Color.src/M000022.html +0 -18
- data/doc/classes/Color.src/M000023.html +0 -16
- data/doc/classes/Color.src/M000024.html +0 -16
- data/doc/classes/Color.src/M000025.html +0 -16
- data/doc/classes/Color.src/M000026.html +0 -18
- data/doc/classes/Color.src/M000027.html +0 -22
- data/doc/classes/Condition.html +0 -118
- data/doc/classes/Creature.html +0 -191
- data/doc/classes/Creature.src/M000011.html +0 -19
- data/doc/classes/Creature.src/M000012.html +0 -18
- data/doc/classes/DestroyAction.html +0 -181
- data/doc/classes/DestroyAction.src/M000030.html +0 -18
- data/doc/classes/DestroyAction.src/M000031.html +0 -18
- data/doc/classes/EatAction.html +0 -149
- data/doc/classes/EatAction.src/M000045.html +0 -21
- data/doc/classes/Enclosure.html +0 -206
- data/doc/classes/Enclosure.src/M000005.html +0 -18
- data/doc/classes/Enclosure.src/M000006.html +0 -31
- data/doc/classes/Environment.html +0 -203
- data/doc/classes/Environment.src/M000046.html +0 -19
- data/doc/classes/Environment.src/M000047.html +0 -45
- data/doc/classes/EnvironmentalFactor.html +0 -118
- data/doc/classes/FaceAction.html +0 -148
- data/doc/classes/FaceAction.src/M000052.html +0 -18
- data/doc/classes/FleeAction.html +0 -189
- data/doc/classes/FleeAction.src/M000054.html +0 -19
- data/doc/classes/FleeAction.src/M000055.html +0 -38
- data/doc/classes/GameObject.html +0 -282
- data/doc/classes/GameObject.src/M000032.html +0 -19
- data/doc/classes/GameObject.src/M000033.html +0 -16
- data/doc/classes/GameObject.src/M000034.html +0 -19
- data/doc/classes/GameObject.src/M000035.html +0 -16
- data/doc/classes/GameObject.src/M000036.html +0 -16
- data/doc/classes/Location.html +0 -167
- data/doc/classes/Location.src/M000021.html +0 -18
- data/doc/classes/ProximityCondition.html +0 -182
- data/doc/classes/ProximityCondition.src/M000037.html +0 -18
- data/doc/classes/ProximityCondition.src/M000038.html +0 -18
- data/doc/classes/TagAction.html +0 -181
- data/doc/classes/TagAction.src/M000028.html +0 -18
- data/doc/classes/TagAction.src/M000029.html +0 -18
- data/doc/classes/TagCondition.html +0 -181
- data/doc/classes/TagCondition.src/M000007.html +0 -18
- data/doc/classes/TagCondition.src/M000008.html +0 -18
- data/doc/classes/TrailsView.html +0 -209
- data/doc/classes/TrailsView.src/M000003.html +0 -40
- data/doc/classes/TrailsView.src/M000004.html +0 -78
- data/doc/classes/TurnAction.html +0 -182
- data/doc/classes/TurnAction.src/M000050.html +0 -19
- data/doc/classes/TurnAction.src/M000051.html +0 -18
- data/doc/classes/Utility.html +0 -264
- data/doc/classes/Utility.src/M000056.html +0 -26
- data/doc/classes/Utility.src/M000057.html +0 -22
- data/doc/classes/Utility.src/M000058.html +0 -18
- data/doc/classes/Utility.src/M000059.html +0 -21
- data/doc/classes/Utility.src/M000060.html +0 -25
- data/doc/classes/Utility.src/M000061.html +0 -21
- data/doc/classes/Utility.src/M000062.html +0 -21
- data/doc/classes/Vector.html +0 -281
- data/doc/classes/Vector.src/M000013.html +0 -19
- data/doc/classes/Vector.src/M000014.html +0 -16
- data/doc/classes/Vector.src/M000015.html +0 -21
- data/doc/classes/Vector.src/M000016.html +0 -16
- data/doc/classes/Vector.src/M000017.html +0 -18
- data/doc/classes/Vector.src/M000018.html +0 -16
- data/doc/classes/Vector.src/M000019.html +0 -18
- data/doc/classes/Vector.src/M000020.html +0 -25
- data/doc/created.rid +0 -1
- data/doc/files/COPYING_LESSER_txt.html +0 -311
- data/doc/files/COPYING_txt.html +0 -1003
- data/doc/files/README_txt.html +0 -214
- data/doc/files/lib/zyps/actions_rb.html +0 -134
- data/doc/files/lib/zyps/conditions_rb.html +0 -134
- data/doc/files/lib/zyps/environmental_factors_rb.html +0 -134
- data/doc/files/lib/zyps/views/trails_rb.html +0 -134
- data/doc/files/lib/zyps_rb.html +0 -134
- data/doc/fr_class_index.html +0 -53
- data/doc/fr_file_index.html +0 -34
- data/doc/fr_method_index.html +0 -88
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
data/doc/classes/TrailsView.html
DELETED
@@ -1,209 +0,0 @@
|
|
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="#M000003">new</a>
|
96
|
-
<a href="#M000004">update</a>
|
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"> [R] </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"> [R] </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"> [RW] </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">width</td>
|
142
|
-
<td class="context-item-value"> [R] </td>
|
143
|
-
<td class="context-item-desc">
|
144
|
-
Dimensions of the view.
|
145
|
-
|
146
|
-
</td>
|
147
|
-
</tr>
|
148
|
-
</table>
|
149
|
-
</div>
|
150
|
-
</div>
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
<!-- if method_list -->
|
155
|
-
<div id="methods">
|
156
|
-
<h3 class="section-bar">Public Class methods</h3>
|
157
|
-
|
158
|
-
<div id="method-M000003" class="method-detail">
|
159
|
-
<a name="M000003"></a>
|
160
|
-
|
161
|
-
<div class="method-heading">
|
162
|
-
<a href="TrailsView.src/M000003.html" target="Code" class="method-signature"
|
163
|
-
onclick="popupCode('TrailsView.src/M000003.html');return false;">
|
164
|
-
<span class="method-name">new</span><span class="method-args">(width = 600, height = 400, trail_length = 5)</span>
|
165
|
-
</a>
|
166
|
-
</div>
|
167
|
-
|
168
|
-
<div class="method-description">
|
169
|
-
</div>
|
170
|
-
</div>
|
171
|
-
|
172
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
173
|
-
|
174
|
-
<div id="method-M000004" class="method-detail">
|
175
|
-
<a name="M000004"></a>
|
176
|
-
|
177
|
-
<div class="method-heading">
|
178
|
-
<a href="TrailsView.src/M000004.html" target="Code" class="method-signature"
|
179
|
-
onclick="popupCode('TrailsView.src/M000004.html');return false;">
|
180
|
-
<span class="method-name">update</span><span class="method-args">(environment)</span>
|
181
|
-
</a>
|
182
|
-
</div>
|
183
|
-
|
184
|
-
<div class="method-description">
|
185
|
-
<p>
|
186
|
-
Takes an <a href="Environment.html">Environment</a>, and draws it to the
|
187
|
-
canvas. Tracks the position of each <a
|
188
|
-
href="GameObject.html">GameObject</a> over time so it can draw a trail
|
189
|
-
behind it. The head will match the object‘s <a
|
190
|
-
href="Color.html">Color</a> exactly, fading to black at the tail.
|
191
|
-
GameObject.size will be used as the line thickness at the object‘s
|
192
|
-
head, diminishing to 1 at the tail.
|
193
|
-
</p>
|
194
|
-
</div>
|
195
|
-
</div>
|
196
|
-
|
197
|
-
|
198
|
-
</div>
|
199
|
-
|
200
|
-
|
201
|
-
</div>
|
202
|
-
|
203
|
-
|
204
|
-
<div id="validator-badges">
|
205
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
206
|
-
</div>
|
207
|
-
|
208
|
-
</body>
|
209
|
-
</html>
|
@@ -1,40 +0,0 @@
|
|
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 32</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>)
|
15
|
-
|
16
|
-
<span class="ruby-ivar">@width</span>, <span class="ruby-ivar">@height</span>, <span class="ruby-ivar">@trail_length</span>, = <span class="ruby-identifier">width</span>, <span class="ruby-identifier">height</span>, <span class="ruby-identifier">trail_length</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">"expose_event"</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>
|
@@ -1,78 +0,0 @@
|
|
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 71</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-identifier">object_radius</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">sqrt</span>(<span class="ruby-identifier">object</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">/</span> <span class="ruby-constant">Math</span><span class="ruby-operator">::</span><span class="ruby-constant">PI</span>)
|
30
|
-
|
31
|
-
<span class="ruby-comment cmt">#Add the object's current location to the list.</span>
|
32
|
-
<span class="ruby-ivar">@locations</span>[<span class="ruby-identifier">object</span>.<span class="ruby-identifier">identifier</span>] <span class="ruby-operator"><<</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>]
|
33
|
-
<span class="ruby-comment cmt">#If the list is larger than the number of tail segments, delete the first position.</span>
|
34
|
-
<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">></span> <span class="ruby-ivar">@trail_length</span>
|
35
|
-
|
36
|
-
<span class="ruby-comment cmt">#For each location in this object's list:</span>
|
37
|
-
<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>
|
38
|
-
|
39
|
-
<span class="ruby-comment cmt">#Skip first location.</span>
|
40
|
-
<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>
|
41
|
-
|
42
|
-
<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>
|
43
|
-
<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>
|
44
|
-
|
45
|
-
<span class="ruby-comment cmt">#Set the drawing color to use the object's colors, adjusted by the multiplier.</span>
|
46
|
-
<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>
|
47
|
-
<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>,
|
48
|
-
<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>,
|
49
|
-
<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>
|
50
|
-
)
|
51
|
-
|
52
|
-
<span class="ruby-comment cmt">#Multiply the actual drawing width by the current multiplier to get the current drawing width.</span>
|
53
|
-
<span class="ruby-identifier">graphics_context</span>.<span class="ruby-identifier">set_line_attributes</span>(
|
54
|
-
(<span class="ruby-identifier">object_radius</span> <span class="ruby-operator">*</span> <span class="ruby-value">2</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">multiplier</span>).<span class="ruby-identifier">ceil</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">LINE_SOLID</span>,
|
56
|
-
<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>
|
57
|
-
<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>
|
58
|
-
)
|
59
|
-
|
60
|
-
<span class="ruby-comment cmt">#Get previous location so we can draw a line from it.</span>
|
61
|
-
<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>]
|
62
|
-
|
63
|
-
<span class="ruby-comment cmt">#Draw a line with the current width from the prior location to the current location.</span>
|
64
|
-
<span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">draw_line</span>(
|
65
|
-
<span class="ruby-identifier">graphics_context</span>,
|
66
|
-
<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>],
|
67
|
-
<span class="ruby-identifier">location</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">location</span>[<span class="ruby-value">1</span>]
|
68
|
-
)
|
69
|
-
|
70
|
-
<span class="ruby-keyword kw">end</span>
|
71
|
-
|
72
|
-
<span class="ruby-keyword kw">end</span>
|
73
|
-
|
74
|
-
<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>)
|
75
|
-
|
76
|
-
<span class="ruby-keyword kw">end</span></pre>
|
77
|
-
</body>
|
78
|
-
</html>
|
data/doc/classes/TurnAction.html
DELETED
@@ -1,182 +0,0 @@
|
|
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: TurnAction</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">TurnAction</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/zyps/actions_rb.html">
|
59
|
-
lib/zyps/actions.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
|
-
<a href="Action.html">
|
69
|
-
Action
|
70
|
-
</a>
|
71
|
-
</td>
|
72
|
-
</tr>
|
73
|
-
</table>
|
74
|
-
</div>
|
75
|
-
<!-- banner header -->
|
76
|
-
|
77
|
-
<div id="bodyContent">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div id="contextContent">
|
82
|
-
|
83
|
-
<div id="description">
|
84
|
-
<p>
|
85
|
-
Turn over time.
|
86
|
-
</p>
|
87
|
-
|
88
|
-
</div>
|
89
|
-
|
90
|
-
|
91
|
-
</div>
|
92
|
-
|
93
|
-
<div id="method-list">
|
94
|
-
<h3 class="section-bar">Methods</h3>
|
95
|
-
|
96
|
-
<div class="name-list">
|
97
|
-
<a href="#M000051">do</a>
|
98
|
-
<a href="#M000050">new</a>
|
99
|
-
</div>
|
100
|
-
</div>
|
101
|
-
|
102
|
-
</div>
|
103
|
-
|
104
|
-
|
105
|
-
<!-- if includes -->
|
106
|
-
|
107
|
-
<div id="section">
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
<div id="attribute-list">
|
114
|
-
<h3 class="section-bar">Attributes</h3>
|
115
|
-
|
116
|
-
<div class="name-list">
|
117
|
-
<table>
|
118
|
-
<tr class="top-aligned-row context-row">
|
119
|
-
<td class="context-item-name">rate</td>
|
120
|
-
<td class="context-item-value"> [RW] </td>
|
121
|
-
<td class="context-item-desc">
|
122
|
-
Degrees per second to turn. Positive turns clockwise, negative turns
|
123
|
-
counter-clockwise.
|
124
|
-
|
125
|
-
</td>
|
126
|
-
</tr>
|
127
|
-
</table>
|
128
|
-
</div>
|
129
|
-
</div>
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
<!-- if method_list -->
|
134
|
-
<div id="methods">
|
135
|
-
<h3 class="section-bar">Public Class methods</h3>
|
136
|
-
|
137
|
-
<div id="method-M000050" class="method-detail">
|
138
|
-
<a name="M000050"></a>
|
139
|
-
|
140
|
-
<div class="method-heading">
|
141
|
-
<a href="TurnAction.src/M000050.html" target="Code" class="method-signature"
|
142
|
-
onclick="popupCode('TurnAction.src/M000050.html');return false;">
|
143
|
-
<span class="method-name">new</span><span class="method-args">(rate = 0)</span>
|
144
|
-
</a>
|
145
|
-
</div>
|
146
|
-
|
147
|
-
<div class="method-description">
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
|
151
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
152
|
-
|
153
|
-
<div id="method-M000051" class="method-detail">
|
154
|
-
<a name="M000051"></a>
|
155
|
-
|
156
|
-
<div class="method-heading">
|
157
|
-
<a href="TurnAction.src/M000051.html" target="Code" class="method-signature"
|
158
|
-
onclick="popupCode('TurnAction.src/M000051.html');return false;">
|
159
|
-
<span class="method-name">do</span><span class="method-args">(actor, target)</span>
|
160
|
-
</a>
|
161
|
-
</div>
|
162
|
-
|
163
|
-
<div class="method-description">
|
164
|
-
<p>
|
165
|
-
Turn according to elapsed time.
|
166
|
-
</p>
|
167
|
-
</div>
|
168
|
-
</div>
|
169
|
-
|
170
|
-
|
171
|
-
</div>
|
172
|
-
|
173
|
-
|
174
|
-
</div>
|
175
|
-
|
176
|
-
|
177
|
-
<div id="validator-badges">
|
178
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
179
|
-
</div>
|
180
|
-
|
181
|
-
</body>
|
182
|
-
</html>
|
@@ -1,19 +0,0 @@
|
|
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 (TurnAction)</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/actions.rb, line 50</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">rate</span> = <span class="ruby-value">0</span>)
|
15
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rate</span> = <span class="ruby-identifier">rate</span>
|
16
|
-
<span class="ruby-ivar">@clock</span> = <span class="ruby-constant">Clock</span>.<span class="ruby-identifier">new</span>
|
17
|
-
<span class="ruby-keyword kw">end</span></pre>
|
18
|
-
</body>
|
19
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
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>do (TurnAction)</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/actions.rb, line 55</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">do</span>(<span class="ruby-identifier">actor</span>, <span class="ruby-identifier">target</span>)
|
15
|
-
<span class="ruby-identifier">actor</span>.<span class="ruby-identifier">vector</span>.<span class="ruby-identifier">pitch</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@clock</span>.<span class="ruby-identifier">elapsed_time</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">rate</span>
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|