Commit a3efc42a authored by Mei-Ling M. Laures's avatar Mei-Ling M. Laures
Browse files

Rename force_creator_t to force_applier_t, expand on explanation of force applier.

parent bc62812a
No related merge requests found
Pipeline #34349 canceled with stage
Showing with 10 additions and 6 deletions
+10 -6
......@@ -14,9 +14,12 @@ typedef struct scene scene_t;
/**
* A function which adds some forces or impulses to bodies,
* e.g. from collisions, gravity, or spring forces.
* Takes in an auxiliary value that can store parameters or state.
* The force will be applied by the scene at every tick to associated bodies.
*
* Parameter is an auxiliary value that can store parameters or state needed
* in function.
*/
typedef void (*force_creator_t)(void *aux);
typedef void (*force_applier_t)(void *aux);
/**
* Allocates memory for an empty scene.
......@@ -71,16 +74,17 @@ void scene_add_body(scene_t *scene, body_t *body);
void scene_remove_body(scene_t *scene, size_t index);
/**
* Adds a force creator to a scene,
* to be invoked every time scene_tick() is called.
* The auxiliary value is passed to the force creator each time it is called.
* Adds a force applier (which is invoked every time scene_tick() is called)
* to a scene.
* The auxiliary value passed into this function will be used by the force
* applier each time it is called.
*
* @param scene a pointer to a scene returned from scene_init()
* @param forcer a force creator function
* @param aux an auxiliary value to pass to forcer when it is called
* @param freer if non-NULL, a function to call in order to free aux
*/
void scene_add_force_creator(scene_t *scene, force_creator_t forcer, void *aux,
void scene_add_force_applier(scene_t *scene, force_applier_t forcer, void *aux,
free_func_t freer);
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment