2020-09-14 00:00:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "core/locommon/input.h"
|
|
|
|
#include "core/locommon/position.h"
|
2020-10-09 00:00:00 +00:00
|
|
|
#include "core/locommon/ticker.h"
|
2020-09-14 00:00:00 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2020-10-09 00:00:00 +00:00
|
|
|
LOPLAYER_CONTROLLER_STATE_NONE,
|
|
|
|
LOPLAYER_CONTROLLER_STATE_WALK_LEFT,
|
|
|
|
LOPLAYER_CONTROLLER_STATE_WALK_RIGHT,
|
|
|
|
LOPLAYER_CONTROLLER_STATE_SPRINT_LEFT,
|
|
|
|
LOPLAYER_CONTROLLER_STATE_SPRINT_RIGHT,
|
|
|
|
LOPLAYER_CONTROLLER_STATE_DODGE_FORWARD,
|
|
|
|
LOPLAYER_CONTROLLER_STATE_DODGE_LEFT,
|
|
|
|
LOPLAYER_CONTROLLER_STATE_DODGE_RIGHT,
|
|
|
|
LOPLAYER_CONTROLLER_STATE_JUMP,
|
|
|
|
LOPLAYER_CONTROLLER_STATE_GUARD,
|
|
|
|
LOPLAYER_CONTROLLER_STATE_SHOOT,
|
|
|
|
} loplayer_controller_state_t;
|
2020-09-14 00:00:00 +00:00
|
|
|
|
|
|
|
typedef struct {
|
2020-10-09 00:00:00 +00:00
|
|
|
const locommon_ticker_t* ticker;
|
2020-09-14 00:00:00 +00:00
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
loplayer_controller_state_t state;
|
|
|
|
locommon_position_t cursor;
|
2020-09-14 00:00:00 +00:00
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
bool jump;
|
|
|
|
bool sprint;
|
|
|
|
uint64_t last_sprint_start;
|
2020-09-14 00:00:00 +00:00
|
|
|
} loplayer_controller_t;
|
|
|
|
|
|
|
|
void
|
|
|
|
loplayer_controller_initialize(
|
2020-10-09 00:00:00 +00:00
|
|
|
loplayer_controller_t* controller,
|
|
|
|
const locommon_ticker_t* ticker
|
2020-09-14 00:00:00 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
void
|
|
|
|
loplayer_controller_deinitialize(
|
|
|
|
loplayer_controller_t* controller
|
|
|
|
);
|
|
|
|
|
|
|
|
void
|
2020-10-09 00:00:00 +00:00
|
|
|
loplayer_controller_handle_input(
|
2020-09-14 00:00:00 +00:00
|
|
|
loplayer_controller_t* controller,
|
2020-10-09 00:00:00 +00:00
|
|
|
const locommon_input_t* input, /* NULLABLE */
|
|
|
|
const locommon_position_t* cursor /* NULLABLE */
|
2020-09-14 00:00:00 +00:00
|
|
|
);
|