Problem with events &  Linux MDK 9.1

Hi!

I have a problem with my keyboard event code with lwjgl 0.6 under linux. The code in question worked perfectly under win32 using lwjgl 0.5 so I’m not sure what I’m doing wrong here.

Here is how I handle the keyboard events:

How I create the keyboard:


   public GameHandler() {


      // Create a new gl window
      glWin = new GLWindow(Preferences.width, Preferences.height, Preferences.bpp, true);
      this.gl = GLWindow.gl;
    Renderer.init(GLWindow.gl);
      
      // Get time timer resolution (ie ticks/sec)
      timerRes = Sys.getTimerResolution();

      // Create native keyboard binding and create an event buffer
      try {
          Keyboard.create();      
            Mouse.create();
          System.out.println("Keyboard buffer size:" + Keyboard.enableBuffer());
      } catch(Exception e) {
          System.err.println("Could not create keyboard for the rendering window" + e);
      }

And here is the keyboard processing method called from my main loop:


 public void processKeyboard() {
       
      Keyboard.read();
        
      for(int i = 0; i < Keyboard.getNumKeyboardEvents(); i++) {
            Keyboard.next();
          keys[Keyboard.key] = !keys[Keyboard.key];
      }
      

      if(keys[Keyboard.KEY_ESCAPE]) {
          finished = true;
      }
    }


My problem is that I never recieve any keyboard events, getNumKeyboarEvents always retun 0 (or less I don’t know). I haven’t tested it throughly, but Mouse events doesn’t seem to make their way either…

Suggestions?

/Kalle

Keyboard.enableBuffer(); ?

Look again

Its right there, inside the println statement (okay not good coding practice but I put it there for debugging).

Look for this line in the constructor:

System.out.println(“Keyboard buffer size:” + Keyboard.enableBuffer());

/kalle

Okay, Elias helped me with this problem.

I had just forgotten to call gl.tick() in my conversion to 0.6. Thanx Elias!

/Kalle