libgravix2  0.1.0
A fast simulation of attractive forces acting on point-like particles embedded onto the surface of a sphere.
game.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include "libgravix2/api.h"
35 #include <stdint.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 struct GrvxGame;
42 
49 typedef struct GrvxGame *GrvxGameHandle;
50 
62  double t_start;
63 
70  double dt_ping;
71 
78  double dt_end;
79 
86  double v;
87 
93  double psi;
94 };
95 
110  uint32_t planet_id;
111 
117  double t;
118 
124  double lat;
125 
131  double lon;
132 };
133 
163 GRVX_EXPORT int32_t grvx_rnd_init_planets(GrvxPlanetsHandle planets,
164  uint32_t *seed,
165  double min_dist);
166 
178 GRVX_EXPORT GrvxGameHandle grvx_init_game(GrvxPlanetsHandle planets);
179 
189 GRVX_EXPORT void grvx_delete_game(GrvxGameHandle handle);
190 
209 GRVX_EXPORT int32_t grvx_request_launch(GrvxGameHandle game,
210  uint32_t planet_id,
211  struct GrvxMissileLaunch *missile,
212  double dt);
213 
234 GRVX_EXPORT struct GrvxMissileObservation *
236 
237 #ifdef __cplusplus
238 } // extern "C"
239 #endif
240  // end of group game
API of libgravix2.
GRVX_EXPORT void grvx_delete_game(GrvxGameHandle handle)
Deletes a game instance.
Definition: game.c:139
GRVX_EXPORT GrvxGameHandle grvx_init_game(GrvxPlanetsHandle planets)
Initializes a new game from a set of planets.
Definition: game.c:125
GRVX_EXPORT struct GrvxMissileObservation * grvx_observe_or_tick(GrvxGameHandle game, uint32_t *t)
Returns a new observation or advances time.
GRVX_EXPORT int32_t grvx_request_launch(GrvxGameHandle game, uint32_t planet_id, struct GrvxMissileLaunch *missile, double dt)
Requests a missile launch.
struct GrvxGame * GrvxGameHandle
Handle to a game.
Definition: game.h:49
GRVX_EXPORT int32_t grvx_rnd_init_planets(GrvxPlanetsHandle planets, uint32_t *seed, double min_dist)
Initializes planets randomly.
Definition: game.c:116
Settings of a scheduled missile launch.
Definition: game.h:56
double dt_end
Self-destruction.
Definition: game.h:78
double dt_ping
Ping.
Definition: game.h:70
double v
Initial velocity.
Definition: game.h:86
double t_start
Launch.
Definition: game.h:62
double psi
Initial orientation.
Definition: game.h:93
Observation of a missile.
Definition: game.h:103
double lon
Longitude.
Definition: game.h:131
double lat
Latitude.
Definition: game.h:124
uint32_t planet_id
Planet ID if a planet was hit.
Definition: game.h:110
double t
Tick of observation.
Definition: game.h:117
Set of planets.
Definition: planet.h:20