<?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[Problem mit if und else if]]></title><description><![CDATA[<p>Ich hab noch ein Problem auf meinem Weg, in OpenGL ein Spiel zu programmieren.<br />
Da es aber wieder nur um c++ geht, werde ich es wieder hier posten.</p>
<p>Wie schon der Titel sagt, habe ich ein Problem mit if und else if.</p>
<p>mein Code:</p>
<pre><code class="language-cpp">while (fertig == false)								
	{
		if (PeekMessage(&amp;msg,NULL,0,0,PM_REMOVE))	
		{
			if (msg.message==WM_QUIT)				
			{
			fertig = true;						
			}
			else									
			{
				TranslateMessage(&amp;msg);				
				DispatchMessage(&amp;msg);				
			}
		}
		else										
		{

			if (active == true)			
			{
				if (taste[VK_ESCAPE])				
				{
					fertig = true;
				}
				else								
				{
					DrawGLScene();
				      SwapBuffers(hDC);				
				}
			}
            if (taste[VK_PRIOR])
            {
                taste[VK_PRIOR] = false;
                if (Zoomend = false)
                {
                    Zoomend = true;
                    Zoom = PosZ;
                }
                Zoom -= 0.05f;
            }
            else if (taste[VK_NEXT])
            {
                taste[VK_NEXT] = false;
                if (Zoomend = false)
                {
                    Zoomend = true;
                    Zoom = PosZ;
                }
                Zoom += 0.05f;
            }
            else if (taste[VK_LEFT])
            {
                taste[VK_LEFT] = false;
                RotY -= 1.0f;
            }
            else if (taste[VK_RIGHT])
            {
                taste[VK_RIGHT] = false;
                RotY += 1.0f;
            }
            else if (taste[VK_DOWN])
            {
                taste[VK_DOWN] = false;
                PosZ -= 0.2f;
                PosY = (sin(PosZ))*0.05;
            }
            else if (taste[VK_UP])
            {
                taste[VK_UP] = false;
                PosZ += 0.2f;
                PosY = (sin(PosZ))*0.05;
            }
            else if (taste['Z'])
            {
                 Zoomend = false;
            }
        }
    }				
}
</code></pre>
<p>in dem Feld taste[...] steht, ob in diesem Schleifendurchlauf eine Taste betätigt wurde.</p>
<p>Nun ist es aber aus mir unveratändlichen gründen so, dass Zoomend nie true ist.</p>
<p>Warum ist das so ?</p>
<p>Alle anderen Tasten ausser VK_PRIOR (Page Up) und VK_NEXT (Page Down) funktionieren, die ensprechenden Blocks werden ausgeführt.</p>
<p>Ich habe wirklich alles ausprobiert, Zoomend bleibt false</p>
<p>Ich wäre wirklich froh, wenn ihr mir helfen könntet.</p>
<p>Tim[code]</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/239387/problem-mit-if-und-else-if</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 12:34:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/239387.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 22 Apr 2009 17:54:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit if und else if on Wed, 22 Apr 2009 17:55:10 GMT]]></title><description><![CDATA[<p>Ich hab noch ein Problem auf meinem Weg, in OpenGL ein Spiel zu programmieren.<br />
Da es aber wieder nur um c++ geht, werde ich es wieder hier posten.</p>
<p>Wie schon der Titel sagt, habe ich ein Problem mit if und else if.</p>
<p>mein Code:</p>
<pre><code class="language-cpp">while (fertig == false)								
	{
		if (PeekMessage(&amp;msg,NULL,0,0,PM_REMOVE))	
		{
			if (msg.message==WM_QUIT)				
			{
			fertig = true;						
			}
			else									
			{
				TranslateMessage(&amp;msg);				
				DispatchMessage(&amp;msg);				
			}
		}
		else										
		{

			if (active == true)			
			{
				if (taste[VK_ESCAPE])				
				{
					fertig = true;
				}
				else								
				{
					DrawGLScene();
				      SwapBuffers(hDC);				
				}
			}
            if (taste[VK_PRIOR])
            {
                taste[VK_PRIOR] = false;
                if (Zoomend = false)
                {
                    Zoomend = true;
                    Zoom = PosZ;
                }
                Zoom -= 0.05f;
            }
            else if (taste[VK_NEXT])
            {
                taste[VK_NEXT] = false;
                if (Zoomend = false)
                {
                    Zoomend = true;
                    Zoom = PosZ;
                }
                Zoom += 0.05f;
            }
            else if (taste[VK_LEFT])
            {
                taste[VK_LEFT] = false;
                RotY -= 1.0f;
            }
            else if (taste[VK_RIGHT])
            {
                taste[VK_RIGHT] = false;
                RotY += 1.0f;
            }
            else if (taste[VK_DOWN])
            {
                taste[VK_DOWN] = false;
                PosZ -= 0.2f;
                PosY = (sin(PosZ))*0.05;
            }
            else if (taste[VK_UP])
            {
                taste[VK_UP] = false;
                PosZ += 0.2f;
                PosY = (sin(PosZ))*0.05;
            }
            else if (taste['Z'])
            {
                 Zoomend = false;
            }
        }
    }				
}
</code></pre>
<p>in dem Feld taste[...] steht, ob in diesem Schleifendurchlauf eine Taste betätigt wurde.</p>
<p>Nun ist es aber aus mir unveratändlichen gründen so, dass Zoomend nie true ist.</p>
<p>Warum ist das so ?</p>
<p>Alle anderen Tasten ausser VK_PRIOR (Page Up) und VK_NEXT (Page Down) funktionieren, die ensprechenden Blocks werden ausgeführt.</p>
<p>Ich habe wirklich alles ausprobiert, Zoomend bleibt false</p>
<p>Ich wäre wirklich froh, wenn ihr mir helfen könntet.</p>
<p>Tim[code]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1699836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1699836</guid><dc:creator><![CDATA[Tim1995]]></dc:creator><pubDate>Wed, 22 Apr 2009 17:55:10 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit if und else if on Wed, 22 Apr 2009 17:59:29 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">if(Zoomend = false)
</code></pre>
<p>Und sowas hast du nicht nur einmal hingeschrieben. Der Vergleich geht über <code>operator ==</code> . Was du machst ist eine Zuweisung.<br />
Aber sag mal, wenn du noch bei solchen Dingen scheiterst, ist es da nicht ein wenig übereilt, bereits mit OpenGL zu programmieren?</p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1699838</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1699838</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Wed, 22 Apr 2009 17:59:29 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit if und else if on Wed, 22 Apr 2009 18:08:59 GMT]]></title><description><![CDATA[<p>danke!</p>
<p>Ne, ich denke nich...<br />
bin nur ein bisschen überarbeitet / müde</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1699844</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1699844</guid><dc:creator><![CDATA[Tim1995]]></dc:creator><pubDate>Wed, 22 Apr 2009 18:08:59 GMT</pubDate></item></channel></rss>