View Single Post
  #554 (permalink)  
Old 29th Apr 2010, 1:23 pm
sig11 sig11 is offline
Junior Member
 
Join Date: Sep 2009
Posts: 31
Default

Quote:
Originally Posted by knob View Post
That great! thanks.
I have been trying to emulate the conio.h functions like clrscr(), gotoxy() getch()to make game porting easier.

I was having problems making a while loop work for a getch() to emulate an operation like "press any key" I'll give it another try.

tried this instead of while:-

int KeyVal;
KeyVal=(*GetKeyVal)();
KeyVal=KeyVal&0x1FFF;

for ( ; ; )
{
if (KeyVal==KEY_VAL_PLAY)
break;
}
player just locks up, got something to do with detecting the keypress.
Use this instead of (*GetKeyVal)();

#define KEY_PORT GPIO_PDAT0
unsigned int getKey()
{
unsigned int KeyTemp;
KeyTemp = read_mem(KEY_PORT);
KeyTemp = ((~KeyTemp) & 0x3f) | (KeyTemp & 0x40);
return (KeyTemp);
}
Reply With Quote