]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - src/client/client_player.h
69c8482fc72dedb6afdf429e9504c01e2968c0ea
[dragonblocks_alpha.git] / src / client / client_player.h
1 #ifndef _CLIENT_PLAYER_H_
2 #define _CLIENT_PLAYER_H_
3
4 #include <pthread.h>
5 #include <dragontype/number.h>
6 #include "client/client.h"
7 #include "client/object.h"
8
9 extern struct ClientPlayer
10 {
11         v3f64 pos;                                      // feet position
12         v3f64 velocity;                         // current velocity
13         aabb3f64 box;                           // axis-aligned bounding box (used for collision), with 0, 0, 0 being the feet position
14         f32 yaw, pitch;                         // look direction
15         f64 eye_height;                         // eye height above feet
16         pthread_rwlock_t rwlock;        // used to protect the above properties
17         bool fly;                                       // can the player fly?
18         bool collision;                         // should the player collide with the floor?
19         Object *obj;                            // 3D mesh object (currently always invisible), not thread safe
20 } client_player;
21
22 void client_player_init();                                              // ClientPlayer singleton constructor
23 void client_player_deinit();                                    // ClientPlayer singleton destructor
24 void client_player_add_to_scene();                              // create mesh object
25 void client_player_jump();                                              // jump if possible
26 v3f64 client_player_get_position();                             // get position (thread-safe)
27 void client_player_set_position(v3f64 pos);             // set position (thread-safe)
28 void client_player_tick(f64 dtime);                             // to be called every frame
29
30 #endif