Jump to content
  • Advertisement
Sign in to follow this  
POLSKASH

Debugging Game Issue

This topic is 4886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I recently bought VC++.NET and it's great. However, the debugger just seems to quit on me at a certain point in my code. I have break points in this run function, but when the code gets to this line, movement_timer = time_now;, and I hit continue to move on to the next break point, the entire VC++.NET program loses focus. The title bar at the top fades to light blue instead of the dark blue, and the only buttons I can push are Stop and Break All on the debugger. What is going on?
bool OnePlayer::Run()
{
	while(Msg.message != WM_QUIT && isPlaying)
	{
		if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&Msg);
			DispatchMessage(&Msg);
		}
		else
		{
			time_now = clock();
			if(time_now - movement_timer > CLK_TCK/40) 
			{
				movement_timer = time_now;
				getInputAndUpdate();
				compPaddle->updateComputer(ball->getY());
			}
			ball->checkWallCollision();
			ball->checkPaddleCollision(humanPaddle->getY(), compPaddle->getY());
			ball->checkForPoint(humanScore, compScore);
			ball->updatePos();
			
			D3D_device->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_RGBA(0,0,192,255),1.0f,0);
			D3D_device->BeginScene();
			sprite->Begin(D3DXSPRITE_ALPHABLEND);

			drawBG();
			drawScores();
			humanPaddle->drawPaddle();
			compPaddle->drawPaddle();
			ball->drawBall();

			sprite->End();
			D3D_device->EndScene();
			D3D_device->Present(NULL,NULL,NULL,NULL);
		}
	}
	return false;

}


And on another note, how do I get rid of this warning? LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification

Share this post


Link to post
Share on other sites
Advertisement
Forgive me if you already understand what I am about to explain.
The debugger in Visual Studio supports several different methods to advance program execution.
Continue (F5) means run the program being debugged until a breakpoint is encountered. The program being debugged will probably gain focus, and Visual Studio will lose it.
There are also Step Into (F11)and Step Over(F10). These advance program execution while retaining debugger control.
Where is your break point?

Shawn

Share this post


Link to post
Share on other sites
Heh, the debugger is getting tied down here:

bool OnePlayer::ReadData(IDirectInputDevice8* dev, void* DataBuffer, long BufferSize)
{
while(1)
{
dev->Poll();

if(SUCCEEDED(dev->GetDeviceState(BufferSize,(LPVOID)DataBuffer)))
break;

dev->Acquire();
}
return true;
}

The program doesn't have focus, so the DirectInput device doesn't have control either, and it's getting tied down.


Share this post


Link to post
Share on other sites
It surely means that the 'next' breakpoint is never reached, so your application is going on and on... That's why visual studio loses focus : it's because your app has focus, and the only thing you can do is stop debugging.
=> the link warning simply means your project is build in 'edit and continue' mode (you can modify the code while you are executing the program), this build options needs the 'incremental link' option to work. To get rid of the warning turn off edit and continue or turn on incremental build (in the link tab of your project settings).

Share this post


Link to post
Share on other sites
debugging inputs is a pain due to the focus thing. Look into the exclusive, non-exlcusive mode setup for direct input devices (in the SDK docs somewhere, DISCL_EXCLUSIVE).

You'd better do old style debugging by outputing the values and events to the debug window using OutputDebugString() or dumping to a file.

http://www.codeproject.com/debug/OutputWindows.asp

as for the incremental linking, there is a tickbox in VC6

menu->project->settings->Link->Link Incrementaly.

That should be on by default for debug builds. I'd also recommend you enable edit-and-continue. It can be useful (when it works).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!