MrLoick / angle

Automatically exported from code.google.com/p/angle
0 stars 0 forks source link

draw and step called from different thread than input event calls #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I noticed that step and draw are called from the display thread 
while all input events are forwarded directly from the main thread.
I also wonder why this didn't cause a mess yet ;)
I suggest to add a fixed length threadsafe array of pre-created
AngleInput objects to the display thread.
The display thread delivers those through an input() function just
like it calls draw and step and the Activity delivers its events
to the display thread.
One thing to keep in mind is that the content of an Android event
has to be copied to an AngleInput object since android re-uses its 
event objects.

Cheers

Original issue reported on code.google.com by Michael....@gmail.com on 12 May 2010 at 8:54

GoogleCodeExporter commented 8 years ago
This is not a bug.
Due multi-thread nature of Android. You cannot delete an object of the render 
thread
by yourself. Use removeObject or die instead.
Adding a new object isn't a problem. When you add a new object, it's putted 
into a
'to add' list and will be added to render tree on the next frame. You also can 
force
the add of the pending objects by calling commit()
In my projects I use a 'order to object' triggered in input event and executed 
in
object' step()

Original comment by ipaju...@gmail.com on 13 May 2010 at 7:59

GoogleCodeExporter commented 8 years ago
So if i understand you right...
You can't manipulate attributes of objects in the render tree but you have to 
kill
and recreate them with different attributes?

Original comment by Michael....@gmail.com on 13 May 2010 at 8:07