36 lines
714 B
C
36 lines
714 B
C
#include <fxengine/renderlist.h>
|
|
#include <fxengine/model/object.h>
|
|
#include <gint/std/stdlib.h>
|
|
|
|
static fe_object ** list = 0;
|
|
static int list_size = 0;
|
|
|
|
int fe_renderlist_add(fe_object * const object)
|
|
{
|
|
if (object==0)
|
|
return -1;
|
|
for (int i=0; i<list_size; i++)
|
|
if (list[i]==object)
|
|
return -1;
|
|
for (int i=0; i<list_size; i++)
|
|
{
|
|
if (list[i]==0)
|
|
{
|
|
list[i]=object;
|
|
return i;
|
|
}
|
|
}
|
|
|
|
if (list==0)
|
|
{
|
|
list_size++;
|
|
list=malloc(sizeof(int));
|
|
list[0]=object;
|
|
}
|
|
else
|
|
{
|
|
list_size++;
|
|
list=realloc(list, list_size*sizeof(int));
|
|
list[list_size-1]=object;
|
|
}
|
|
} |