Event keyhandler
Author |
Message |
DanShadow
|
Posted: Thu Jul 08, 2004 2:30 pm Post subject: Event keyhandler |
|
|
Ive made a program that imports and draws graphics in a void called KeyDown with (Event e, int key). The problem is, it waits for input from the user before continuing. Can someone tell me how I might be able to have it so "IF" a user presses a key, it saves the ASCII (i belive) code under the variable "key" while using the variable "e" to track the event? Or just, like
code: |
while (gameOn ==true)
{
// Do graphics and stuff
if ((e.id=KEY_PRESS) && (e.id=Event.UP))
{
y+=1;
}
}
|
If you can help, thanks. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Dan
|
Posted: Sat Jul 10, 2004 6:11 pm Post subject: (No subject) |
|
|
i am not shure how u are geting the events in e can u post the hole class? And what kind of java/APIs u are using?
If u are using keylistorners i whould think u could just put the code int the keyPressed method. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
|
|