<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Op 3-5-2012 14:24, Laurine Harbulot schreef:
<blockquote cite="mid:COL123-W262C33F8BF50D48597AD87AD2F0@phx.gbl"
type="cite">
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
<div dir="ltr">
Hello all,<br>
We're students and we're working on a space invaders project.<br>
<br>
Our game runs very well but we've got a problem:<br>
We would like to give the opportunity to players to press two
keyboards buttons at the same time but for now,our program tests
only one event at the same time.<br>
Is there a solution for that ?<br>
<br>
Thanks all.<br>
<br>
Laurine and Vincent<br>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">____________________
Racket Users list:
<a class="moz-txt-link-freetext" href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a>
</pre>
</blockquote>
<br>
Hello, <br>
<br>
If I look at this text copied from htpd2e it can't.<br>
<br>
<div class="SIntrapara">Once the <span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/teachpack/2htdpuniverse.html#%28form._%28%28lib._2htdp%2Funiverse..rkt%29._big-bang%29%29"
pltdoc="x">big-bang</a></span> expression is evaluated,
DrRacket acts just like a real operating system, watching the
clock, the key board, and the mouse for events and dispatching to
your designated BSL functions.</div>
<p>The key question is what arguments DrRacket supplies to your
event handlers for key strokes, mouse clicks, and clock ticks and
what kind of results it expects from these event handlers. Like a
real operating system, DrRacket gives these functions access to
the current state of the world. For key events and mouse events,
DrRacket also supplies information about these events.</p>
<p>The initial state is the value of <span class="RktSym">w0</span>,
because our <span class="RktSym"><a class="RktStxLink"
href="http://docs.racket-lang.org/teachpack/2htdpuniverse.html#%28form._%28%28lib._2htdp%2Funiverse..rkt%29._big-bang%29%29"
pltdoc="x">big-bang</a></span> expression says so. It also is
the state that DrRacket hands to the first event handling function
that it uses. DrRacket expects that this event handling function
produces a new state of the world, and DrRacket keeps this result
around until the second event happens. Here is a table that
describes this relationship among worlds and event handling
functions:</p>
<div class="SIntrapara">
<table cellpadding="1" cellspacing="0">
<tbody>
<tr>
<td valign="top" width="500">
<p>event:</p>
</td>
<td valign="top" width="500">
<p><span class="RktSym"><a class="RktStxLink"
href="http://docs.racket-lang.org/teachpack/2htdpuniverse.html#%28form._%28%28lib._2htdp%2Funiverse..rkt%29._big-bang%29%29"
pltdoc="x">big-bang</a></span></p>
</td>
<td valign="top" width="500">
<p><span class="RktSym">e1</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktSym">e2</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktSym">e3</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktSym">e4</span></p>
</td>
</tr>
<tr>
<td valign="top" width="500">
<p>current world:</p>
</td>
<td valign="top" width="500">
<p><span class="RktSym">w0</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktSym">w1</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktSym">w2</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktSym">w3</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktSym">w4</span></p>
</td>
</tr>
<tr>
<td valign="top" width="500">
<p>clock tick:</p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">cth</span><span
class="stt"> </span><span class="RktSym">w0</span><span
class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">cth</span><span
class="stt"> </span><span class="RktSym">w1</span><span
class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">cth</span><span
class="stt"> </span><span class="RktSym">w2</span><span
class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">cth</span><span
class="stt"> </span><span class="RktSym">w3</span><span
class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">cth</span><span
class="stt"> </span><span class="RktSym">w4</span><span
class="RktPn">)</span></p>
</td>
</tr>
<tr>
<td valign="top" width="500">
<p>key stroke:</p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">keh</span><span
class="stt"> </span><span class="RktSym">w0</span><span
class="stt"> </span><span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._......%29%29"
pltdoc="x">...</a></span><span class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">keh</span><span
class="stt"> </span><span class="RktSym">w1</span><span
class="stt"> </span><span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._......%29%29"
pltdoc="x">...</a></span><span class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">keh</span><span
class="stt"> </span><span class="RktSym">w2</span><span
class="stt"> </span><span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._......%29%29"
pltdoc="x">...</a></span><span class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">keh</span><span
class="stt"> </span><span class="RktSym">w3</span><span
class="stt"> </span><span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._......%29%29"
pltdoc="x">...</a></span><span class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">keh</span><span
class="stt"> </span><span class="RktSym">w4</span><span
class="stt"> </span><span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._......%29%29"
pltdoc="x">...</a></span><span class="RktPn">)</span></p>
</td>
</tr>
<tr>
<td valign="top" width="500">
<p>mouse click:</p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">meh</span><span
class="stt"> </span><span class="RktSym">w0</span><span
class="stt"> </span><span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._......%29%29"
pltdoc="x">...</a></span><span class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">meh</span><span
class="stt"> </span><span class="RktSym">w1</span><span
class="stt"> </span><span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._......%29%29"
pltdoc="x">...</a></span><span class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">meh</span><span
class="stt"> </span><span class="RktSym">w2</span><span
class="stt"> </span><span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._......%29%29"
pltdoc="x">...</a></span><span class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">meh</span><span
class="stt"> </span><span class="RktSym">w3</span><span
class="stt"> </span><span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._......%29%29"
pltdoc="x">...</a></span><span class="RktPn">)</span></p>
</td>
<td valign="top" width="500">
<p><span class="RktPn">(</span><span class="RktSym">meh</span><span
class="stt"> </span><span class="RktSym">w4</span><span
class="stt"> </span><span class="RktSym"><a
class="RktStxLink"
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._......%29%29"
pltdoc="x">...</a></span><span class="RktPn">)</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="SIntrapara"><span class="refelem"><span
class="refcolumn"><span class="refcontent">Although you might
imagine that two events happen at the same time, DrRacket
arranges all events in a linear sequence.</span></span></span>The
first row enumerates the events since DrRacket started evaluating
the <span class="RktSym"><a class="RktStxLink"
href="http://docs.racket-lang.org/teachpack/2htdpuniverse.html#%28form._%28%28lib._2htdp%2Funiverse..rkt%29._big-bang%29%29"
pltdoc="x">big-bang</a></span> expression, while the second
row presents the current world—<wbr>a result of processing the
event. The <span class="RktSym"><a class="RktStxLink"
href="http://docs.racket-lang.org/teachpack/2htdpuniverse.html#%28form._%28%28lib._2htdp%2Funiverse..rkt%29._big-bang%29%29"
pltdoc="x">big-bang</a></span> column thus says that <span
class="RktSym">w0</span> becomes the current world as a result
of a <span class="RktSym"><a class="RktStxLink"
href="http://docs.racket-lang.org/teachpack/2htdpuniverse.html#%28form._%28%28lib._2htdp%2Funiverse..rkt%29._big-bang%29%29"
pltdoc="x">big-bang</a></span> event. Each of the remaining
rows tabulates what the functions <span class="RktSym">cth</span>,
<span class="RktSym">keh</span>, and <span class="RktSym">meh</span>
produce when applied to the current world. Only one of these
results is chosen, however, as the current world—<wbr>depending on
which event actually takes place.</div>
<div class="SIntrapara">So suppose <span class="RktSym">e1</span>
is the key stroke <span class="RktVal">"a"</span>, <span
class="RktSym">e2</span> and <span class="RktSym">e3</span> are
clock ticks, and <span class="RktSym">e3</span> is a mouse event.
Then</div>
<div class="SIntrapara">
<ol>
<li>
<p><span class="RktSym">w1</span> is the result of <span
class="RktPn">(</span><span class="RktSym">keh</span><span
class="stt"> </span><span class="RktSym">w0</span><span
class="stt"> </span><span class="RktVal">"a"</span><span
class="RktPn">)</span>, i.e., the fourth cell in the <span
class="RktSym">e1</span> column;</p>
</li>
<li>
<p><span class="RktSym">w2</span> is the result of <span
class="RktPn">(</span><span class="RktSym">cth</span><span
class="stt"> </span><span class="RktSym">w1</span><span
class="RktPn">)</span>, i.e., the third cell in the <span
class="RktSym">e2</span> column;</p>
</li>
<li>
<p><span class="RktSym">w3</span> is <span class="RktPn">(</span><span
class="RktSym">cth</span><span class="stt"> </span><span
class="RktSym">w2</span><span class="RktPn">)</span>,
i.e., again the third cell in the <span class="RktSym">e3</span>
column; and</p>
</li>
<li>
<p><span class="RktPn">(</span><span class="RktSym">meh</span><span
class="stt"> </span><span class="RktSym">w3</span><span
class="stt"> </span><span class="RktVal">90</span><span
class="stt"> </span><span class="RktVal">100</span><span
class="stt"> </span><span class="RktVal">"button-down"</span><span
class="RktPn">)</span> produces <span class="RktSym">w4</span>
assuming<span class="RktSym">e4</span> is the mouse event
“button down” taking place at the position <span
style="font-style: italic;"></span>(<span
style="font-style: italic;"></span>9<span
style="font-style: italic;"></span>0<span
style="font-style: italic;">,</span>1<span
style="font-style: italic;"></span>0<span
style="font-style: italic;"></span>0<span
style="font-style: italic;"></span>)<span
style="font-style: italic;"></span>.</p>
</li>
</ol>
</div>
<br>
Roelof<br>
<br>
</body>
</html>