37 lines
854 B
C
37 lines
854 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "dusk.h"
|
|
|
|
typedef enum {
|
|
DIRECTION_SOUTH = 0,
|
|
DIRECTION_EAST = 1,
|
|
DIRECTION_WEST = 2,
|
|
DIRECTION_NORTH = 3,
|
|
|
|
DIRECTION_UP = DIRECTION_NORTH,
|
|
DIRECTION_DOWN = DIRECTION_SOUTH,
|
|
DIRECTION_LEFT = DIRECTION_WEST,
|
|
DIRECTION_RIGHT = DIRECTION_EAST,
|
|
} direction_t;
|
|
|
|
/**
|
|
* Converts a direction to an angle in float_t format.
|
|
*
|
|
* @param dir The direction to convert.
|
|
* @return The angle corresponding to the direction.
|
|
*/
|
|
float_t directionToAngle(const direction_t dir);
|
|
|
|
/**
|
|
* Converts a direction to a vec2 unit vector.
|
|
*
|
|
* @param dir The direction to convert.
|
|
* @param out Pointer to the vec2 array to populate.
|
|
*/
|
|
void directionGetVec2(const direction_t dir, vec2 out); |