diff options
| author | Schark <jordan@schark.online> | 2026-09-23 23:09:55 -0400 |
|---|---|---|
| committer | Schark <jordan@schark.online> | 2026-09-23 23:09:55 -0400 |
| commit | dab65412376d1b73381446f969c1461c24169811 (patch) | |
| tree | 27adfec438a9bd9f3c96a740ab54016df5f68b80 /platformer/src/physics.h | |
| parent | af03f388cbcff795158ea8345b5c876470229e8b (diff) | |
| download | gamedev-dab65412376d1b73381446f969c1461c24169811.tar.gz gamedev-dab65412376d1b73381446f969c1461c24169811.zip | |
Base prompts
Diffstat (limited to '')
| -rw-r--r-- | platformer/src/physics.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/platformer/src/physics.h b/platformer/src/physics.h new file mode 100644 index 0000000..dfbfebb --- /dev/null +++ b/platformer/src/physics.h @@ -0,0 +1,36 @@ +/* + * ============================================================ + * FILE: physics.h + * + * PURPOSE: Public interface for generic physical motion: a `Body` that + * falls, moves and lands on the ground. It knows nothing about + * players or controllers, so enemies and objects can reuse it later. + * + * FITS IN: player.c owns a Body, sets its horizontal velocity from input, + * then calls physics_step() once per tick. physics.c asks world.h + * about the ground and the bounds. + * + * INTERFACE: Use these exact names: + * + * typedef struct Body { + * Vec3 pos; position of the body's FEET (bottom center), meters + * Vec3 vel; velocity, meters/second + * bool on_ground; true if the body ended the last step standing on ground + * } Body; + * + * void physics_step(Body *b, float dt); + * + * Include <stdbool.h> and "math3d.h". + * + * CONVENTIONS: Include guard: PHYSICS_H. + * + * NOT IN SCOPE: Rigid bodies, rotation, mass, forces/impulses API, collision + * between bodies. + * + * DONE WHEN: player.c can move and land using only Body + physics_step. + * ============================================================ + */ +#ifndef PHYSICS_H +#define PHYSICS_H + +#endif /* PHYSICS_H */ |
