43 lines
901 B
C
43 lines
901 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "input/input.h"
|
|
|
|
typedef struct entity_s entity_t;
|
|
|
|
typedef struct {
|
|
void *nothing;
|
|
} player_t;
|
|
|
|
typedef struct {
|
|
inputaction_t action;
|
|
entitydir_t direction;
|
|
} playerinputdirmap_t;
|
|
|
|
static const playerinputdirmap_t PLAYER_INPUT_DIR_MAP[] = {
|
|
{ INPUT_ACTION_UP, ENTITY_DIR_NORTH },
|
|
{ INPUT_ACTION_DOWN, ENTITY_DIR_SOUTH },
|
|
{ INPUT_ACTION_LEFT, ENTITY_DIR_WEST },
|
|
{ INPUT_ACTION_RIGHT, ENTITY_DIR_EAST },
|
|
|
|
{ 0xFF, 0xFF }
|
|
};
|
|
|
|
/**
|
|
* Initializes a player entity.
|
|
*
|
|
* @param entity Pointer to the entity structure to initialize.
|
|
*/
|
|
void playerInit(entity_t *entity);
|
|
|
|
/**
|
|
* Handles movement logic for the player entity.
|
|
*
|
|
* @param entity Pointer to the player entity structure.
|
|
*/
|
|
void playerInput(entity_t *entity); |