diff options
author | Simponic <loganthebean222@gmail.com> | 2020-08-08 18:16:34 -0600 |
---|---|---|
committer | Simponic <loganthebean222@gmail.com> | 2020-08-08 18:16:34 -0600 |
commit | 7f856467a086ec9a3ebd1ccdf12e578dffb9c98b (patch) | |
tree | 191714e3ef0daf90d5252532dd0db3f4f0256de5 /include/velocity.h | |
parent | 6a44a34e0ebb867753df26f1cb0a38f53420a606 (diff) | |
download | geometry-dash-gba-7f856467a086ec9a3ebd1ccdf12e578dffb9c98b.tar.gz geometry-dash-gba-7f856467a086ec9a3ebd1ccdf12e578dffb9c98b.zip |
Player added
Diffstat (limited to 'include/velocity.h')
-rw-r--r-- | include/velocity.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/velocity.h b/include/velocity.h new file mode 100644 index 0000000..278226c --- /dev/null +++ b/include/velocity.h @@ -0,0 +1,35 @@ +#include "types.h" +#include "fixed.h" +#include "point.h" + +#ifndef VELOCITY_H +#define VELOCITY_H + +typedef struct VELOCITY { + FIXED dx; + FIXED dy; +} ALIGN(4) VELOCITY; + +static inline VELOCITY createVelocity (FIXED dx, FIXED dy) { + // Create velocity from data + VELOCITY temp; + temp.dx = dx; + temp.dy = dy; + return temp; +} + +static inline VELOCITY addVelocities (VELOCITY *a, VELOCITY *b) { + // Add two velocities + VELOCITY temp; + temp.dx = a->dx + b->dx; + temp.dy = a->dy + b->dy; + return temp; +} + +static inline void updatePoint (POINT *pt, VELOCITY *vel) { + // Update a point with a velocity + pt->x += vel->dx; + pt->y += vel->dy; +} + +#endif // VELOCITY_H |