<?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[Spielfeld mit CopyRect füllen]]></title><description><![CDATA[<p>Hi,<br />
ich habe jetzt ein bisschen mit CopyRect herumgespielt, und wollte dann ein kleines programm programmieren, das eine art spielfeld zusammensetzt.<br />
Ich habe in dem TImage Image1 die einzelnen &quot;Bauteile&quot;, aus der die map zusammengesetzt wird. jedes einzelne Bauteil ist 32x32 pixel groß. in Image1 sind sie alle aneinandergehängt (eine reihe, ohne abstand).</p>
<p>dann habe ich ein 2 dimensionales array, in dem die daten stehen. das spielfeld ist jetzt am anfang mal 5x5 teile groß.<br />
also sieht di matrix z.B. so aus:</p>
<pre><code>1 0 2 3 5
6 2 0 1 0
3 2 1 0 1
3 0 0 0 2
0 0 0 2 1
</code></pre>
<p>Das eigentliche spielfeld ist Image2.</p>
<p>mein code, der die teile aus Image1 in Image2 kopiert sieht so aus:</p>
<pre><code class="language-cpp">for(int y = 0; y &lt; 5; y++)
{
  for(int x = 0; x &lt; 5; x++)
  {
      int wert = map[y][x];

      TRect quelle = Rect(32*wert, 0, 32*(wert+1), 32);
      TRect ziel = Rect(32*x, 32*y, 32*(x+1), 32*(y+1));
      Image2-&gt;Canvas-&gt;CopyRect(quelle, Image1-&gt;Canvas, quelle);
  }
}
</code></pre>
<p>aber in Image2 werden die Teile sehr eigenartig angeordnet. woran kann das liegen??? und manchmal bekomme ich in einer reihe mehr als 5 teile.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/79565/spielfeld-mit-copyrect-füllen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 30 Jun 2026 03:28:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/79565.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 Jul 2004 15:47:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Spielfeld mit CopyRect füllen on Mon, 12 Jul 2004 15:47:35 GMT]]></title><description><![CDATA[<p>Hi,<br />
ich habe jetzt ein bisschen mit CopyRect herumgespielt, und wollte dann ein kleines programm programmieren, das eine art spielfeld zusammensetzt.<br />
Ich habe in dem TImage Image1 die einzelnen &quot;Bauteile&quot;, aus der die map zusammengesetzt wird. jedes einzelne Bauteil ist 32x32 pixel groß. in Image1 sind sie alle aneinandergehängt (eine reihe, ohne abstand).</p>
<p>dann habe ich ein 2 dimensionales array, in dem die daten stehen. das spielfeld ist jetzt am anfang mal 5x5 teile groß.<br />
also sieht di matrix z.B. so aus:</p>
<pre><code>1 0 2 3 5
6 2 0 1 0
3 2 1 0 1
3 0 0 0 2
0 0 0 2 1
</code></pre>
<p>Das eigentliche spielfeld ist Image2.</p>
<p>mein code, der die teile aus Image1 in Image2 kopiert sieht so aus:</p>
<pre><code class="language-cpp">for(int y = 0; y &lt; 5; y++)
{
  for(int x = 0; x &lt; 5; x++)
  {
      int wert = map[y][x];

      TRect quelle = Rect(32*wert, 0, 32*(wert+1), 32);
      TRect ziel = Rect(32*x, 32*y, 32*(x+1), 32*(y+1));
      Image2-&gt;Canvas-&gt;CopyRect(quelle, Image1-&gt;Canvas, quelle);
  }
}
</code></pre>
<p>aber in Image2 werden die Teile sehr eigenartig angeordnet. woran kann das liegen??? und manchmal bekomme ich in einer reihe mehr als 5 teile.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/559012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/559012</guid><dc:creator><![CDATA[nuclearspider]]></dc:creator><pubDate>Mon, 12 Jul 2004 15:47:35 GMT</pubDate></item><item><title><![CDATA[Reply to Spielfeld mit CopyRect füllen on Mon, 12 Jul 2004 16:11:04 GMT]]></title><description><![CDATA[<p>Ok, ich habe meine fehler selbst gefunden.</p>
<p>1. int wert = map[y][x];<br />
- x und y vertauscht</p>
<p>2. Image2-&gt;Canvas-&gt;CopyRect(quelle, Image1-&gt;Canvas, quelle);<br />
- 2x quelle???<br />
das muss natürlich Image2-&gt;Canvas-&gt;CopyRect(ziel, Image1-&gt;Canvas, quelle); heißen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/559029</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/559029</guid><dc:creator><![CDATA[nuclearspider]]></dc:creator><pubDate>Mon, 12 Jul 2004 16:11:04 GMT</pubDate></item></channel></rss>