Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs3-19sp
project04
Commits
a3efc42a
Commit
a3efc42a
authored
5 years ago
by
Mei-Ling M. Laures
Browse files
Options
Download
Email Patches
Plain Diff
Rename force_creator_t to force_applier_t, expand on explanation of force applier.
parent
bc62812a
master
No related merge requests found
Pipeline
#34349
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/scene.h
+10
-6
include/scene.h
with
10 additions
and
6 deletions
+10
-6
include/scene.h
View file @
a3efc42a
...
...
@@ -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_
creato
r_t
)(
void
*
aux
);
typedef
void
(
*
force_
applie
r_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_
creato
r
(
scene_t
*
scene
,
force_
creato
r_t
forcer
,
void
*
aux
,
void
scene_add_force_
applie
r
(
scene_t
*
scene
,
force_
applie
r_t
forcer
,
void
*
aux
,
free_func_t
freer
);
/**
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help