Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

da_cobra

error acquiering keyboard

This topic is 5913 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

First of all I already searched the forum, but didn''t found a solution to my problem. Secondly acquiering of the keyboard worked fine a couple of days ago, with the same code now my problem when I try to acquire the keyboard the first time it fails so I added this code :
  
if FAILED(g_hr = g_lpDIKeyboard->Acquire())
	{
		Write2Log("Acquiring of keyboard failed, trying again") ;
		g_hr = g_lpDIKeyboard->Acquire() ;
		if (FAILED(g_hr)) 
		{
			g_hr = g_lpDIKeyboard->Acquire() ;
			while(g_hr == DIERR_INPUTLOST) 
					g_hr = g_lpDIKeyboard->Acquire() ;
			Write2Log("Keyboard acquired") ;
		} // end of if

		//return false ;

	} // end of if

	else
	{
		Write2Log("Keyboard acquired") ;
	} // end of else

  
btw in my Log file it says : "Acquiring of keyboard failed, trying again" and then "Keyboard acquired" later I get the same error when I try to acquire the mouse so there I also added the same code now in my menuloop I have this code :
  
void MenuInput()
{
	g_lpDIKeyboard->GetDeviceState(sizeof(buffer),(LPVOID)&buffer) ; 
     
    if (KEYDOWN(buffer, DIK_ESCAPE))
	{
		// when pressing escape, exit game

		g_CGE_GameState = kill ;
	}

	if (KEYDOWN(buffer, DIK_UP) && bKeyUp)
	{
		// when pressing arrow up

		nMenuChoice = nMenuChoice - 1 ;
		if (nMenuChoice < 0) nMenuChoice = 2 ;
		bKeyUp = true ;
	}
	else 
	{
		bKeyUp = false ;
	}

	if (KEYDOWN(buffer, DIK_DOWN) && bKeyDown)
	{
		// when pressing arrow down

		nMenuChoice = nMenuChoice + 1 ;
		if (nMenuChoice > 2) nMenuChoice = 0 ;
		bKeyDown = true ;
	}
	else
	{
		bKeyDown = false ;
	}

} // end of MenuInput() 

  
and in my loop I can''t use the keyboard anymore again and a couple of days ago all worked fine (then I added code for creation of fonts) if any1 could help me out here I would really apreciate it thanx in advance

Share this post


Link to post
Share on other sites
Advertisement

  • 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!