naev 0.12.6
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
13
14extern const char _UNIT_TIME[];
15extern const char _UNIT_PER_TIME[];
16extern const char _UNIT_DISTANCE[];
17extern const char _UNIT_SPEED[];
18extern const char _UNIT_ACCEL[];
19extern const char _UNIT_ENERGY[];
20extern const char _UNIT_POWER[];
21extern const char _UNIT_ANGLE[];
22extern const char _UNIT_ROTATION[];
23extern const char _UNIT_MASS[];
24extern const char _UNIT_CPU[];
25extern const char _UNIT_UNIT[];
26extern 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
44typedef struct Solid_ {
45 double mass;
46 double dir;
47 double dir_vel;
51 double accel;
53 double speed_max;
54 void ( *update )( struct Solid_ *, double );
55} Solid;
56
57/*
58 * solid manipulation
59 */
60double solid_maxspeed( const Solid *s, double speed, double accel );
61void solid_init( Solid *dest, double mass, double dir, const vec2 *pos,
62 const vec2 *vel, int update );
63
64/*
65 * misc
66 */
67double angle_clean( double angle );
68double angle_diff( double ref, double a );
Represents a solid in the game.
Definition physics.h:44
double dir_vel
Definition physics.h:47
double speed_max
Definition physics.h:53
void(* update)(struct Solid_ *, double)
Definition physics.h:54
vec2 vel
Definition physics.h:48
vec2 pre
Definition physics.h:50
double dir
Definition physics.h:46
double mass
Definition physics.h:45
vec2 pos
Definition physics.h:49
double accel
Definition physics.h:51
Represents a 2d vector.
Definition vec2.h:45