<?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[Funktionsproblem wegen unbekannter Variable]]></title><description><![CDATA[<p>hier mal der code mit der problembeschreibung</p>
<pre><code>#include &quot;stdafx.h&quot;
#include &quot;test.h&quot;
#include &lt;xors3d.h&gt;
#include &lt;iostream&gt;
#include &quot;defs.h&quot;
//#include &quot;movement.h&quot;

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
   xGraphics3D(1366, 768, 32, false, true);
   xHidePointer();
   int camera = xCreateCamera();  
   xPositionEntity(camera, 70, 60, 80);
   int light = xCreateLight();
   xPositionEntity(light, 50, 60, 60);
   xRotateEntity(light, 45, 45, 45);
   int terrain = xLoadMesh(&quot;media/terrain.b3d&quot;);
   xPositionEntity(terrain, 0, 0, 0);
   int hud_left = xLoadImage(&quot;media/hud-left.png&quot;);

   while(!xKeyDown(KEY_ESCAPE))
   {

	  if(xKeyDown(KEY_W)) xMoveEntity(camera, 0, 0, 1);
	  if(xKeyDown(KEY_S)) xMoveEntity(camera, 0, 0, -1);
	  if(xKeyDown(KEY_A)) xMoveEntity(camera, -1, 0, 0);
	  if(xKeyDown(KEY_D)) xMoveEntity(camera, 1, 0, 0);

      xRenderWorld();
	  xDrawImage(hud_left, -25, 575);
      xFlip();
   }
   return 0;
}
</code></pre>
<p>funktioniert aber ich will den block...</p>
<pre><code>if(xKeyDown(KEY_W)) xMoveEntity(camera, 0, 0, 1);
	  if(xKeyDown(KEY_S)) xMoveEntity(camera, 0, 0, -1);
	  if(xKeyDown(KEY_A)) xMoveEntity(camera, -1, 0, 0);
	  if(xKeyDown(KEY_D)) xMoveEntity(camera, 1, 0, 0);
</code></pre>
<p>in einer seperaten movement.h datei haben....<br />
so hier solls dann in der movement.h aussehen und ich will das dann mit move();<br />
in der main aufrufen können.<br />
leider kommt dann der fehler weil &quot;camera&quot; nicht bekannt ist...</p>
<pre><code>int move()
{
	  if(xKeyDown(KEY_W)) xMoveEntity(camera, 0, 0, 1);
	  if(xKeyDown(KEY_S)) xMoveEntity(camera, 0, 0, -1);
	  if(xKeyDown(KEY_A)) xMoveEntity(camera, -1, 0, 0);
	  if(xKeyDown(KEY_D)) xMoveEntity(camera, 1, 0, 0);
}
</code></pre>
<p>Such schon ne Weile nach einer Lösung und hab nur gehört man könnte das mit einer Klasse und Singleton lösen, aber so fit bin ich noch nicht.<br />
Man muss das doch aber auch einfacher hinbekommen...</p>
<p>Wenn irgendjemand einen Rat weiß.....möchte doch nur die Bewegungssteuerung extra haben und nur in der Hauptschleife aufrufen müssen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/276998/funktionsproblem-wegen-unbekannter-variable</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 04:22:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/276998.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 11 Nov 2010 11:40:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Funktionsproblem wegen unbekannter Variable on Thu, 11 Nov 2010 11:40:21 GMT]]></title><description><![CDATA[<p>hier mal der code mit der problembeschreibung</p>
<pre><code>#include &quot;stdafx.h&quot;
#include &quot;test.h&quot;
#include &lt;xors3d.h&gt;
#include &lt;iostream&gt;
#include &quot;defs.h&quot;
//#include &quot;movement.h&quot;

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
   xGraphics3D(1366, 768, 32, false, true);
   xHidePointer();
   int camera = xCreateCamera();  
   xPositionEntity(camera, 70, 60, 80);
   int light = xCreateLight();
   xPositionEntity(light, 50, 60, 60);
   xRotateEntity(light, 45, 45, 45);
   int terrain = xLoadMesh(&quot;media/terrain.b3d&quot;);
   xPositionEntity(terrain, 0, 0, 0);
   int hud_left = xLoadImage(&quot;media/hud-left.png&quot;);

   while(!xKeyDown(KEY_ESCAPE))
   {

	  if(xKeyDown(KEY_W)) xMoveEntity(camera, 0, 0, 1);
	  if(xKeyDown(KEY_S)) xMoveEntity(camera, 0, 0, -1);
	  if(xKeyDown(KEY_A)) xMoveEntity(camera, -1, 0, 0);
	  if(xKeyDown(KEY_D)) xMoveEntity(camera, 1, 0, 0);

      xRenderWorld();
	  xDrawImage(hud_left, -25, 575);
      xFlip();
   }
   return 0;
}
</code></pre>
<p>funktioniert aber ich will den block...</p>
<pre><code>if(xKeyDown(KEY_W)) xMoveEntity(camera, 0, 0, 1);
	  if(xKeyDown(KEY_S)) xMoveEntity(camera, 0, 0, -1);
	  if(xKeyDown(KEY_A)) xMoveEntity(camera, -1, 0, 0);
	  if(xKeyDown(KEY_D)) xMoveEntity(camera, 1, 0, 0);
</code></pre>
<p>in einer seperaten movement.h datei haben....<br />
so hier solls dann in der movement.h aussehen und ich will das dann mit move();<br />
in der main aufrufen können.<br />
leider kommt dann der fehler weil &quot;camera&quot; nicht bekannt ist...</p>
<pre><code>int move()
{
	  if(xKeyDown(KEY_W)) xMoveEntity(camera, 0, 0, 1);
	  if(xKeyDown(KEY_S)) xMoveEntity(camera, 0, 0, -1);
	  if(xKeyDown(KEY_A)) xMoveEntity(camera, -1, 0, 0);
	  if(xKeyDown(KEY_D)) xMoveEntity(camera, 1, 0, 0);
}
</code></pre>
<p>Such schon ne Weile nach einer Lösung und hab nur gehört man könnte das mit einer Klasse und Singleton lösen, aber so fit bin ich noch nicht.<br />
Man muss das doch aber auch einfacher hinbekommen...</p>
<p>Wenn irgendjemand einen Rat weiß.....möchte doch nur die Bewegungssteuerung extra haben und nur in der Hauptschleife aufrufen müssen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1978904</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1978904</guid><dc:creator><![CDATA[itmagic]]></dc:creator><pubDate>Thu, 11 Nov 2010 11:40:21 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsproblem wegen unbekannter Variable on Thu, 11 Nov 2010 11:54:24 GMT]]></title><description><![CDATA[<p>Warum nicht mittels Parameterübergabe?</p>
<pre><code class="language-cpp">int move(int camera)
...
</code></pre>
<p>Nachtrag: Und falls dir Parameterübergaben gar nicht in den Sinn kamen, oder gar unbekannt sind, solltest du dich definitiv erst mit einem Grundlagenbuch beschäftigen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1978909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1978909</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Thu, 11 Nov 2010 11:54:24 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsproblem wegen unbekannter Variable on Thu, 11 Nov 2010 11:53:14 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int move(int camera);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1978910</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1978910</guid><dc:creator><![CDATA[Vicious Falcon]]></dc:creator><pubDate>Thu, 11 Nov 2010 11:53:14 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsproblem wegen unbekannter Variable on Thu, 11 Nov 2010 11:54:23 GMT]]></title><description><![CDATA[<p>so hier ging es nicht</p>
<pre><code>#include &quot;stdafx.h&quot;
#include &quot;test.h&quot;
#include &lt;xors3d.h&gt;
#include &lt;iostream&gt;
#include &quot;defs.h&quot;
#include &quot;movement.h&quot;

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
  xGraphics3D(1366, 768, 32, false, true);
   xHidePointer();
   int camera = xCreateCamera();  
   xPositionEntity(camera, 70, 60, 80);
   int light = xCreateLight();
   xPositionEntity(light, 50, 60, 60);
   xRotateEntity(light, 45, 45, 45);
   int terrain = xLoadMesh(&quot;media/terrain.b3d&quot;);
   xPositionEntity(terrain, 0, 0, 0);
   int hud_left = xLoadImage(&quot;media/hud-left.png&quot;);
   while(!xKeyDown(KEY_ESCAPE))
   {
      move(camera);
      xRenderWorld();
	  xDrawImage(hud_left, -25, 575);
      xFlip();
   }
   return 0;
}
</code></pre>
<p>movement.h</p>
<pre><code>int move(int cam)
{

	  if(xKeyDown(KEY_W)) xMoveEntity(camera, 0, 0, 1);
	  if(xKeyDown(KEY_S)) xMoveEntity(camera, 0, 0, -1);
	  if(xKeyDown(KEY_A)) xMoveEntity(camera, -1, 0, 0);
	  if(xKeyDown(KEY_D)) xMoveEntity(camera, 1, 0, 0);
	  return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1978912</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1978912</guid><dc:creator><![CDATA[itmagic]]></dc:creator><pubDate>Thu, 11 Nov 2010 11:54:23 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsproblem wegen unbekannter Variable on Thu, 11 Nov 2010 11:56:58 GMT]]></title><description><![CDATA[<p>itmagic schrieb:</p>
<blockquote>
<p>so hier ging es nicht</p>
</blockquote>
<p>&quot;Geht nicht&quot; ist KEINE ausreichende Fehlerbeschreibung.</p>
<p>Lies bitte auch den Post <a href="http://www.c-plusplus.net/forum/200753" rel="nofollow">hier</a> intensiv durch, speziell den Teil zu präzisen Fehlermeldungen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1978913</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1978913</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Thu, 11 Nov 2010 11:56:58 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsproblem wegen unbekannter Variable on Thu, 11 Nov 2010 12:06:07 GMT]]></title><description><![CDATA[<p>itmagic schrieb:</p>
<blockquote>
<pre><code>int move(int [b]cam[/b])
{

	  if(xKeyDown(KEY_W)) xMoveEntity([b]camera[/b], 0, 0, 1);
	  if(xKeyDown(KEY_S)) xMoveEntity(camera, 0, 0, -1);
	  if(xKeyDown(KEY_A)) xMoveEntity(camera, -1, 0, 0);
	  if(xKeyDown(KEY_D)) xMoveEntity(camera, 1, 0, 0);
	  return 0;
}
</code></pre>
</blockquote>
<p>Ich empfehle, die Basics der Sprache zu lernen, bevor man versucht, mit einer 3D-Engine zu arbeiten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1978919</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1978919</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Thu, 11 Nov 2010 12:06:07 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsproblem wegen unbekannter Variable on Thu, 11 Nov 2010 12:16:03 GMT]]></title><description><![CDATA[<p>habs schon...übergabeparameter aus camera nach cam ändern...schusselfehler..<br />
hab die engine vorher mit ner anderen sprache genutzt....und steige erst in c++ ein...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1978922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1978922</guid><dc:creator><![CDATA[itmagic]]></dc:creator><pubDate>Thu, 11 Nov 2010 12:16:03 GMT</pubDate></item></channel></rss>