blob: 278226c0ef7c24f14d42a2974d15e0b23d00867d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
|