naev 0.11.5
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
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;
52 double speed_max;
53 void (*update)( struct Solid_*, double );
54} Solid;
55
56/*
57 * solid manipulation
58 */
59double solid_maxspeed( const Solid *s, double speed, double accel );
60void solid_init( Solid* dest, double mass, double dir,
61 const vec2* pos, const vec2* vel, int update );
62
63/*
64 * misc
65 */
66double 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:52
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:32