2d-platformer/include/utility.h

61 lines
999 B
C++

#pragma once
#include <array>
#include <cstdint>
#include <string_view>
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using s8 = int8_t;
using s16 = int16_t;
using s32 = int32_t;
using s64 = int64_t;
using EntityIndex = u16;
enum EntityTag : u8
{
player,
tile,
enemy,
tagCount
};
namespace util
{
using namespace std::string_view_literals;
inline constexpr EntityIndex MAX_PLAYERS{1u};
inline constexpr EntityIndex MAX_TILES {1'000u};
inline constexpr EntityIndex MAX_ENEMIES {1'000u};
inline constexpr EntityIndex MAX_ENTITIES {MAX_PLAYERS + MAX_TILES + MAX_ENEMIES};
// used for imgui
inline constexpr std::array<const char*, tagCount> tagStringsC =
{
"player",
"tile",
"enemy"
};
inline constexpr std::array<std::string_view, tagCount> tagStrings =
{
"player"sv,
"tile"sv,
"enemy"sv
};
inline constexpr std::array<EntityIndex, tagCount> tagStart =
{
0,//player
1,//tile start
MAX_TILES,//enemy start
};
}