Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Event keyhandler
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DanShadow




PostPosted: 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
Sponsor
sponsor
Dan




PostPosted: 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!
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: