I am using GLib to manage a linked list. I am declaring 2 structs and the placing them in a linked list as follows.
Asteroid asteroid = {0,0,50,50,50}
Asteroid asteroids = {0,0,200,200,50};
GList *asteroidList = NULL;
asteroidList = g_list_append(asteroidList, &asteroid);
asteroidList = g_list_append(asteroidList, &asteroids);
Then i use the following function to traverse the list and calla function that draws the struct to the screen as a circle as follows
void drawAsteroids(){
GList *list = asteroidList;
while(list != NULL){
printf("Asteroids");
GList *next = list->next;
drawAsteroid(list->data);
list = next;
}
}
The drawing function is
void drawAsteroid(void *asteroid){
Asteroid *newAsteroid = (Asteroid *)asteroid;
printf("%d\n", newAsteroid->xPos);
circleRGBA(renderer, newAsteroid->xPos, newAsteroid->yPos, newAsteroid->r, 0, 255, 0, 255);
}
The struct is defined as follows
typedef struct asteroid{
int xSpeed;
int ySpeed;
int xPos;
int yPos;
int r;
}Asteroid;
When i run this code i dont see anything drawn to the screen