I have found a problem in Blackdown J2SE1.3 FCS that
I think affect all SUN Core base releases. I have noticed that KeyEvent
are sometimes not reported properly in the Humanoid Game I developed
a while back. (www.xenonsoft.demon.co.uk/humanoid/humanoid.html)
Whilst looking at the development tree of this game with J2SE I found
that the key event queue system was buggy.

The games uses the following keys by default although this is customizable

[A] up
[Z] down
[S] irrevelant
 [Space] reverse direction of the starship
[Shift] thrust the starship
[Return] fire laser
[H] irrevelant

[Shift] is used for thrusting a spaceship that you see in AWT window.
Consequently shift held down a low.  The problem is that the Blackdown
impl'n does not report key event when the SHIFT KEY is released and
sometime in combination with another key that relased.
 It seems to be missing KEY releases a lot which I rely in my game.

Basically I have IBM JDK 1.3 as my default and found no problems with
this JDK version

Only when I switched Blackdown I found this problems.

We know that Blackdown does share CVS tree with Sun release so this bug
if fixed in the blackdown will propogate back to Sun code base.

You can download the game and compile for yourself. There is a small
executable `Landscape' which you can use see the bug yourself

Here is some cut down code anyway

    protected class GameKeyListener implements KeyListener
    {
     public GameKeyListener()
     {
         // System.out.println("GameKeyListener() *DEBUG*.");
     }

     // Handle Event Driven Input
     public void keyTyped( KeyEvent ke )
     {
     }

     public void keyPressed( KeyEvent ke )
     {
         int keycode = ke.getKeyCode();
         int mods = ke.getModifiers();

         if ( keycode == KEYCODE_UP )
          up_key_pressed = true;
         else if ( keycode == KEYCODE_DOWN )
          down_key_pressed = true;
         else if ( keycode == KEYCODE_THRUST )
          thrust_key_pressed = true;
         else if ( keycode == KEYCODE_LASER )
          fire_key_pressed = true;
         else if ( keycode == KEYCODE_COD )
          cod_key_pressed = true;
         else if ( keycode == KEYCODE_HYPERSPC )
          hyperspace_key_pressed = true;
         else if ( keycode == KEYCODE_SMARTBMB )
          smartbomb_key_pressed = true;

          ...

         // Special case of shift key
         if ( (mods & InputEvent.SHIFT_MASK ) != 0 )
          thrust_key_pressed = true;

     }

     public void keyReleased( KeyEvent ke )
     {
         int keycode = ke.getKeyCode();
         int mods = ke.getModifiers();

         if ( keycode == KEYCODE_UP )
          up_key_pressed = false;
         else if ( keycode == KEYCODE_DOWN )
          down_key_pressed = false;
         else if ( keycode == KEYCODE_THRUST )
          thrust_key_pressed = false;
         else if ( keycode == KEYCODE_LASER )
          fire_key_pressed = false;
         else if ( keycode == KEYCODE_COD )
          cod_key_pressed = false;
         else if ( keycode == KEYCODE_HYPERSPC )
          hyperspace_key_pressed = false;
         else if ( keycode == KEYCODE_SMARTBMB )
          smartbomb_key_pressed = false;
         else if ( keycode == KeyEvent.VK_L &&
                (mods & InputEvent.CTRL_MASK) != 0 ) {
          level_key_pressed = false;
         }

          ...

     }

    }
--
Peter Pilgrim
G.O.A.T
                    "the Greatest Of All Time"



--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorised copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to