V3 If Any key is pressed?
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Glenshope

Is there possibly a built in function for this, usually I wouldn't ask a question like this but it just to me seems like the sort of thing that should have a built-in function. If not then I suggest we have such a function.

-Glenshope

Posted on 2007-06-18 17:53:11

Overkill

There aren't functions, but there are builtin variables. Check out lastkey and lastpressed. If you're making a text field of some sort, there is code for that in the Code Vault already.

Posted on 2007-06-19 09:42:43

Glenshope

int isAnyKeyPressed()
{
int i;

if( !_anykeyInitted )
{
for( i=0; i<255; i++ )
{
_keyInit[i] = key[i];
}

_anykeyInitted = 1;
}
else
{
for( i=0; i<255; i++ )
{
if( _keyInit[i] != key[i] )
{
return 1;
}
}
}

return 1;
}


Is the code written for me by Astradian, the only problem being it lacks the functionality of the built in key functions. So when I press it, it also uses it to escape the messagebox and such.

Posted on 2007-06-19 11:53:50

Overkill

Okay, so this is a "PRESS ANY KEY TO CONTINUE" type deal? Alright then, something like this would probably work for the loop if I remember how to use lastpressed correctly.

lastpressed = 0;
while (!lastpressed)
{
Render();
PrintString(0, 0, screen, 0, "PRES BUTAN");
ShowPage();
}
key[lastpressed] = 0;
lastpressed = 0;

Posted on 2007-06-20 09:11:11 (last edited on 2007-06-22 11:59:47)

mcgrue

Ah, man. Your method is way better, ovk. For some reason (lack of vergeusing of late, I warrant) I forgot about lastpressed.

Posted on 2007-06-22 06:11:00


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.