My ECE 2035 final project
Dependencies: 4DGL-uLCD-SE mbed wave_player
Fork of MazeRunner_Fall2017-shell by
physics.h@2:c18c231cb299, 2017-11-08 (annotated)
- Committer:
- rconnorlawson
- Date:
- Wed Nov 08 21:01:43 2017 +0000
- Revision:
- 2:c18c231cb299
- Parent:
- 0:cf4396614a79
- Child:
- 1:2c6ae0fe9a2a
Fix delta computation in physics update.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rconnorlawson | 0:cf4396614a79 | 1 | #pragma once |
rconnorlawson | 0:cf4396614a79 | 2 | |
rconnorlawson | 0:cf4396614a79 | 3 | /** |
rconnorlawson | 0:cf4396614a79 | 4 | * The main state structure for the game. |
rconnorlawson | 0:cf4396614a79 | 5 | * This structure holds all the global state for the game, and is updated during |
rconnorlawson | 0:cf4396614a79 | 6 | * the game loop. When you implement the "jump back" feature, this is the |
rconnorlawson | 0:cf4396614a79 | 7 | * structure you need to save/restore. |
rconnorlawson | 0:cf4396614a79 | 8 | */ |
rconnorlawson | 0:cf4396614a79 | 9 | struct Physics { |
rconnorlawson | 0:cf4396614a79 | 10 | float px, py; // Ball position |
rconnorlawson | 0:cf4396614a79 | 11 | float vx, vy; // Ball velocity |
rconnorlawson | 0:cf4396614a79 | 12 | float ax, ay; // Ball acceleration |
rconnorlawson | 0:cf4396614a79 | 13 | }; |
rconnorlawson | 0:cf4396614a79 | 14 | |
rconnorlawson | 0:cf4396614a79 | 15 | /** |
rconnorlawson | 0:cf4396614a79 | 16 | * Performs one step of Forward Euler integration, given a time step delta. |
rconnorlawson | 0:cf4396614a79 | 17 | * |
rconnorlawson | 0:cf4396614a79 | 18 | * @param[out] out The structure to store the result of the integration. |
rconnorlawson | 0:cf4396614a79 | 19 | * @param[in] in The current state of the system. |
rconnorlawson | 0:cf4396614a79 | 20 | * @param[in] delta The time step, in seconds.s |
rconnorlawson | 0:cf4396614a79 | 21 | */ |
rconnorlawson | 0:cf4396614a79 | 22 | void forward_euler(Physics* state, float delta); |