2025-10-04 21:58:14 +01:00
|
|
|
#if !defined(LD_GAME_PLAYER_H_)
|
|
|
|
|
#define LD_GAME_PLAYER_H_
|
|
|
|
|
|
|
|
|
|
#include "../core/types.h"
|
2025-10-04 15:53:55 +01:00
|
|
|
#include "../core/macros.h"
|
|
|
|
|
|
2025-10-04 21:58:14 +01:00
|
|
|
#include <SDL3/SDL_events.h>
|
|
|
|
|
|
2025-10-05 18:05:01 +01:00
|
|
|
#define PLAYER_SPEED 10.0f
|
2025-10-05 21:05:29 +01:00
|
|
|
#define PLAYER_RELOAD_TIME 1.5f
|
|
|
|
|
#define PLAYER_BULLET_COUNT 6
|
2025-10-05 18:05:01 +01:00
|
|
|
|
|
|
|
|
typedef struct ControlState ControlState;
|
|
|
|
|
struct ControlState {
|
|
|
|
|
bool rightDown;
|
|
|
|
|
bool leftDown;
|
|
|
|
|
bool upDown;
|
|
|
|
|
bool downDown;
|
2025-10-05 21:05:29 +01:00
|
|
|
bool shot;
|
2025-10-05 18:05:01 +01:00
|
|
|
};
|
|
|
|
|
|
2025-10-04 15:53:55 +01:00
|
|
|
typedef struct Player Player;
|
|
|
|
|
struct Player
|
|
|
|
|
{
|
|
|
|
|
V2f pos;
|
2025-10-04 17:36:47 +01:00
|
|
|
U32 bulletsLoaded;
|
2025-10-05 18:05:01 +01:00
|
|
|
ControlState controls;
|
2025-10-05 21:05:29 +01:00
|
|
|
V2f shotPos;
|
|
|
|
|
|
|
|
|
|
F32 reloadTimer;
|
2025-10-04 15:53:55 +01:00
|
|
|
};
|
|
|
|
|
|
2025-10-05 18:05:01 +01:00
|
|
|
function void PlayerInput(SDL_Event *event, Player *player);
|
|
|
|
|
function void PlayerUpdate(F32 delta, Player *player);
|
2025-10-04 21:58:14 +01:00
|
|
|
|
|
|
|
|
#endif // LD_GAME_PLAYER_H_
|