Author Topic: key released  (Read 1885 times)

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
key released
« on: February 21, 2008, 02:53:13 am »
I'm trying to figure out how to get a key released event.  I'm using code from the helloworld

Code: [Select]
   private void keyAffected(KeyState state) {
      int code=state.getKeyCode();
      boolean event=state.getState();
      switch (code) {

         case (KeyEvent.VK_LEFT): {
            left=event;
            break;
         }
         case (KeyEvent.VK_RIGHT): {
            right=event;
            break;
         }
         case (KeyEvent.VK_DOWN):{
        downPressed = event;
         }

      }
   }

A key released is false, but that's sort of a do nothing state also.
click here->Fireside 7 Games<-

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: key released
« Reply #1 on: February 21, 2008, 03:49:11 am »
Oh, never mind.  I made a flag equal to the last state of the downPressed value and checked for a change.
click here->Fireside 7 Games<-