add first fe_renderlist function
This commit is contained in:
parent
3c66554835
commit
51d65485ac
|
@ -0,0 +1,36 @@
|
|||
#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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue