Struct entt_traits< std::uint32_t >

Synopsis

#include <src/entt/entity/entity.hpp>

template<>
struct entt_traits<std::uint32_t>

Description

Entity traits for a 32 bits entity identifier.

A 32 bits entity identifier guarantees:

  • 20 bits for the entity number (suitable for almost all the games).
  • 12 bit for the version (resets in [0-4095]).

Source

Lines 42-57 in src/entt/entity/entity.hpp.

template<>
struct entt_traits<std::uint32_t> {
    /*! @brief Underlying entity type. */
    using entity_type = std::uint32_t;
    /*! @brief Underlying version type. */
    using version_type = std::uint16_t;
    /*! @brief Difference type. */
    using difference_type = std::int64_t;

    /*! @brief Mask to use to get the entity number out of an identifier. */
    static constexpr entity_type entity_mask = 0xFFFFF;
    /*! @brief Mask to use to get the version out of an identifier. */
    static constexpr entity_type version_mask = 0xFFF;
    /*! @brief Extent of the entity number within an identifier. */
    static constexpr std::size_t entity_shift = 20u;
};





Add Discussion

Log in to comment