Beispiel #1
0
static int l_graphics_SpriteBatch_clear(lua_State* state) {
  l_assertType(state, 1, l_graphics_isBatch);

  l_graphics_Batch * batch = l_graphics_toBatch(state, 1);
  graphics_Batch_clear(&batch->batch);

  return 0;
}
Beispiel #2
0
void graphics_ParticleSystem_draw(graphics_ParticleSystem *ps, float x, float y, float r, float sx, float sy, float ox, float oy, float kx, float ky) {
  //printf("Drawing particle system, %d particles\n", ps->activeParticles);

  graphics_Batch *b = &ps->batch;
  //graphics_Batch_bind(b);
  graphics_Batch_clear(b);
  for(graphics_Particle *p = ps->pHead; p; p = p->next) {
    // TODO move the following back to the draw function!
    graphics_Quad const* q = ps->quads[p->quadIndex];
    graphics_Batch_setColor(b, p->color.red, p->color.green, p->color.blue, p->color.alpha);
    graphics_Batch_add(b, q, p->position[0], p->position[1], p->angle, p->size, p->size, ps->offsetX, ps->offsetY, 0.0f, 0.0f);
  }
  graphics_Batch_flush(b);
  graphics_Batch_draw(&ps->batch, x, y, r, sx, sy, ox, oy, kx, ky);
}