naev
0.11.5
src
physics.h
1
/*
2
* See Licensing and Copyright notice in naev.h
3
*/
4
#pragma once
5
6
#include "vec2.h"
7
8
/*
9
* Update options.
10
*/
11
#define SOLID_UPDATE_RK4 0
12
#define SOLID_UPDATE_EULER 1
14
extern
const
char
_UNIT_TIME[];
15
extern
const
char
_UNIT_PER_TIME[];
16
extern
const
char
_UNIT_DISTANCE[];
17
extern
const
char
_UNIT_SPEED[];
18
extern
const
char
_UNIT_ACCEL[];
19
extern
const
char
_UNIT_ENERGY[];
20
extern
const
char
_UNIT_POWER[];
21
extern
const
char
_UNIT_ANGLE[];
22
extern
const
char
_UNIT_ROTATION[];
23
extern
const
char
_UNIT_MASS[];
24
extern
const
char
_UNIT_CPU[];
25
extern
const
char
_UNIT_UNIT[];
26
extern
const
char
_UNIT_PERCENT[];
27
#define UNIT_TIME _(_UNIT_TIME)
28
#define UNIT_PER_TIME _(_UNIT_PER_TIME)
29
#define UNIT_DISTANCE _(_UNIT_DISTANCE)
30
#define UNIT_SPEED _(_UNIT_SPEED)
31
#define UNIT_ACCEL _(_UNIT_ACCEL)
32
#define UNIT_ENERGY _(_UNIT_ENERGY)
33
#define UNIT_POWER _(_UNIT_POWER)
34
#define UNIT_ANGLE _(_UNIT_ANGLE)
35
#define UNIT_ROTATION _(_UNIT_ROTATION)
36
#define UNIT_MASS _(_UNIT_MASS)
37
#define UNIT_CPU _(_UNIT_CPU)
38
#define UNIT_UNIT _(_UNIT_UNIT)
39
#define UNIT_PERCENT _(_UNIT_PERCENT)
40
44
typedef
struct
Solid_ {
45
double
mass
;
46
double
dir
;
47
double
dir_vel
;
48
vec2
vel
;
49
vec2
pos
;
50
vec2
pre
;
51
double
accel
;
52
double
speed_max
;
53
void (*update)(
struct
Solid_*, double );
54
}
Solid
;
55
56
/*
57
* solid manipulation
58
*/
59
double
solid_maxspeed(
const
Solid
*s,
double
speed,
double
accel );
60
void
solid_init(
Solid
* dest,
double
mass,
double
dir,
61
const
vec2
* pos,
const
vec2
* vel,
int
update );
62
63
/*
64
* misc
65
*/
66
double
angle_diff(
double
ref,
double
a );
Solid
Represents a solid in the game.
Definition
physics.h:44
Solid::dir_vel
double dir_vel
Definition
physics.h:47
Solid::speed_max
double speed_max
Definition
physics.h:52
Solid::vel
vec2 vel
Definition
physics.h:48
Solid::pre
vec2 pre
Definition
physics.h:50
Solid::dir
double dir
Definition
physics.h:46
Solid::mass
double mass
Definition
physics.h:45
Solid::pos
vec2 pos
Definition
physics.h:49
Solid::accel
double accel
Definition
physics.h:51
vec2
Represents a 2d vector.
Definition
vec2.h:32
Generated by
1.12.0