precache static method

void precache(
  1. int count
)

Caches count instances of GSimpleParticle.

If count is less than the number of instances that have already been created, this method does nothing. Otherwise, it creates additional instances of GSimpleParticle and adds them to the cache until there are count instances in total.

Implementation

static void precache(int count) {
  if (count < $instanceCount) {
    return;
  }
  GSimpleParticle? cached = get();
  while ($instanceCount < count) {
    var n = get();
    n.$prev = cached;
    cached = n;
  }
  while (cached != null) {
    var d = cached;
    cached = d.$prev;
    d.dispose();
  }
}