-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathphysics_backend_api.h
More file actions
81 lines (69 loc) · 1.81 KB
/
Copy pathphysics_backend_api.h
File metadata and controls
81 lines (69 loc) · 1.81 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#pragma once
#include <stdint.h>
#ifdef _WIN32
# ifdef RUNNING_PHYSICS_EXPORTS
# define RG_PHYSICS_API __declspec(dllexport)
# else
# define RG_PHYSICS_API __declspec(dllimport)
# endif
#else
# define RG_PHYSICS_API
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum {
RG_PHYSICS_BODY_COUNT = 12,
};
typedef void* RgHandle;
typedef enum RgResult {
RG_RESULT_OK = 0,
RG_RESULT_INVALID_ARGUMENT = 1,
RG_RESULT_INVALID_STATE = 2,
RG_RESULT_INTERNAL_ERROR = 3,
} RgResult;
typedef enum RgGameMode {
RG_GAME_MODE_CLASSIC_100M = 0,
RG_GAME_MODE_HURDLE_110M = 1,
RG_GAME_MODE_LONG_JUMP_30M = 2,
} RgGameMode;
typedef struct RgCourse {
uint32_t struct_size;
uint32_t game_mode;
} RgCourse;
typedef struct RgBodySample {
float x;
float y;
float angle_degrees;
float velocity_x;
float velocity_y;
} RgBodySample;
typedef struct RgFrame {
uint32_t struct_size;
uint32_t body_count;
RgBodySample bodies[RG_PHYSICS_BODY_COUNT];
float score;
float sim_time;
float view_target_x;
float hurdle_location;
float long_jump_distance;
float long_jump_landing_body_x;
uint32_t active_hurdle_count;
uint8_t failed;
uint8_t jumped;
uint8_t jump_landed;
uint8_t race_finished;
uint8_t left_foot_grounded;
uint8_t right_foot_grounded;
uint8_t long_jump_landing_started;
uint8_t long_jump_exited_sand;
} RgFrame;
RG_PHYSICS_API RgResult rg_create(RgHandle* out_handle);
RG_PHYSICS_API void rg_destroy(RgHandle handle);
RG_PHYSICS_API RgResult rg_reset(RgHandle handle, const RgCourse* course);
RG_PHYSICS_API RgResult rg_step(RgHandle handle, uint8_t action_mask);
RG_PHYSICS_API RgResult rg_read_frame(RgHandle handle, RgFrame* out_frame);
RG_PHYSICS_API const char* rg_last_error(RgHandle handle);
#ifdef __cplusplus
}
#endif