<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Tastaturabfrage  mehrere Tasten gleichzeitig abfragen]]></title><description><![CDATA[<p>Ich bin gerade dabei ein kleines Raumschiffspielchen zu Programieren hb jetzt aber das Problem dass wen Player 2 schießt und Player 1 sich bewegen will das Raumschif von Player 2 kaum beweg.</p>
<pre><code class="language-cpp">if (GetAsyncKeyState(VK_SPACE) &lt; 0)
  {
    //Code für Schüsse
  }

  if (GetAsyncKeyState(VK_UP) &lt; 0)
  {
 p1richtung = &quot;oben&quot; ;
  P1-&gt;Picture-&gt;LoadFromFile(pfad + p1raumschifftype + p1zusatz + &quot;o.bmp&quot;);
  if (P1-&gt;Top &gt; 0)
  {
     P1-&gt;Top = P1-&gt;Top - p1bewegung;
  }
   }

   if (GetAsyncKeyState(VK_DOWN) &lt; 0)
  {
 p1richtung = &quot;unten&quot; ;
  P1-&gt;Picture-&gt;LoadFromFile(pfad + p1raumschifftype + p1zusatz + &quot;u.bmp&quot;);
  if (P1-&gt;Top + P1-&gt;Height &lt; Form1-&gt;ClientHeight - 10)
  {
  P1-&gt;Top = P1-&gt;Top + p1bewegung;
  }
  }

   if (GetAsyncKeyState(VK_RIGHT) &lt; 0)
  {
   p1richtung = &quot;rechts&quot; ;
  P1-&gt;Picture-&gt;LoadFromFile(pfad + p1raumschifftype + p1zusatz + &quot;r.bmp&quot;);
  if (P1-&gt;Left + P1-&gt;Width &lt; Form1-&gt;ClientWidth)
  {
  P1-&gt;Left =  P1-&gt;Left + p1bewegung;
  }
  }

   if (GetAsyncKeyState(VK_LEFT) &lt; 0)
  {
  p1richtung = &quot;links&quot; ;
  P1-&gt;Picture-&gt;LoadFromFile(pfad + p1raumschifftype + p1zusatz + &quot;l.bmp&quot;);
  if (P1-&gt;Left &gt; 0)
  {
  P1-&gt;Left =  P1-&gt;Left - p1bewegung;
  }
  }

  // Player2 Tasten-Abfrage

 if (GetAsyncKeyState(VK_LCONTROL) &lt; 0)
  {
     //Code für Schüsse
  }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/148337/tastaturabfrage-mehrere-tasten-gleichzeitig-abfragen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 06 Aug 2026 15:49:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/148337.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 25 May 2006 17:00:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Tastaturabfrage  mehrere Tasten gleichzeitig abfragen on Thu, 25 May 2006 17:00:40 GMT]]></title><description><![CDATA[<p>Ich bin gerade dabei ein kleines Raumschiffspielchen zu Programieren hb jetzt aber das Problem dass wen Player 2 schießt und Player 1 sich bewegen will das Raumschif von Player 2 kaum beweg.</p>
<pre><code class="language-cpp">if (GetAsyncKeyState(VK_SPACE) &lt; 0)
  {
    //Code für Schüsse
  }

  if (GetAsyncKeyState(VK_UP) &lt; 0)
  {
 p1richtung = &quot;oben&quot; ;
  P1-&gt;Picture-&gt;LoadFromFile(pfad + p1raumschifftype + p1zusatz + &quot;o.bmp&quot;);
  if (P1-&gt;Top &gt; 0)
  {
     P1-&gt;Top = P1-&gt;Top - p1bewegung;
  }
   }

   if (GetAsyncKeyState(VK_DOWN) &lt; 0)
  {
 p1richtung = &quot;unten&quot; ;
  P1-&gt;Picture-&gt;LoadFromFile(pfad + p1raumschifftype + p1zusatz + &quot;u.bmp&quot;);
  if (P1-&gt;Top + P1-&gt;Height &lt; Form1-&gt;ClientHeight - 10)
  {
  P1-&gt;Top = P1-&gt;Top + p1bewegung;
  }
  }

   if (GetAsyncKeyState(VK_RIGHT) &lt; 0)
  {
   p1richtung = &quot;rechts&quot; ;
  P1-&gt;Picture-&gt;LoadFromFile(pfad + p1raumschifftype + p1zusatz + &quot;r.bmp&quot;);
  if (P1-&gt;Left + P1-&gt;Width &lt; Form1-&gt;ClientWidth)
  {
  P1-&gt;Left =  P1-&gt;Left + p1bewegung;
  }
  }

   if (GetAsyncKeyState(VK_LEFT) &lt; 0)
  {
  p1richtung = &quot;links&quot; ;
  P1-&gt;Picture-&gt;LoadFromFile(pfad + p1raumschifftype + p1zusatz + &quot;l.bmp&quot;);
  if (P1-&gt;Left &gt; 0)
  {
  P1-&gt;Left =  P1-&gt;Left - p1bewegung;
  }
  }

  // Player2 Tasten-Abfrage

 if (GetAsyncKeyState(VK_LCONTROL) &lt; 0)
  {
     //Code für Schüsse
  }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1065025</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1065025</guid><dc:creator><![CDATA[kevka]]></dc:creator><pubDate>Thu, 25 May 2006 17:00:40 GMT</pubDate></item><item><title><![CDATA[Reply to Tastaturabfrage  mehrere Tasten gleichzeitig abfragen on Thu, 25 May 2006 19:16:44 GMT]]></title><description><![CDATA[<p>du willst also in jedem frame, wenn eine taste gedrückt ist das Bild mit <em>LoadFromFile</em> laden? ich würde dir empfehlen mal die Klasse TBitmap anzuschauen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1065093</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1065093</guid><dc:creator><![CDATA[BigNeal]]></dc:creator><pubDate>Thu, 25 May 2006 19:16:44 GMT</pubDate></item><item><title><![CDATA[Reply to Tastaturabfrage  mehrere Tasten gleichzeitig abfragen on Fri, 26 May 2006 04:46:24 GMT]]></title><description><![CDATA[<p>Hier läuft doch konzeptionell etwas falsch:</p>
<p>- &quot;Gleichzeitig gibt es keine Tastendrücke immer nur hintereinander (ist eine Frage des Zeitabstandes)</p>
<p>- üblicherweise läd man alle Grafiken die das speil immer braucht vorab.</p>
<p>- man schafft sich eine &quot;Zeichenroutine&quot;, die jederzeit das Spielgeschehen zeichnet. Dazu wäre ein Thread nicht schlecht. Nun programmiert, das Spiel so, dass dieser Routine nur die Daten übergeben werden, die sie zeichnen soll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1065199</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1065199</guid><dc:creator><![CDATA[Christian211]]></dc:creator><pubDate>Fri, 26 May 2006 04:46:24 GMT</pubDate></item></channel></rss>