the-swarm 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/.yardopts +8 -0
  4. data/Gemfile +24 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +35 -0
  7. data/Rakefile +26 -0
  8. data/bin/swarm +11 -0
  9. data/docs/Swarm.html +296 -0
  10. data/docs/Swarm/Catalog.html +819 -0
  11. data/docs/Swarm/Console.html +1050 -0
  12. data/docs/Swarm/Console/Color.html +160 -0
  13. data/docs/Swarm/Console/NormalKey.html +410 -0
  14. data/docs/Swarm/Console/PopUp.html +236 -0
  15. data/docs/Swarm/Console/VIKey.html +410 -0
  16. data/docs/Swarm/Five.html +421 -0
  17. data/docs/Swarm/Four.html +389 -0
  18. data/docs/Swarm/Game.html +1197 -0
  19. data/docs/Swarm/Intro.html +419 -0
  20. data/docs/Swarm/Level.html +700 -0
  21. data/docs/Swarm/Map.html +2336 -0
  22. data/docs/Swarm/One.html +353 -0
  23. data/docs/Swarm/Three.html +383 -0
  24. data/docs/Swarm/Tile.html +3823 -0
  25. data/docs/Swarm/Two.html +355 -0
  26. data/docs/_index.html +313 -0
  27. data/docs/class_list.html +51 -0
  28. data/docs/css/common.css +1 -0
  29. data/docs/css/full_list.css +58 -0
  30. data/docs/css/style.css +492 -0
  31. data/docs/file.LICENSE.html +70 -0
  32. data/docs/file.README.html +101 -0
  33. data/docs/file_list.html +61 -0
  34. data/docs/frames.html +17 -0
  35. data/docs/index.html +101 -0
  36. data/docs/js/app.js +248 -0
  37. data/docs/js/full_list.js +216 -0
  38. data/docs/js/jquery.js +4 -0
  39. data/docs/method_list.html +1195 -0
  40. data/docs/top-level-namespace.html +110 -0
  41. data/lib/swarm.rb +60 -0
  42. data/lib/swarm/catalog.rb +71 -0
  43. data/lib/swarm/console.rb +165 -0
  44. data/lib/swarm/game.rb +173 -0
  45. data/lib/swarm/level.rb +58 -0
  46. data/lib/swarm/levels/five.rb +71 -0
  47. data/lib/swarm/levels/four.rb +55 -0
  48. data/lib/swarm/levels/intro.rb +36 -0
  49. data/lib/swarm/levels/one.rb +35 -0
  50. data/lib/swarm/levels/three.rb +51 -0
  51. data/lib/swarm/levels/two.rb +38 -0
  52. data/lib/swarm/map.rb +254 -0
  53. data/lib/swarm/tile.rb +149 -0
  54. data/lib/swarm/version.rb +5 -0
  55. data/swarm.gemspec +24 -0
  56. metadata +112 -0
@@ -0,0 +1,1050 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Swarm::Console
8
+
9
+ &mdash; &quot;Swarm&quot; Source Code Documentation
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Swarm::Console";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Swarm.html" title="Swarm (module)">Swarm</a></span></span>
41
+ &raquo;
42
+ <span class="title">Console</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Swarm::Console
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+ <dl>
73
+ <dt>Extended by:</dt>
74
+ <dd><span class='object_link'><a href="" title="Swarm::Console (module)">Console</a></span></dd>
75
+ </dl>
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Includes:</dt>
81
+ <dd>Curses, <span class='object_link'><a href="Console/Color.html" title="Swarm::Console::Color (module)">Color</a></span></dd>
82
+ </dl>
83
+
84
+
85
+
86
+
87
+ <dl>
88
+ <dt>Included in:</dt>
89
+ <dd><span class='object_link'><a href="" title="Swarm::Console (module)">Console</a></span></dd>
90
+ </dl>
91
+
92
+
93
+
94
+ <dl>
95
+ <dt>Defined in:</dt>
96
+ <dd>lib/swarm/console.rb</dd>
97
+ </dl>
98
+
99
+ </div>
100
+
101
+ <h2>Defined Under Namespace</h2>
102
+ <p class="children">
103
+
104
+
105
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Console/Color.html" title="Swarm::Console::Color (module)">Color</a></span>, <span class='object_link'><a href="Console/NormalKey.html" title="Swarm::Console::NormalKey (module)">NormalKey</a></span>, <span class='object_link'><a href="Console/VIKey.html" title="Swarm::Console::VIKey (module)">VIKey</a></span>
106
+
107
+
108
+
109
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Console/PopUp.html" title="Swarm::Console::PopUp (class)">PopUp</a></span>
110
+
111
+
112
+ </p>
113
+
114
+
115
+
116
+ <h2>Constant Summary</h2>
117
+
118
+ <h3 class="inherited">Constants included
119
+ from <span class='object_link'><a href="Console/Color.html" title="Swarm::Console::Color (module)">Color</a></span></h3>
120
+ <p class="inherited"><span class='object_link'><a href="Console/Color.html#BLACK-constant" title="Swarm::Console::Color::BLACK (constant)">Color::BLACK</a></span>, <span class='object_link'><a href="Console/Color.html#BLUE-constant" title="Swarm::Console::Color::BLUE (constant)">Color::BLUE</a></span>, <span class='object_link'><a href="Console/Color.html#GREEN-constant" title="Swarm::Console::Color::GREEN (constant)">Color::GREEN</a></span>, <span class='object_link'><a href="Console/Color.html#GREY-constant" title="Swarm::Console::Color::GREY (constant)">Color::GREY</a></span>, <span class='object_link'><a href="Console/Color.html#PURPLE-constant" title="Swarm::Console::Color::PURPLE (constant)">Color::PURPLE</a></span>, <span class='object_link'><a href="Console/Color.html#RED-constant" title="Swarm::Console::Color::RED (constant)">Color::RED</a></span>, <span class='object_link'><a href="Console/Color.html#SILVER-constant" title="Swarm::Console::Color::SILVER (constant)">Color::SILVER</a></span>, <span class='object_link'><a href="Console/Color.html#WHITE-constant" title="Swarm::Console::Color::WHITE (constant)">Color::WHITE</a></span>, <span class='object_link'><a href="Console/Color.html#YELLOW-constant" title="Swarm::Console::Color::YELLOW (constant)">Color::YELLOW</a></span></p>
121
+
122
+
123
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
124
+ <ul class="summary">
125
+
126
+ <li class="public ">
127
+ <span class="summary_signature">
128
+
129
+ <a href="#key_info-instance_method" title="#key_info (instance method)">#<strong>key_info</strong> &#x21d2; Object </a>
130
+
131
+
132
+
133
+ </span>
134
+
135
+
136
+
137
+
138
+ <span class="note title readonly">readonly</span>
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+ <span class="summary_desc"><div class='inline'>
149
+ <p>Returns the value of attribute key_info.</p>
150
+ </div></span>
151
+
152
+ </li>
153
+
154
+
155
+ </ul>
156
+
157
+
158
+
159
+
160
+
161
+ <h2>
162
+ Instance Method Summary
163
+ <small><a href="#" class="summary_toggle">collapse</a></small>
164
+ </h2>
165
+
166
+ <ul class="summary">
167
+
168
+ <li class="public ">
169
+ <span class="summary_signature">
170
+
171
+ <a href="#close-instance_method" title="#close (instance method)">#<strong>close</strong> &#x21d2; Object </a>
172
+
173
+
174
+
175
+ </span>
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+ <span class="summary_desc"><div class='inline'>
186
+ <p>Turn line buffering on and close the <code>Curses</code> session.</p>
187
+ </div></span>
188
+
189
+ </li>
190
+
191
+
192
+ <li class="public ">
193
+ <span class="summary_signature">
194
+
195
+ <a href="#draw-instance_method" title="#draw (instance method)">#<strong>draw</strong>(tile) &#x21d2; Object </a>
196
+
197
+
198
+
199
+ </span>
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ <span class="summary_desc"><div class='inline'></div></span>
210
+
211
+ </li>
212
+
213
+
214
+ <li class="public ">
215
+ <span class="summary_signature">
216
+
217
+ <a href="#height-instance_method" title="#height (instance method)">#<strong>height</strong> &#x21d2; Integer </a>
218
+
219
+
220
+
221
+ </span>
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+ <span class="summary_desc"><div class='inline'>
232
+ <p><code>height</code> of console.</p>
233
+ </div></span>
234
+
235
+ </li>
236
+
237
+
238
+ <li class="public ">
239
+ <span class="summary_signature">
240
+
241
+ <a href="#init_colors-instance_method" title="#init_colors (instance method)">#<strong>init_colors</strong> &#x21d2; Object </a>
242
+
243
+
244
+
245
+ </span>
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+ <span class="summary_desc"><div class='inline'></div></span>
256
+
257
+ </li>
258
+
259
+
260
+ <li class="public ">
261
+ <span class="summary_signature">
262
+
263
+ <a href="#init_keys-instance_method" title="#init_keys (instance method)">#<strong>init_keys</strong> &#x21d2; Object </a>
264
+
265
+
266
+
267
+ </span>
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+ <span class="summary_desc"><div class='inline'></div></span>
278
+
279
+ </li>
280
+
281
+
282
+ <li class="public ">
283
+ <span class="summary_signature">
284
+
285
+ <a href="#keypress-instance_method" title="#keypress (instance method)">#<strong>keypress</strong> {|command| ... } &#x21d2; Object </a>
286
+
287
+
288
+
289
+ </span>
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+ <span class="summary_desc"><div class='inline'></div></span>
300
+
301
+ </li>
302
+
303
+
304
+ <li class="public ">
305
+ <span class="summary_signature">
306
+
307
+ <a href="#open-instance_method" title="#open (instance method)">#<strong>open</strong> &#x21d2; Object </a>
308
+
309
+
310
+
311
+ </span>
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+ <span class="summary_desc"><div class='inline'>
322
+ <p>Initialize the <code>Curses</code> environment, configure it and then clean
323
+ up when the caller is done.</p>
324
+ </div></span>
325
+
326
+ </li>
327
+
328
+
329
+ <li class="public ">
330
+ <span class="summary_signature">
331
+
332
+ <a href="#update-instance_method" title="#update (instance method)">#<strong>update</strong>(tiles) &#x21d2; Object </a>
333
+
334
+
335
+
336
+ </span>
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+ <span class="summary_desc"><div class='inline'>
347
+ <p>Redraw all <code>tiles</code> given and refresh the console.</p>
348
+ </div></span>
349
+
350
+ </li>
351
+
352
+
353
+ <li class="public ">
354
+ <span class="summary_signature">
355
+
356
+ <a href="#width-instance_method" title="#width (instance method)">#<strong>width</strong> &#x21d2; Integer </a>
357
+
358
+
359
+
360
+ </span>
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+ <span class="summary_desc"><div class='inline'>
371
+ <p><code>width</code> of console.</p>
372
+ </div></span>
373
+
374
+ </li>
375
+
376
+
377
+ <li class="public ">
378
+ <span class="summary_signature">
379
+
380
+ <a href="#wipe-instance_method" title="#wipe (instance method)">#<strong>wipe</strong> &#x21d2; Object </a>
381
+
382
+
383
+
384
+ </span>
385
+
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+ <span class="summary_desc"><div class='inline'></div></span>
395
+
396
+ </li>
397
+
398
+
399
+ </ul>
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+
410
+ <div id="instance_attr_details" class="attr_details">
411
+ <h2>Instance Attribute Details</h2>
412
+
413
+
414
+ <span id=""></span>
415
+ <div class="method_details first">
416
+ <h3 class="signature first" id="key_info-instance_method">
417
+
418
+ #<strong>key_info</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
419
+
420
+
421
+
422
+
423
+
424
+ </h3><div class="docstring">
425
+ <div class="discussion">
426
+
427
+ <p>Returns the value of attribute key_info</p>
428
+
429
+
430
+ </div>
431
+ </div>
432
+ <div class="tags">
433
+
434
+
435
+ </div><table class="source_code">
436
+ <tr>
437
+ <td>
438
+ <pre class="lines">
439
+
440
+
441
+ 62
442
+ 63
443
+ 64</pre>
444
+ </td>
445
+ <td>
446
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 62</span>
447
+
448
+ <span class='kw'>def</span> <span class='id identifier rubyid_key_info'>key_info</span>
449
+ <span class='ivar'>@key_info</span>
450
+ <span class='kw'>end</span></pre>
451
+ </td>
452
+ </tr>
453
+ </table>
454
+ </div>
455
+
456
+ </div>
457
+
458
+
459
+ <div id="instance_method_details" class="method_details_list">
460
+ <h2>Instance Method Details</h2>
461
+
462
+
463
+ <div class="method_details first">
464
+ <h3 class="signature first" id="close-instance_method">
465
+
466
+ #<strong>close</strong> &#x21d2; <tt>Object</tt>
467
+
468
+
469
+
470
+
471
+
472
+ </h3><div class="docstring">
473
+ <div class="discussion">
474
+
475
+ <p>Turn line buffering on and close the <code>Curses</code> session.</p>
476
+
477
+
478
+ </div>
479
+ </div>
480
+ <div class="tags">
481
+
482
+
483
+ </div><table class="source_code">
484
+ <tr>
485
+ <td>
486
+ <pre class="lines">
487
+
488
+
489
+ 141
490
+ 142
491
+ 143
492
+ 144
493
+ 145
494
+ 146</pre>
495
+ </td>
496
+ <td>
497
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 141</span>
498
+
499
+ <span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
500
+ <span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_closed?'>closed?</span>
501
+
502
+ <span class='id identifier rubyid_nocbreak'>nocbreak</span>
503
+ <span class='id identifier rubyid_close_screen'>close_screen</span>
504
+ <span class='kw'>end</span></pre>
505
+ </td>
506
+ </tr>
507
+ </table>
508
+ </div>
509
+
510
+ <div class="method_details ">
511
+ <h3 class="signature " id="draw-instance_method">
512
+
513
+ #<strong>draw</strong>(tile) &#x21d2; <tt>Object</tt>
514
+
515
+
516
+
517
+
518
+
519
+ </h3><div class="docstring">
520
+ <div class="discussion">
521
+
522
+
523
+ </div>
524
+ </div>
525
+ <div class="tags">
526
+ <p class="tag_title">Parameters:</p>
527
+ <ul class="param">
528
+
529
+ <li>
530
+
531
+ <span class='name'>color</span>
532
+
533
+
534
+ <span class='type'>(<tt>Integer</tt>)</span>
535
+
536
+
537
+
538
+ &mdash;
539
+ <div class='inline'>
540
+ <p>0 to 8</p>
541
+ </div>
542
+
543
+ </li>
544
+
545
+ <li>
546
+
547
+ <span class='name'>x</span>
548
+
549
+
550
+ <span class='type'>(<tt>Integer</tt>)</span>
551
+
552
+
553
+
554
+ </li>
555
+
556
+ <li>
557
+
558
+ <span class='name'>y</span>
559
+
560
+
561
+ <span class='type'>(<tt>Integer</tt>)</span>
562
+
563
+
564
+
565
+ </li>
566
+
567
+ </ul>
568
+
569
+
570
+ </div><table class="source_code">
571
+ <tr>
572
+ <td>
573
+ <pre class="lines">
574
+
575
+
576
+ 129
577
+ 130
578
+ 131
579
+ 132
580
+ 133</pre>
581
+ </td>
582
+ <td>
583
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 129</span>
584
+
585
+ <span class='kw'>def</span> <span class='id identifier rubyid_draw'>draw</span><span class='lparen'>(</span><span class='id identifier rubyid_tile'>tile</span><span class='rparen'>)</span>
586
+ <span class='id identifier rubyid_setpos'>setpos</span> <span class='op'>*</span><span class='id identifier rubyid_tile'>tile</span><span class='period'>.</span><span class='id identifier rubyid_location'>location</span>
587
+
588
+ <span class='id identifier rubyid_attron'>attron</span><span class='lparen'>(</span><span class='id identifier rubyid_color_pair'>color_pair</span> <span class='id identifier rubyid_tile'>tile</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_addstr'>addstr</span> <span class='id identifier rubyid_tile'>tile</span><span class='period'>.</span><span class='id identifier rubyid_icon'>icon</span> <span class='rbrace'>}</span>
589
+ <span class='kw'>end</span></pre>
590
+ </td>
591
+ </tr>
592
+ </table>
593
+ </div>
594
+
595
+ <div class="method_details ">
596
+ <h3 class="signature " id="height-instance_method">
597
+
598
+ #<strong>height</strong> &#x21d2; <tt>Integer</tt>
599
+
600
+
601
+
602
+
603
+
604
+ </h3><div class="docstring">
605
+ <div class="discussion">
606
+
607
+ <p>Returns <code>height</code> of console</p>
608
+
609
+
610
+ </div>
611
+ </div>
612
+ <div class="tags">
613
+
614
+ <p class="tag_title">Returns:</p>
615
+ <ul class="return">
616
+
617
+ <li>
618
+
619
+
620
+ <span class='type'>(<tt>Integer</tt>)</span>
621
+
622
+
623
+
624
+ &mdash;
625
+ <div class='inline'>
626
+ <p><code>height</code> of console</p>
627
+ </div>
628
+
629
+ </li>
630
+
631
+ </ul>
632
+
633
+ </div><table class="source_code">
634
+ <tr>
635
+ <td>
636
+ <pre class="lines">
637
+
638
+
639
+ 115
640
+ 116
641
+ 117</pre>
642
+ </td>
643
+ <td>
644
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 115</span>
645
+
646
+ <span class='kw'>def</span> <span class='id identifier rubyid_height'>height</span>
647
+ <span class='ivar'>@height</span> <span class='op'>||=</span> <span class='id identifier rubyid_lines'>lines</span>
648
+ <span class='kw'>end</span></pre>
649
+ </td>
650
+ </tr>
651
+ </table>
652
+ </div>
653
+
654
+ <div class="method_details ">
655
+ <h3 class="signature " id="init_colors-instance_method">
656
+
657
+ #<strong>init_colors</strong> &#x21d2; <tt>Object</tt>
658
+
659
+
660
+
661
+
662
+
663
+ </h3><table class="source_code">
664
+ <tr>
665
+ <td>
666
+ <pre class="lines">
667
+
668
+
669
+ 85
670
+ 86
671
+ 87
672
+ 88
673
+ 89
674
+ 90
675
+ 91
676
+ 92
677
+ 93
678
+ 94
679
+ 95
680
+ 96
681
+ 97
682
+ 98
683
+ 99</pre>
684
+ </td>
685
+ <td>
686
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 85</span>
687
+
688
+ <span class='kw'>def</span> <span class='id identifier rubyid_init_colors'>init_colors</span>
689
+ <span class='id identifier rubyid_start_color'>start_color</span>
690
+ <span class='id identifier rubyid_use_default_colors'>use_default_colors</span>
691
+
692
+ <span class='comment'>#id #fg #bg
693
+ </span> <span class='id identifier rubyid_init_pair'>init_pair</span> <span class='const'><span class='object_link'><a href="Console/Color.html#BLACK-constant" title="Swarm::Console::Color::BLACK (constant)">BLACK</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#BLACK-constant" title="Swarm::Console::Color::BLACK (constant)">BLACK</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#BLACK-constant" title="Swarm::Console::Color::BLACK (constant)">BLACK</a></span></span>
694
+ <span class='id identifier rubyid_init_pair'>init_pair</span> <span class='const'><span class='object_link'><a href="Console/Color.html#SILVER-constant" title="Swarm::Console::Color::SILVER (constant)">SILVER</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#SILVER-constant" title="Swarm::Console::Color::SILVER (constant)">SILVER</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#SILVER-constant" title="Swarm::Console::Color::SILVER (constant)">SILVER</a></span></span>
695
+ <span class='id identifier rubyid_init_pair'>init_pair</span> <span class='const'><span class='object_link'><a href="Console/Color.html#WHITE-constant" title="Swarm::Console::Color::WHITE (constant)">WHITE</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#WHITE-constant" title="Swarm::Console::Color::WHITE (constant)">WHITE</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#WHITE-constant" title="Swarm::Console::Color::WHITE (constant)">WHITE</a></span></span>
696
+ <span class='id identifier rubyid_init_pair'>init_pair</span> <span class='const'><span class='object_link'><a href="Console/Color.html#GREY-constant" title="Swarm::Console::Color::GREY (constant)">GREY</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#GREY-constant" title="Swarm::Console::Color::GREY (constant)">GREY</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#GREY-constant" title="Swarm::Console::Color::GREY (constant)">GREY</a></span></span>
697
+ <span class='id identifier rubyid_init_pair'>init_pair</span> <span class='const'><span class='object_link'><a href="Console/Color.html#RED-constant" title="Swarm::Console::Color::RED (constant)">RED</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#RED-constant" title="Swarm::Console::Color::RED (constant)">RED</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#BLACK-constant" title="Swarm::Console::Color::BLACK (constant)">BLACK</a></span></span>
698
+ <span class='id identifier rubyid_init_pair'>init_pair</span> <span class='const'><span class='object_link'><a href="Console/Color.html#PURPLE-constant" title="Swarm::Console::Color::PURPLE (constant)">PURPLE</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#PURPLE-constant" title="Swarm::Console::Color::PURPLE (constant)">PURPLE</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#BLACK-constant" title="Swarm::Console::Color::BLACK (constant)">BLACK</a></span></span>
699
+ <span class='id identifier rubyid_init_pair'>init_pair</span> <span class='const'><span class='object_link'><a href="Console/Color.html#GREEN-constant" title="Swarm::Console::Color::GREEN (constant)">GREEN</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#GREEN-constant" title="Swarm::Console::Color::GREEN (constant)">GREEN</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#BLACK-constant" title="Swarm::Console::Color::BLACK (constant)">BLACK</a></span></span>
700
+ <span class='id identifier rubyid_init_pair'>init_pair</span> <span class='const'><span class='object_link'><a href="Console/Color.html#BLUE-constant" title="Swarm::Console::Color::BLUE (constant)">BLUE</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#BLUE-constant" title="Swarm::Console::Color::BLUE (constant)">BLUE</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#BLACK-constant" title="Swarm::Console::Color::BLACK (constant)">BLACK</a></span></span>
701
+ <span class='id identifier rubyid_init_pair'>init_pair</span> <span class='const'><span class='object_link'><a href="Console/Color.html#YELLOW-constant" title="Swarm::Console::Color::YELLOW (constant)">YELLOW</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#YELLOW-constant" title="Swarm::Console::Color::YELLOW (constant)">YELLOW</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console/Color.html#BLACK-constant" title="Swarm::Console::Color::BLACK (constant)">BLACK</a></span></span>
702
+ <span class='kw'>end</span></pre>
703
+ </td>
704
+ </tr>
705
+ </table>
706
+ </div>
707
+
708
+ <div class="method_details ">
709
+ <h3 class="signature " id="init_keys-instance_method">
710
+
711
+ #<strong>init_keys</strong> &#x21d2; <tt>Object</tt>
712
+
713
+
714
+
715
+
716
+
717
+ </h3><table class="source_code">
718
+ <tr>
719
+ <td>
720
+ <pre class="lines">
721
+
722
+
723
+ 66
724
+ 67
725
+ 68
726
+ 69
727
+ 70
728
+ 71
729
+ 72
730
+ 73
731
+ 74
732
+ 75
733
+ 76
734
+ 77
735
+ 78
736
+ 79
737
+ 80
738
+ 81
739
+ 82
740
+ 83</pre>
741
+ </td>
742
+ <td>
743
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 66</span>
744
+
745
+ <span class='kw'>def</span> <span class='id identifier rubyid_init_keys'>init_keys</span>
746
+ <span class='id identifier rubyid_nonl'>nonl</span>
747
+ <span class='id identifier rubyid_noecho'>noecho</span> <span class='comment'># don&#39;t echo keypresses
748
+ </span> <span class='id identifier rubyid_stdscr'>stdscr</span><span class='period'>.</span><span class='id identifier rubyid_nodelay'>nodelay</span> <span class='op'>=</span> <span class='op'>-</span><span class='int'>1</span> <span class='comment'># don&#39;t wait for input, just listen for it
749
+ </span> <span class='id identifier rubyid_stdscr'>stdscr</span><span class='period'>.</span><span class='id identifier rubyid_keypad'>keypad</span> <span class='kw'>true</span>
750
+
751
+ <span class='ivar'>@key_info</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>pause:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&lt;SPACEBAR&gt;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>quit:</span> <span class='CHAR'>?q</span><span class='rbrace'>}</span>
752
+
753
+ <span class='kw'>if</span> <span class='const'>ENV</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>SWARM</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>VIM_MODE</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>easy</span><span class='tstring_end'>&#39;</span></span>
754
+ <span class='id identifier rubyid_extend'>extend</span> <span class='const'><span class='object_link'><a href="Console/NormalKey.html" title="Swarm::Console::NormalKey (module)">NormalKey</a></span></span>
755
+
756
+ <span class='ivar'>@key_info</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='label'>north:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&lt;UP&gt;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>south:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&lt;DOWN&gt;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>west:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&lt;LEFT&gt;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>east:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>&lt;RIGHT&gt;</span><span class='tstring_end'>&#39;</span></span>
757
+ <span class='kw'>else</span>
758
+ <span class='id identifier rubyid_extend'>extend</span> <span class='const'><span class='object_link'><a href="Console/VIKey.html" title="Swarm::Console::VIKey (module)">VIKey</a></span></span>
759
+
760
+ <span class='ivar'>@key_info</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='label'>north:</span> <span class='CHAR'>?k</span><span class='comma'>,</span> <span class='label'>south:</span> <span class='CHAR'>?j</span><span class='comma'>,</span> <span class='label'>west:</span> <span class='CHAR'>?h</span><span class='comma'>,</span> <span class='label'>east:</span> <span class='CHAR'>?l</span>
761
+ <span class='kw'>end</span>
762
+ <span class='kw'>end</span></pre>
763
+ </td>
764
+ </tr>
765
+ </table>
766
+ </div>
767
+
768
+ <div class="method_details ">
769
+ <h3 class="signature " id="keypress-instance_method">
770
+
771
+ #<strong>keypress</strong> {|command| ... } &#x21d2; <tt>Object</tt>
772
+
773
+
774
+
775
+
776
+
777
+ </h3><div class="docstring">
778
+ <div class="discussion">
779
+
780
+
781
+ </div>
782
+ </div>
783
+ <div class="tags">
784
+
785
+ <p class="tag_title">Yield Parameters:</p>
786
+ <ul class="yieldparam">
787
+
788
+ <li>
789
+
790
+ <span class='name'>command</span>
791
+
792
+
793
+ <span class='type'>(<tt>String</tt>)</span>
794
+
795
+
796
+
797
+ &mdash;
798
+ <div class='inline'>
799
+ <p>yields <code>command</code> on keypress</p>
800
+ </div>
801
+
802
+ </li>
803
+
804
+ </ul>
805
+
806
+ </div><table class="source_code">
807
+ <tr>
808
+ <td>
809
+ <pre class="lines">
810
+
811
+
812
+ 102
813
+ 103
814
+ 104</pre>
815
+ </td>
816
+ <td>
817
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 102</span>
818
+
819
+ <span class='kw'>def</span> <span class='id identifier rubyid_keypress'>keypress</span>
820
+ <span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_getch'>getch</span> <span class='kw'>and</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
821
+ <span class='kw'>end</span></pre>
822
+ </td>
823
+ </tr>
824
+ </table>
825
+ </div>
826
+
827
+ <div class="method_details ">
828
+ <h3 class="signature " id="open-instance_method">
829
+
830
+ #<strong>open</strong> &#x21d2; <tt>Object</tt>
831
+
832
+
833
+
834
+
835
+
836
+ </h3><div class="docstring">
837
+ <div class="discussion">
838
+
839
+ <p>Initialize the <code>Curses</code> environment, configure it and then clean
840
+ up when the caller is done. 9 different bg/fg pairs are initialized for the
841
+ colored <code>Tile</code> squares (0-8): (black, red, green, yellow, blue,
842
+ magenta, cyan, white, grey)</p>
843
+
844
+
845
+ </div>
846
+ </div>
847
+ <div class="tags">
848
+
849
+
850
+ </div><table class="source_code">
851
+ <tr>
852
+ <td>
853
+ <pre class="lines">
854
+
855
+
856
+ 152
857
+ 153
858
+ 154
859
+ 155
860
+ 156
861
+ 157
862
+ 158
863
+ 159
864
+ 160
865
+ 161
866
+ 162
867
+ 163</pre>
868
+ </td>
869
+ <td>
870
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 152</span>
871
+
872
+ <span class='kw'>def</span> <span class='id identifier rubyid_open'>open</span>
873
+ <span class='id identifier rubyid_init_screen'>init_screen</span>
874
+ <span class='id identifier rubyid_init_colors'>init_colors</span>
875
+ <span class='id identifier rubyid_init_keys'>init_keys</span>
876
+
877
+ <span class='id identifier rubyid_curs_set'>curs_set</span> <span class='int'>0</span> <span class='comment'># hide the cursor
878
+ </span> <span class='id identifier rubyid_cbreak'>cbreak</span> <span class='comment'># turn off line buffering
879
+ </span>
880
+ <span class='kw'>yield</span>
881
+
882
+ <span class='id identifier rubyid_close'>close</span>
883
+ <span class='kw'>end</span></pre>
884
+ </td>
885
+ </tr>
886
+ </table>
887
+ </div>
888
+
889
+ <div class="method_details ">
890
+ <h3 class="signature " id="update-instance_method">
891
+
892
+ #<strong>update</strong>(tiles) &#x21d2; <tt>Object</tt>
893
+
894
+
895
+
896
+
897
+
898
+ </h3><div class="docstring">
899
+ <div class="discussion">
900
+
901
+ <p>Redraw all <code>tiles</code> given and refresh the console</p>
902
+
903
+
904
+ </div>
905
+ </div>
906
+ <div class="tags">
907
+ <p class="tag_title">Parameters:</p>
908
+ <ul class="param">
909
+
910
+ <li>
911
+
912
+ <span class='name'>tiles</span>
913
+
914
+
915
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Tile.html" title="Swarm::Tile (class)">Tile</a></span>, ...&gt;</tt>)</span>
916
+
917
+
918
+
919
+ </li>
920
+
921
+ </ul>
922
+
923
+
924
+ </div><table class="source_code">
925
+ <tr>
926
+ <td>
927
+ <pre class="lines">
928
+
929
+
930
+ 121
931
+ 122
932
+ 123
933
+ 124</pre>
934
+ </td>
935
+ <td>
936
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 121</span>
937
+
938
+ <span class='kw'>def</span> <span class='id identifier rubyid_update'>update</span><span class='lparen'>(</span><span class='id identifier rubyid_tiles'>tiles</span><span class='rparen'>)</span>
939
+ <span class='id identifier rubyid_tiles'>tiles</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='op'>&amp;</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='symbol'>:draw</span><span class='rparen'>)</span>
940
+ <span class='id identifier rubyid_refresh'>refresh</span>
941
+ <span class='kw'>end</span></pre>
942
+ </td>
943
+ </tr>
944
+ </table>
945
+ </div>
946
+
947
+ <div class="method_details ">
948
+ <h3 class="signature " id="width-instance_method">
949
+
950
+ #<strong>width</strong> &#x21d2; <tt>Integer</tt>
951
+
952
+
953
+
954
+
955
+
956
+ </h3><div class="docstring">
957
+ <div class="discussion">
958
+
959
+ <p>Returns <code>width</code> of console</p>
960
+
961
+
962
+ </div>
963
+ </div>
964
+ <div class="tags">
965
+
966
+ <p class="tag_title">Returns:</p>
967
+ <ul class="return">
968
+
969
+ <li>
970
+
971
+
972
+ <span class='type'>(<tt>Integer</tt>)</span>
973
+
974
+
975
+
976
+ &mdash;
977
+ <div class='inline'>
978
+ <p><code>width</code> of console</p>
979
+ </div>
980
+
981
+ </li>
982
+
983
+ </ul>
984
+
985
+ </div><table class="source_code">
986
+ <tr>
987
+ <td>
988
+ <pre class="lines">
989
+
990
+
991
+ 110
992
+ 111
993
+ 112</pre>
994
+ </td>
995
+ <td>
996
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 110</span>
997
+
998
+ <span class='kw'>def</span> <span class='id identifier rubyid_width'>width</span>
999
+ <span class='ivar'>@width</span> <span class='op'>||=</span> <span class='id identifier rubyid_cols'>cols</span>
1000
+ <span class='kw'>end</span></pre>
1001
+ </td>
1002
+ </tr>
1003
+ </table>
1004
+ </div>
1005
+
1006
+ <div class="method_details ">
1007
+ <h3 class="signature " id="wipe-instance_method">
1008
+
1009
+ #<strong>wipe</strong> &#x21d2; <tt>Object</tt>
1010
+
1011
+
1012
+
1013
+
1014
+
1015
+ </h3><table class="source_code">
1016
+ <tr>
1017
+ <td>
1018
+ <pre class="lines">
1019
+
1020
+
1021
+ 135
1022
+ 136
1023
+ 137
1024
+ 138</pre>
1025
+ </td>
1026
+ <td>
1027
+ <pre class="code"><span class="info file"># File 'lib/swarm/console.rb', line 135</span>
1028
+
1029
+ <span class='kw'>def</span> <span class='id identifier rubyid_wipe'>wipe</span>
1030
+ <span class='id identifier rubyid_clear'>clear</span>
1031
+ <span class='id identifier rubyid_refresh'>refresh</span>
1032
+ <span class='kw'>end</span></pre>
1033
+ </td>
1034
+ </tr>
1035
+ </table>
1036
+ </div>
1037
+
1038
+ </div>
1039
+
1040
+ </div>
1041
+
1042
+ <div id="footer">
1043
+ Generated on Wed Aug 30 07:17:58 2017 by
1044
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1045
+ 0.9.9 (ruby-2.4.1).
1046
+ </div>
1047
+
1048
+ </div>
1049
+ </body>
1050
+ </html>