Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualVortez

Posted 13 June 2013 - 06:24 PM

Dude... your message loop is all wrong... you shouldn't have 2 loops and it need an if/else condition, not only an if.

Forget the syskey msg...

 

That's how it should be done.

//-----------------------------------------------------------------------------
// The game loop...
//-----------------------------------------------------------------------------
void CVortez3DEngine::GameLoop()
{
	MSG msg;
	bool done = false;

	// Empty the nessages queue if this isn't the first loop
	static bool IsFirstLoop = true;
	if(!IsFirstLoop)
		while(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE));

	// Application loop.
	while(!done){
		if(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)){
			
			// If a quit message is received then stop the loop
			if(msg.message == WM_QUIT)
				done = true;
			
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		} else {
			// Reset the polygon rendered counter
			NumPolygonsDrawed = 0;
			// Update the scene and render a frame
			UpdateScene(EngineTimer.Tick());
    		        RenderScene();
		}
	}

	// Tell the application that we've run the game loop before
	IsFirstLoop = false;
}


#5Vortez

Posted 13 June 2013 - 05:59 PM

Dude... your message loop is all wrong... you shouldn't have 2 loops and it need an if/else condition, not only an if.

Forget the syskey msg...

 

That's how it should be done.

//-----------------------------------------------------------------------------
// The game loop...
//-----------------------------------------------------------------------------
void CVortez3DEngine::GameLoop()
{
	MSG msg;
	bool done = false;

	// Empty the nessages queue if this isn't the first loop
	static bool IsFirstLoop = true;
	if(!IsFirstLoop)
		while(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE));

	// Application loop.
	while(!done){
		if(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)){
			
			// If a quit message is received then stop the loop
			if(msg.message == WM_QUIT)
				done = true;
			
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		} else {
			// Reset the polygon rendered counter
			NumPolygonsDrawed = 0;
			// Update the scene and render a frame
			UpdateScene(EngineTimer.Tick());
    		        RenderScene();
		}
	}

	// Tell the application that we've run the game loop before
	IsFirstLoop = false;
}


#4Vortez

Posted 13 June 2013 - 05:59 PM

Dude... your message loop is all wrong... you shouldn't have 2 loops and it need an if/else condition, not only an if.

Forget the syskey msg...

 

That's how i did mine and it work just fine.

//-----------------------------------------------------------------------------
// The game loop...
//-----------------------------------------------------------------------------
void CVortez3DEngine::GameLoop()
{
	MSG msg;
	bool done = false;

	// Empty the nessages queue if this isn't the first loop
	static bool IsFirstLoop = true;
	if(!IsFirstLoop)
		while(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE));

	// Application loop.
	while(!done){
		if(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)){
			
			// If a quit message is received then stop the loop
			if(msg.message == WM_QUIT)
				done = true;
			
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		} else {
			// Reset the polygon rendered counter
			NumPolygonsDrawed = 0;
			// Update the scene and render a frame
			UpdateScene(EngineTimer.Tick());
    		        RenderScene();
		}
	}

	// Tell the application that we've run the game loop before
	IsFirstLoop = false;
}


#3Vortez

Posted 13 June 2013 - 05:56 PM

Dude... you're message loop is all wrong... you shouldn't have 2 loops and it need an if/else condition, not only an if.

Forget the syskey msg...

 

That's how i did mine and it work just fine.

//-----------------------------------------------------------------------------
// The game loop...
//-----------------------------------------------------------------------------
void CVortez3DEngine::GameLoop()
{
	MSG msg;
	bool done = false;

	// Empty the nessages queue if this isn't the first loop
	static bool IsFirstLoop = true;
	if(!IsFirstLoop)
		while(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE));

	// Application loop.
	while(!done){
		if(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)){
			
			// If a quit message is received then stop the loop
			if(msg.message == WM_QUIT)
				done = true;
			
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		} else {
			// Reset the polygon rendered counter
			NumPolygonsDrawed = 0;
			// Update the scene and render a frame
			UpdateScene(EngineTimer.Tick());
    		        RenderScene();
		}
	}

	// Tell the application that we've run the game loop before
	IsFirstLoop = false;
}


#2Vortez

Posted 13 June 2013 - 05:55 PM

Dude... you're message loop is all wrong... you shouldn't have 2 loops and it need an if/else condition, not only an if.

 

That's how i did mine and it work just fine.

//-----------------------------------------------------------------------------
// The game loop...
//-----------------------------------------------------------------------------
void CVortez3DEngine::GameLoop()
{
	MSG msg;
	bool done = false;

	// Empty the nessages queue if this isn't the first loop
	static bool IsFirstLoop = true;
	if(!IsFirstLoop)
		while(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE));

	// Application loop.
	while(!done){
		if(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)){
			
			// If a quit message is received then stop the loop
			if(msg.message == WM_QUIT)
				done = true;
			
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		} else {
			// Reset the polygon rendered counter
			NumPolygonsDrawed = 0;
			// Update the scene and render a frame
			UpdateScene(EngineTimer.Tick());
    		        RenderScene();
		}
	}

	// Tell the application that we've run the game loop before
	IsFirstLoop = false;
}


#1Vortez

Posted 13 June 2013 - 05:54 PM

Dude... you're message loop is all wrong... you shouldn't have 2 loops and it need an if/else condition, not only an if.

 

That's how i did mine and it always worked just fine

//-----------------------------------------------------------------------------
// The game loop...
//-----------------------------------------------------------------------------
void CVortez3DEngine::GameLoop()
{
	MSG msg;
	bool done = false;

	// Empty the nessages queue if this isn't the first loop
	static bool IsFirstLoop = true;
	if(!IsFirstLoop)
		while(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE));

	// Application loop.
	while(!done){
		if(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)){
			
			// If a quit message is received then stop the loop
			if(msg.message == WM_QUIT)
				done = true;
			
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		} else {
			// Reset the polygon rendered counter
			NumPolygonsDrawed = 0;
			// Update the scene and render a frame
			UpdateScene(EngineTimer.Tick());
    		        RenderScene();
		}
	}

	// Tell the application that we've run the game loop before
	IsFirstLoop = false;
}


PARTNERS