Example #1
0
unsigned int Drawable_getTextureID(Drawable* self)
{
    smug_assert(self != NULL);
    if (self->mSprite == NULL)
    {
        return 0;
    }
    smug_assert(self->mSprite != NULL);
    return Sprite_getTextureId(self->mSprite);
}
Example #2
0
void RenderQueue_addDrawable(RenderQueue* self, Drawable* drawable, float positionX, float positionY)
{
    smug_assert(_invariant(self));
    Sprite* sprite = Drawable_getSprite(drawable);
    smug_assert(sprite != NULL);
    int id = Sprite_getTextureId(sprite);
    RenderBatch* renderBatch = (RenderBatch*)Map_get(self->renderBatches, &id);
    if (renderBatch == NULL)
    {
        renderBatch = RenderBatch_new(RENDERBATCH_INITIAL_SIZE, TRUE);
        Map_set(self->renderBatches, _allocInt(id), renderBatch);
    }
    Drawable_addRenderData(drawable, renderBatch, positionX, positionY);
}