]> git.itanic.dy.fi Git - sdl-planets/blob - planet.h
quadtree: Add a tree validator
[sdl-planets] / planet.h
1 #ifndef _PLANET_H
2 #define _PLANET_H
3
4 #include <SDL.h>
5
6 #include "vector.h"
7 #include "list.h"
8 #include "utils.h"
9 #include "camera.h"
10
11 struct planet {
12         struct vector speed;
13         struct vector pos;
14         struct list_head list;
15         double mass;
16         float radius;
17         unsigned char r, g, b;
18 };
19
20 #define list_to_planet(list_head) container_of((list_head), struct planet, list)
21
22 void init_planet(struct planet *p);
23 void create_planets(struct planet *p, int num, double total_mass,
24                     double radius);
25 void draw_planet(SDL_Surface *screen, struct planet *p, const struct camera *);
26 int gravitize_planets(struct planet *a, struct planet *b, const double time);
27 struct planet *merge_planets(struct planet *a, struct planet *b);
28 void move_planet(struct planet *p, const double time);
29 void print_planet(const struct planet *p);
30
31 #endif