Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX
Posted by krishnak on Mar 05, 2013; 12:13pm
URL: https://forum.jogamp.org/JOGL-2-0-OpenGL-OpenGL-ES-backend-for-LibGDX-tp4027689p4028505.html
This the update method - the eventQueue is an ArrayList
In the dummy implementation of JoyInput the eventQueue never gets populated so the for loop never executes - with this FPS is 25
In the concrete implementation the eventQueue gets populated by a separate thread - with this the FPS is 15
public void update()
{
synchronized (eventQueue) {
eventQueueCopy.clear();
eventQueueCopy.addAll(eventQueue);
eventQueue.clear();
}
int size = eventQueueCopy.size();
// logger.log(Level.INFO,"Queue size "+size);
float value = 0;
for (int i = 0; i < size; i++)
{
pevent = (PropertyChangeEvent) eventQueueCopy.get(i);
String name = pevent.getButton().name();
//logger.log(Level.INFO,name);
btn = vjt.getButton(name);
if(btn!=null)
{
evt = new JoyButtonEvent(btn, pevent.isPressed());
listener.onJoyButtonEvent(evt);
}
else
{
if (name.equalsIgnoreCase(RemoteButtons.DPadL.name())||(name.equalsIgnoreCase(RemoteButtons.DPadD.name())))
{
value = -1f;
}
else
{
value = 1f;
}
if (name.equalsIgnoreCase(RemoteButtons.DPadL.name())||(name.equalsIgnoreCase(RemoteButtons.DPadR.name())))
{
laxis = vjt.getAxis("POV_x") ;
}
else
{
laxis = vjt.getAxis("POV_y") ;
}
axevt = new JoyAxisEvent(laxis,value);
listener.onJoyAxisEvent(axevt);
}
}
}