yuripourre / gdx-webxr

A WebXR implementation for libGDX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check button states during update

yuripourre opened this issue · comments

This is a convenient logic that can be abstracted to the listener.

When the update method is called, we should compare the current button states to the previous states of each button (for each controller). Then if there are any changes to the state, we should call the proper method on the listener e.g:

if (button[i] != prevButton[i]) {
  if (button[i])
    this.buttonDown(controller, button[i]);
  else
    this.buttonUp(controller, button[i]);
}

//buttonDown->listener?.buttonDown