#ifndef _PLANET_H #define _PLANET_H #include #include "vector.h" #include "list.h" #include "utils.h" #include "camera.h" #include "quadtree.h" struct planet { struct vector speed; struct vector pos; struct list_head list; struct quadtree tree; double mass; float radius; unsigned char r, g, b; }; #define list_to_planet(list_head) container_of((list_head), struct planet, list) #define tree_to_planet(qt) container_of((qt), struct planet, tree) void init_planet(struct planet *p); void create_planets(struct planet *p, int num, double total_mass, double radius); void draw_planet(SDL_Surface *screen, struct planet *p, const struct camera *); int gravitize_planets(struct planet *a, struct planet *b, const double time); struct planet *merge_planets(struct planet *a, struct planet *b); struct planet *move_planet(struct planet *p, const double time); void print_planet(const struct planet *p); int planet_spatial_compare(struct quadtree *a, struct quadtree *b); #endif