Fixed oversights in collision code. More sound control.
[luagame.git] / doc / class_eventmanager.html
blob91106d53dd3ba3f5348e94414dac05262bea2800
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.2.1" />
7 <style type="text/css">
8 /* Debug borders */
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11 border: 1px solid red;
15 body {
16 margin: 1em 5% 1em 5%;
19 a {
20 color: blue;
21 text-decoration: underline;
23 a:visited {
24 color: fuchsia;
27 em {
28 font-style: italic;
31 strong {
32 font-weight: bold;
35 tt {
36 color: navy;
39 h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
47 h1 {
48 border-bottom: 2px solid silver;
50 h2 {
51 border-bottom: 2px solid silver;
52 padding-top: 0.5em;
55 div.sectionbody {
56 font-family: serif;
57 margin-left: 0;
60 hr {
61 border: 1px solid silver;
64 p {
65 margin-top: 0.5em;
66 margin-bottom: 0.5em;
69 pre {
70 padding: 0;
71 margin: 0;
74 span#author {
75 color: #527bbd;
76 font-family: sans-serif;
77 font-weight: bold;
78 font-size: 1.1em;
80 span#email {
82 span#revision {
83 font-family: sans-serif;
86 div#footer {
87 font-family: sans-serif;
88 font-size: small;
89 border-top: 2px solid silver;
90 padding-top: 0.5em;
91 margin-top: 4.0em;
93 div#footer-text {
94 float: left;
95 padding-bottom: 0.5em;
97 div#footer-badges {
98 float: right;
99 padding-bottom: 0.5em;
102 div#preamble,
103 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
104 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
105 div.admonitionblock {
106 margin-right: 10%;
107 margin-top: 1.5em;
108 margin-bottom: 1.5em;
110 div.admonitionblock {
111 margin-top: 2.5em;
112 margin-bottom: 2.5em;
115 div.content { /* Block element content. */
116 padding: 0;
119 /* Block element titles. */
120 div.title, caption.title {
121 font-family: sans-serif;
122 font-weight: bold;
123 text-align: left;
124 margin-top: 1.0em;
125 margin-bottom: 0.5em;
127 div.title + * {
128 margin-top: 0;
131 td div.title:first-child {
132 margin-top: 0.0em;
134 div.content div.title:first-child {
135 margin-top: 0.0em;
137 div.content + div.title {
138 margin-top: 0.0em;
141 div.sidebarblock > div.content {
142 background: #ffffee;
143 border: 1px solid silver;
144 padding: 0.5em;
147 div.listingblock {
148 margin-right: 0%;
150 div.listingblock > div.content {
151 border: 1px solid silver;
152 background: #f4f4f4;
153 padding: 0.5em;
156 div.quoteblock > div.content {
157 padding-left: 2.0em;
160 div.attribution {
161 text-align: right;
163 div.verseblock + div.attribution {
164 text-align: left;
167 div.admonitionblock .icon {
168 vertical-align: top;
169 font-size: 1.1em;
170 font-weight: bold;
171 text-decoration: underline;
172 color: #527bbd;
173 padding-right: 0.5em;
175 div.admonitionblock td.content {
176 padding-left: 0.5em;
177 border-left: 2px solid silver;
180 div.exampleblock > div.content {
181 border-left: 2px solid silver;
182 padding: 0.5em;
185 div.verseblock div.content {
186 white-space: pre;
189 div.imageblock div.content { padding-left: 0; }
190 div.imageblock img { border: 1px solid silver; }
191 span.image img { border-style: none; }
193 dl {
194 margin-top: 0.8em;
195 margin-bottom: 0.8em;
197 dt {
198 margin-top: 0.5em;
199 margin-bottom: 0;
200 font-style: italic;
202 dd > *:first-child {
203 margin-top: 0;
206 ul, ol {
207 list-style-position: outside;
209 ol.olist2 {
210 list-style-type: lower-alpha;
213 div.tableblock > table {
214 border: 3px solid #527bbd;
216 thead {
217 font-family: sans-serif;
218 font-weight: bold;
220 tfoot {
221 font-weight: bold;
224 div.hlist {
225 margin-top: 0.8em;
226 margin-bottom: 0.8em;
228 div.hlist td {
229 padding-bottom: 5px;
231 td.hlist1 {
232 vertical-align: top;
233 font-style: italic;
234 padding-right: 0.8em;
236 td.hlist2 {
237 vertical-align: top;
240 @media print {
241 div#footer-badges { display: none; }
244 div#toctitle {
245 color: #527bbd;
246 font-family: sans-serif;
247 font-size: 1.1em;
248 font-weight: bold;
249 margin-top: 1.0em;
250 margin-bottom: 0.1em;
253 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
254 margin-top: 0;
255 margin-bottom: 0;
257 div.toclevel2 {
258 margin-left: 2em;
259 font-size: 0.9em;
261 div.toclevel3 {
262 margin-left: 4em;
263 font-size: 0.9em;
265 div.toclevel4 {
266 margin-left: 6em;
267 font-size: 0.9em;
269 /* Workarounds for IE6's broken and incomplete CSS2. */
271 div.sidebar-content {
272 background: #ffffee;
273 border: 1px solid silver;
274 padding: 0.5em;
276 div.sidebar-title, div.image-title {
277 font-family: sans-serif;
278 font-weight: bold;
279 margin-top: 0.0em;
280 margin-bottom: 0.5em;
283 div.listingblock div.content {
284 border: 1px solid silver;
285 background: #f4f4f4;
286 padding: 0.5em;
289 div.quoteblock-content {
290 padding-left: 2.0em;
293 div.exampleblock-content {
294 border-left: 2px solid silver;
295 padding-left: 0.5em;
298 /* IE6 sets dynamically generated links as visited. */
299 div#toc a:visited { color: blue; }
300 </style>
301 <script type="text/javascript">
302 /*<![CDATA[*/
303 window.onload = function(){generateToc(2)}
304 /* Author: Mihai Bazon, September 2002
305 * http://students.infoiasi.ro/~mishoo
307 * Table Of Content generator
308 * Version: 0.4
310 * Feel free to use this script under the terms of the GNU General Public
311 * License, as long as you do not remove or alter this notice.
314 /* modified by Troy D. Hanson, September 2006. License: GPL */
315 /* modified by Stuart Rackham, October 2006. License: GPL */
317 function getText(el) {
318 var text = "";
319 for (var i = el.firstChild; i != null; i = i.nextSibling) {
320 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
321 text += i.data;
322 else if (i.firstChild != null)
323 text += getText(i);
325 return text;
328 function TocEntry(el, text, toclevel) {
329 this.element = el;
330 this.text = text;
331 this.toclevel = toclevel;
334 function tocEntries(el, toclevels) {
335 var result = new Array;
336 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
337 // Function that scans the DOM tree for header elements (the DOM2
338 // nodeIterator API would be a better technique but not supported by all
339 // browsers).
340 var iterate = function (el) {
341 for (var i = el.firstChild; i != null; i = i.nextSibling) {
342 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
343 var mo = re.exec(i.tagName)
344 if (mo)
345 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
346 iterate(i);
350 iterate(el);
351 return result;
354 // This function does the work. toclevels = 1..4.
355 function generateToc(toclevels) {
356 var toc = document.getElementById("toc");
357 var entries = tocEntries(document.getElementsByTagName("body")[0], toclevels);
358 for (var i = 0; i < entries.length; ++i) {
359 var entry = entries[i];
360 if (entry.element.id == "")
361 entry.element.id = "toc" + i;
362 var a = document.createElement("a");
363 a.href = "#" + entry.element.id;
364 a.appendChild(document.createTextNode(entry.text));
365 var div = document.createElement("div");
366 div.appendChild(a);
367 div.className = "toclevel" + entry.toclevel;
368 toc.appendChild(div);
371 /*]]>*/
372 </script>
373 <title>EventManager Class Reference</title>
374 </head>
375 <body>
376 <div id="header">
377 <h1>EventManager Class Reference</h1>
378 <div id="toc">
379 <div id="toctitle">Table of Contents</div>
380 <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
381 </div>
382 </div>
383 <h2>1. Attributes</h2>
384 <div class="sectionbody">
385 <p><em>Italics</em> means private (in the sense that they shouldn't be set manually).</p>
386 <div class="tableblock">
387 <table rules="all"
388 frame="hsides"
389 cellspacing="0" cellpadding="4">
390 <col width="251" />
391 <col width="240" />
392 <thead>
393 <tr>
394 <th align="left">
395 Attribute
396 </th>
397 <th align="left">
398 Description
399 </th>
400 </tr>
401 </thead>
402 <tbody valign="top">
403 <tr>
404 <td align="left">
405 <strong>keyboard</strong>
406 </td>
407 <td align="left">
408 keyboard event table
409 </td>
410 </tr>
411 <tr>
412 <td align="left">
413 keyboard.pressed
414 </td>
415 <td align="left">
416 keyboard pressed events
417 </td>
418 </tr>
419 <tr>
420 <td align="left">
421 keyboard.released
422 </td>
423 <td align="left">
424 keyboard release events
425 </td>
426 </tr>
427 <tr>
428 <td align="left">
429 <strong>mouse</strong>
430 </td>
431 <td align="left">
432 mouse event table
433 </td>
434 </tr>
435 <tr>
436 <td align="left">
437 mouse.motion
438 </td>
439 <td align="left">
440 mouse motion event
441 </td>
442 </tr>
443 <tr>
444 <td align="left">
445 mouse.pressed
446 </td>
447 <td align="left">
448 mouse pressed events
449 </td>
450 </tr>
451 <tr>
452 <td align="left">
453 mouse.released
454 </td>
455 <td align="left">
456 mouse released events
457 </td>
458 </tr>
459 <tr>
460 <td align="left">
461 <strong>joystick</strong>
462 </td>
463 <td align="left">
464 joystick event table
465 </td>
466 </tr>
467 <tr>
468 <td align="left">
469 joystick.axis_motion
470 </td>
471 <td align="left">
472 joystick axis motion events
473 </td>
474 </tr>
475 <tr>
476 <td align="left">
477 joystick.ball_motion
478 </td>
479 <td align="left">
480 joystick ball motion events
481 </td>
482 </tr>
483 <tr>
484 <td align="left">
485 joystick.hat_motion
486 </td>
487 <td align="left">
488 joystick hat motion events
489 </td>
490 </tr>
491 <tr>
492 <td align="left">
493 joystick.pressed
494 </td>
495 <td align="left">
496 joystick button pressed events
497 </td>
498 </tr>
499 <tr>
500 <td align="left">
501 joystick.released
502 </td>
503 <td align="left">
504 joystick button released events
505 </td>
506 </tr>
507 <tr>
508 <td align="left">
509 quit
510 </td>
511 <td align="left">
512 quit event
513 </td>
514 </tr>
515 <tr>
516 <td align="left">
517 <em>type</em>
518 </td>
519 <td align="left">
520 state variable
521 </td>
522 </tr>
523 <tr>
524 <td align="left">
525 <em>state</em>
526 </td>
527 <td align="left">
528 state variable
529 </td>
530 </tr>
531 <tr>
532 <td align="left">
533 <em>arg1</em>
534 </td>
535 <td align="left">
536 state variable
537 </td>
538 </tr>
539 <tr>
540 <td align="left">
541 <em>arg2</em>
542 </td>
543 <td align="left">
544 state variable
545 </td>
546 </tr>
547 <tr>
548 <td align="left">
549 <em>arg3</em>
550 </td>
551 <td align="left">
552 state variable
553 </td>
554 </tr>
555 <tr>
556 <td align="left">
557 <em>arg4</em>
558 </td>
559 <td align="left">
560 state variable
561 </td>
562 </tr>
563 </tbody>
564 </table>
565 </div>
566 </div>
567 <h2>2. Methods</h2>
568 <div class="sectionbody">
569 <div class="tableblock">
570 <table rules="all"
571 frame="hsides"
572 cellspacing="0" cellpadding="4">
573 <col width="171" />
574 <col width="285" />
575 <thead>
576 <tr>
577 <th align="left">
578 Method
579 </th>
580 <th align="left">
581 Description
582 </th>
583 </tr>
584 </thead>
585 <tbody valign="top">
586 <tr>
587 <td align="left">
588 new(o)
589 </td>
590 <td align="left">
591 constructor
592 </td>
593 </tr>
594 <tr>
595 <td align="left">
596 gather_events()
597 </td>
598 <td align="left">
599 processes all pending events
600 </td>
601 </tr>
602 </tbody>
603 </table>
604 </div>
605 </div>
606 <h2>3. Event Function Prototypes</h2>
607 <div class="sectionbody">
608 <div class="tableblock">
609 <table rules="all"
610 frame="hsides"
611 cellspacing="0" cellpadding="4">
612 <col width="251" />
613 <col width="228" />
614 <thead>
615 <tr>
616 <th align="left">
617 Event
618 </th>
619 <th align="left">
620 Prototype
621 </th>
622 </tr>
623 </thead>
624 <tbody valign="top">
625 <tr>
626 <td align="left">
627 mouse.motion
628 </td>
629 <td align="left">
630 function(x, y, xrel, yrel)
631 </td>
632 </tr>
633 <tr>
634 <td align="left">
635 mouse.pressed
636 </td>
637 <td align="left">
638 function(x, y)
639 </td>
640 </tr>
641 <tr>
642 <td align="left">
643 mouse.released
644 </td>
645 <td align="left">
646 function(x, y)
647 </td>
648 </tr>
649 <tr>
650 <td align="left">
651 joystick.axis_motion
652 </td>
653 <td align="left">
654 function(axis, axis_value)
655 </td>
656 </tr>
657 <tr>
658 <td align="left">
659 joystick.ball_motion
660 </td>
661 <td align="left">
662 function(ball, xrel, yrel)
663 </td>
664 </tr>
665 <tr>
666 <td align="left">
667 joystick.hat_motion
668 </td>
669 <td align="left">
670 function(hat, hat_value)
671 </td>
672 </tr>
673 <tr>
674 <td align="left">
675 joystick.pressed
676 </td>
677 <td align="left">
678 function(button)
679 </td>
680 </tr>
681 <tr>
682 <td align="left">
683 joystick.released
684 </td>
685 <td align="left">
686 function(button)
687 </td>
688 </tr>
689 <tr>
690 <td align="left">
691 quit
692 </td>
693 <td align="left">
694 function()
695 </td>
696 </tr>
697 </tbody>
698 </table>
699 </div>
700 </div>
701 <h2>4. Notes</h2>
702 <div class="sectionbody">
703 <p>Joysticks and joystick buttons start numbering at 1, not 0.</p>
704 </div>
705 <h2>5. Usage</h2>
706 <div class="sectionbody">
707 <div class="listingblock">
708 <div class="content"><!-- Generator: GNU source-highlight 2.4
709 by Lorenzo Bettini
710 http://www.lorenzobettini.it
711 http://www.gnu.org/software/src-highlite -->
712 <pre><tt><span style="font-style: italic"><span style="color: #9A1900">--create a new EventManager</span></span>
713 evman <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">EventManager:new</span></span><span style="color: #990000">()</span>
715 <span style="font-style: italic"><span style="color: #9A1900">--add an event to exit when ESC is pressed</span></span>
716 <span style="font-style: italic"><span style="color: #9A1900">-- assumes main loop is controlled by variable "done"</span></span>
717 evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>pressed<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>ESCAPE<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> done <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
719 <span style="font-style: italic"><span style="color: #9A1900">--events to control a player object's movement</span></span>
720 evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>pressed<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>UP<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> player<span style="color: #990000">.</span>y_vel <span style="color: #990000">=</span> <span style="color: #990000">-</span><span style="color: #993399">1</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
721 evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>pressed<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>DOWN<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> player<span style="color: #990000">.</span>y_vel <span style="color: #990000">=</span> <span style="color: #993399">1</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
722 evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>pressed<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>LEFT<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> player<span style="color: #990000">.</span>x_vel <span style="color: #990000">=</span> <span style="color: #990000">-</span><span style="color: #993399">1</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
723 evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>pressed<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>RIGHT<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> player<span style="color: #990000">.</span>x_vel <span style="color: #990000">=</span> <span style="color: #993399">1</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
725 evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>released<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>UP<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> player<span style="color: #990000">.</span>y_vel <span style="color: #990000">=</span> <span style="color: #993399">0</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
726 evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>released<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>DOWN<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> player<span style="color: #990000">.</span>y_vel <span style="color: #990000">=</span> <span style="color: #993399">0</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
727 evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>released<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>LEFT<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> player<span style="color: #990000">.</span>x_vel <span style="color: #990000">=</span> <span style="color: #993399">0</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
728 evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>released<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>RIGHT<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> player<span style="color: #990000">.</span>x_vel <span style="color: #990000">=</span> <span style="color: #993399">0</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
730 <span style="font-style: italic"><span style="color: #9A1900">--EventManager for a fictional menu object</span></span>
731 menu_evman <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">EventManager:new</span></span><span style="color: #990000">()</span>
732 menu_evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>pressed<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>UP<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> menu<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">next_item</span></span><span style="color: #990000">()</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
733 menu_evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>pressed<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>DOWN<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> menu<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">prev_item</span></span><span style="color: #990000">()</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
734 menu_evman<span style="color: #990000">.</span>keyboard<span style="color: #990000">.</span>pressed<span style="color: #990000">[</span>Keys<span style="color: #990000">.</span>RETURN<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> menu<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">execute</span></span><span style="color: #990000">()</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
736 <span style="font-style: italic"><span style="color: #9A1900">--Controlling a player with the mouse</span></span>
737 <span style="font-style: italic"><span style="color: #9A1900">-- assume there exists a player:set_pos(x,y) method</span></span>
739 <span style="font-style: italic"><span style="color: #9A1900">--wrapper function for player:set_pos(x,y)</span></span>
740 <span style="font-weight: bold"><span style="color: #0000FF">function</span></span> <span style="font-weight: bold"><span style="color: #000000">move_player</span></span><span style="color: #990000">(</span>x<span style="color: #990000">,</span>y<span style="color: #990000">)</span>
741 <span style="font-weight: bold"><span style="color: #000000">player:set_pos</span></span><span style="color: #990000">(</span>x<span style="color: #990000">,</span>y<span style="color: #990000">)</span>
742 <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
744 evman<span style="color: #990000">.</span>mouse<span style="color: #990000">.</span>motion <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">move_player</span></span><span style="color: #990000">(</span>x<span style="color: #990000">,</span>y<span style="color: #990000">)</span>
745 evman<span style="color: #990000">.</span>mouse<span style="color: #990000">.</span>pressed<span style="color: #990000">[</span>MouseButton<span style="color: #990000">.</span>BUTTON_LEFT<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> player<span style="color: #990000">.</span>firing <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
746 evman<span style="color: #990000">.</span>mouse<span style="color: #990000">.</span>released<span style="color: #990000">[</span>MouseButton<span style="color: #990000">.</span>BUTTON_LEFT<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> player<span style="color: #990000">.</span>firing <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">false</span></span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
748 <span style="font-style: italic"><span style="color: #9A1900">--quitting (assumes main loop is controlled by done variable)</span></span>
749 evman<span style="color: #990000">.</span>quit <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">function</span></span><span style="color: #990000">()</span> done <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
751 </tt></pre></div></div>
752 </div>
753 <div id="footer">
754 <div id="footer-text">
755 Last updated 18-Aug-2007 19:41:58 EDT
756 </div>
757 </div>
758 </body>
759 </html>