<?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[[C++] Array erweitern]]></title><description><![CDATA[<p>Nabend <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
Erstmal ein bisschen Code zum Verständnis:</p>
<pre><code class="language-cpp">int c_sprite::addFrame ( char *bitmapPath )
{
	c_bitmap bitmap;

	if ( !bitmap.loadBitmap ( bitmapPath ) )
	{
		return false;
	}

	if ( spriteData.header.spriteWidth &lt; bitmap.bitmapData.infoheader.bitmapWidth )
		spriteData.header.spriteWidth = bitmap.bitmapData.infoheader.bitmapWidth;
	if ( spriteData.header.spriteHeight &lt; bitmap.bitmapData.infoheader.bitmapHeight )
		spriteData.header.spriteHeight = bitmap.bitmapData.infoheader.bitmapHeight;

	long pixels								= bitmap.bitmapData.infoheader.bitmapWidth * bitmap.bitmapData.infoheader.bitmapHeight;
/*			
-&gt;	spriteData.frame						+= new struct c_sprite::d_sprite::d_frame[1];

	spriteData.frame[f].frameType			= SINGLEFRAME;
	spriteData.frame[f].frameOriginX		= 0;
	spriteData.frame[f].frameOriginY		= 0;
	spriteData.frame[f].frameWidth			= bitmap.bitmapData.infoheader.bitmapWidth;
	spriteData.frame[f].frameHeight			= bitmap.bitmapData.infoheader.bitmapHeight;
	spriteData.frame[f].p_frameData			= new unsigned char[pixels];

	for ( int d = 0; d &lt; pixels; d++ )
	{
		spriteData.frame[f].p_frameData[d]		= bitmap.bitmapData.p_pixelmap[d].pixel8Bit;
	}
*/
	return true;
};
</code></pre>
<p>So nun meine Frage:<br />
Wie man die Größe eines Arrays zur Laufzeit eines Programms bestimmt, weiß ich ja.<br />
Aber wie kann man die Größe Erweitern ?</p>
<p>Um in diesem Fall ein weiteres Frame zu einem Sprite hinzuzufügen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/181106/c-array-erweitern</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 04:02:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/181106.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 May 2007 21:37:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [C++] Array erweitern on Wed, 09 May 2007 21:38:49 GMT]]></title><description><![CDATA[<p>Nabend <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
Erstmal ein bisschen Code zum Verständnis:</p>
<pre><code class="language-cpp">int c_sprite::addFrame ( char *bitmapPath )
{
	c_bitmap bitmap;

	if ( !bitmap.loadBitmap ( bitmapPath ) )
	{
		return false;
	}

	if ( spriteData.header.spriteWidth &lt; bitmap.bitmapData.infoheader.bitmapWidth )
		spriteData.header.spriteWidth = bitmap.bitmapData.infoheader.bitmapWidth;
	if ( spriteData.header.spriteHeight &lt; bitmap.bitmapData.infoheader.bitmapHeight )
		spriteData.header.spriteHeight = bitmap.bitmapData.infoheader.bitmapHeight;

	long pixels								= bitmap.bitmapData.infoheader.bitmapWidth * bitmap.bitmapData.infoheader.bitmapHeight;
/*			
-&gt;	spriteData.frame						+= new struct c_sprite::d_sprite::d_frame[1];

	spriteData.frame[f].frameType			= SINGLEFRAME;
	spriteData.frame[f].frameOriginX		= 0;
	spriteData.frame[f].frameOriginY		= 0;
	spriteData.frame[f].frameWidth			= bitmap.bitmapData.infoheader.bitmapWidth;
	spriteData.frame[f].frameHeight			= bitmap.bitmapData.infoheader.bitmapHeight;
	spriteData.frame[f].p_frameData			= new unsigned char[pixels];

	for ( int d = 0; d &lt; pixels; d++ )
	{
		spriteData.frame[f].p_frameData[d]		= bitmap.bitmapData.p_pixelmap[d].pixel8Bit;
	}
*/
	return true;
};
</code></pre>
<p>So nun meine Frage:<br />
Wie man die Größe eines Arrays zur Laufzeit eines Programms bestimmt, weiß ich ja.<br />
Aber wie kann man die Größe Erweitern ?</p>
<p>Um in diesem Fall ein weiteres Frame zu einem Sprite hinzuzufügen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1282018</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1282018</guid><dc:creator><![CDATA[Pyro Phoenix]]></dc:creator><pubDate>Wed, 09 May 2007 21:38:49 GMT</pubDate></item><item><title><![CDATA[Reply to [C++] Array erweitern on Wed, 09 May 2007 21:43:07 GMT]]></title><description><![CDATA[<p>Benutze dafür std::vector. Steht in jedem vernünftigen C++Buch oder auch hier: <a href="http://www.kharchi.de/cppratgeber2.htm" rel="nofollow">http://www.kharchi.de/cppratgeber2.htm</a><br />
Hier ist noch eine Reference: <a href="http://www.cppreference.com/cppvector/index.html" rel="nofollow">http://www.cppreference.com/cppvector/index.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1282020</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1282020</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Wed, 09 May 2007 21:43:07 GMT</pubDate></item><item><title><![CDATA[Reply to [C++] Array erweitern on Wed, 09 May 2007 21:44:40 GMT]]></title><description><![CDATA[<p>Daran hab ich auch schon gedacht.<br />
Ich möchte aber trozdem gerne wissen, ob, und wenn ja, wie das mit Arrays funktioniert.<br />
( Egal wie umständlich es auch sein mag )</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1282023</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1282023</guid><dc:creator><![CDATA[Pyro Phoenix]]></dc:creator><pubDate>Wed, 09 May 2007 21:44:40 GMT</pubDate></item><item><title><![CDATA[Reply to [C++] Array erweitern on Wed, 09 May 2007 21:44:47 GMT]]></title><description><![CDATA[<p>Man kann ein Array nicht nachträglich ändern! Du kannst nur ein neues (größeres) anlegen und den Inhalt des alten Arrays in das neue kopieren/verschieben. Und dann das alte Array löschen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1282024</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1282024</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Wed, 09 May 2007 21:44:47 GMT</pubDate></item><item><title><![CDATA[Reply to [C++] Array erweitern on Wed, 09 May 2007 21:49:23 GMT]]></title><description><![CDATA[<p>Da hätt ich auch gleich drauf kommen können. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>-&gt; CLOSED &lt;-<br />
&amp;<br />
*indeckunggeh*</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1282026</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1282026</guid><dc:creator><![CDATA[Pyro Phoenix]]></dc:creator><pubDate>Wed, 09 May 2007 21:49:23 GMT</pubDate></item></channel></rss>