Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualSollum

Posted 19 March 2013 - 03:43 PM

Hmmm, thanks for the tips!

 

For now i'll try to refrain from using threads.

 

Edit:

Do GLSurfaceView.Renderer and Activity start in different threads?

 

Because i stumbled upon that ugly problem ConcurentModificationException in a list.

 

Wrote some locks, but frankly... they look bad >.<

 

 

 

private boolean bIIA_ListLocked;

public boolean isIIALLocked()
{
   return bIIA_ListLocked;
}


public void lockIIAL()
{
   bIIA_ListLocked = true;
}


public void unlockIIAL()
{
   bIIA_ListLocked = false;
}


public void manageEvents()
{
   if (!isIIALLocked())
   {
      lockIIAL();

      for (InterfaceInputAction IIA : IIA_List)
      {
         System.out.println(IIA.getSource() + " " + IIA.getAction());
      }

      IIA_List.clear();

      unlockIIAL();
   }
}


private void addInputEvent(InterfaceInputAction IIA)
{
   if (!isIIALLocked())
   {
      lockIIAL();

      IIA_List.add(IIA);

      unlockIIAL();
   }
}
 

#1Sollum

Posted 19 March 2013 - 12:00 PM

Hmmm, thanks for the tips!

 

For now i'll try to refrain from using threads.


PARTNERS