Slick Forums

Discuss the Slick 2D Library
It is currently Wed Oct 16, 2019 9:33 pm

All times are UTC




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Thu Jan 09, 2014 10:12 pm 
Offline

Joined: Thu Oct 25, 2012 5:29 pm
Posts: 31
Just some questions. Will any of the updates allow for getting the size of the bag containing entities in a world? Or the ability to swap the order of entities in the bag?


Top
 Profile  
 
PostPosted: Fri Jan 10, 2014 2:19 pm 
Offline

Joined: Sun Jun 03, 2012 9:21 pm
Posts: 49
If you just want an entity count, you can call EntityManager#getActiveEntityCount to get the total number of active entities.

For entity systems, you can reorder the entities if you want, but you'll have to do it manually - and if you delete entities, you'll need to sort the entities again as Bag doesn't maintain order for efficiency reasons. Other entity bags (ie, those that aren't in EntitySystems) oftentimes occupy the index matching the id of the entity; so you don't want to manually order those.

(ImmutableBag can always be cast into Bag, if you need to tinker with its contents).

_________________
agrotera: bytecode-weaving antiboilerplate lib for artemis. | artemis-odb: bugfixing and performance optimized fork.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group