![EnTT: Gaming meets modern C++](https://user-images.githubusercontent.com/1812216/103550016-90752280-4ea8-11eb-8667-12ed2219e137.png)
<!--
@cond TURN_OFF_DOXYGEN
-->
[![Build Status](https://github.com/skypjack/entt/workflows/build/badge.svg)](https://github.com/skypjack/entt/actions)
[![Coverage](https://codecov.io/gh/skypjack/entt/branch/master/graph/badge.svg)](https://codecov.io/gh/skypjack/entt)
[![Try online](https://img.shields.io/badge/try-online-brightgreen)](https://godbolt.org/z/zxW73f)
[![Documentation](https://img.shields.io/badge/docs-doxygen-blue)](https://skypjack.github.io/entt/)
[![Vcpkg port](https://img.shields.io/vcpkg/v/entt)](https://vcpkg.link/ports/entt)
[![Conan Center](https://img.shields.io/conan/v/entt)](https://conan.io/center/recipes/entt)
[![Gitter chat](https://badges.gitter.im/skypjack/entt.png)](https://gitter.im/skypjack/entt)
[![Discord channel](https://img.shields.io/discord/707607951396962417?logo=discord)](https://discord.gg/5BjPWBd)
> `EnTT` has been a dream so far, we haven't found a single bug to date and it's
> super easy to work with
>
> -- Every EnTT User Ever
`EnTT` is a header-only, tiny and easy to use library for game programming and
much more written in **modern C++**.<br/>
[Among others](https://github.com/skypjack/entt/wiki/EnTT-in-Action), it's used
in [**Minecraft**](https://minecraft.net/en-us/attribution/) by Mojang, the
[**ArcGIS Runtime SDKs**](https://developers.arcgis.com/arcgis-runtime/) by Esri
and the amazing [**Ragdoll**](https://ragdolldynamics.com/).<br/>
If you don't see your project in the list, please open an issue, submit a PR or
add the [#entt](https://github.com/topics/entt) tag to your _topics_! :+1:
---
Do you want to **keep up with changes** or do you have a **question** that
doesn't require you to open an issue?<br/>
Join the [gitter channel](https://gitter.im/skypjack/entt) and the
[discord server](https://discord.gg/5BjPWBd), meet other users like you. The
more we are, the better for everyone.<br/>
Don't forget to check the
[FAQs](https://github.com/skypjack/entt/wiki/Frequently-Asked-Questions) and the
[wiki](https://github.com/skypjack/entt/wiki) too. Your answers may already be
there.
Do you want to support `EnTT`? Consider becoming a
[**sponsor**](https://github.com/users/skypjack/sponsorship) or making a
donation via [**PayPal**](https://www.paypal.me/skypjack).<br/>
Many thanks to [these people](https://skypjack.github.io/sponsorship/) and
**special** thanks to:
[![mojang](https://user-images.githubusercontent.com/1812216/106253145-67ca1980-6217-11eb-9c0b-d93561b37098.png)](https://mojang.com)
[![imgly](https://user-images.githubusercontent.com/1812216/106253726-271ed000-6218-11eb-98e0-c9c681925770.png)](https://img.ly/)
# Table of Contents
* [Introduction](#introduction)
* [Code Example](#code-example)
* [Motivation](#motivation)
* [Benchmark](#benchmark)
* [Integration](#integration)
* [Requirements](#requirements)
* [CMake](#cmake)
* [Natvis support](#natvis-support)
* [Packaging Tools](#packaging-tools)
* [pkg-config](#pkg-config)
* [Documentation](#documentation)
* [Tests](#tests)
* [EnTT in Action](#entt-in-action)
* [Contributors](#contributors)
* [License](#license)
<!--
@endcond TURN_OFF_DOXYGEN
-->
# Introduction
The entity-component-system (also known as _ECS_) is an architectural pattern
used mostly in game development. For further details:
* [Entity Systems Wiki](http://entity-systems.wikidot.com/)
* [Evolve Your Hierarchy](http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/)
* [ECS on Wikipedia](https://en.wikipedia.org/wiki/Entity%E2%80%93component%E2%80%93system)
This project started off as a pure entity-component system. Over time the
codebase has grown as more and more classes and functionalities were added.<br/>
Here is a brief, yet incomplete list of what it offers today:
* Built-in **RTTI system** mostly similar to the standard one.
* A `constexpr` utility for human-readable **resource names**.
* Minimal **configuration system** built using the monostate pattern.
* Incredibly fast **entity-component system** with its own _pay for what you
use_ policy, unconstrained component types with optional pointer stability and
hooks for storage customization.
* Views and groups to iterate entities and components and allow different access
patterns, from **perfect SoA** to fully random.
* A lot of **facilities** built on top of the entity-component system to help
the users and avoid reinventing the wheel.
* General purpose **execution graph builder** for optimal scheduling.
* The smallest and most basic implementation of a **service locator** ever seen.
* A built-in, non-intrusive and macro-free runtime **reflection system**.
* **Static polymorphism** made simple and within everyone's reach.
* A few homemade containers, like a sparse set based **hash map**.
* A **cooperative scheduler** for processes of any type.
* All that is needed for **resource management** (cache, loaders, handles).
* Delegates, **signal handlers** and a tiny event dispatcher.
* A general purpose **event emitter** as a CRTP idiom based class template.
* And **much more**! Check out the
[**wiki**](https://github.com/skypjack/entt/wiki).
Consider this list a work in progress as well as the project. The whole API is
fully documented in-code for those who are brave enough to read it.<br/>
Please, do note that all tools are also DLL-friendly now and run smoothly across
boundaries.
One thing known to most is that `EnTT` is also used in **Minecraft**.<br/>
Given that the game is available literally everywhere, I can confidently say
that the library has been sufficiently tested on every platform that can come to
mind.
## Code Example
```cpp
#include <entt/entt.hpp>
struct position {
float x;
float y;
};
struct velocity {
float dx;
float dy;
};
void update(entt::registry ®istry) {
auto view = registry.view<const position, velocity>();
// use a callback
view.each([](const auto &pos, auto &vel) { /* ... */ });
// use an extended callback
view.each([](const auto entity, const auto &pos, auto &vel) { /* ... */ });
// use a range-for
for(auto [entity, pos, vel]: view.each()) {
// ...
}
// use forward iterators and get only the components of interest
for(auto entity: view) {
auto &vel = view.get<velocity>(entity);
// ...
}
}
int main() {
entt::registry registry;
for(auto i = 0u; i < 10u; ++i) {
const auto entity = registry.create();
registry.emplace<position>(entity, i * 1.f, i * 1.f);
if(i % 2 == 0) { registry.emplace<velocity>(entity, i * .1f, i * .1f); }
}
update(registry);
}
```
## Motivation
I started developing `EnTT` for the _wrong_ reason: my goal was to design an
entity-component system to beat another well known open source library both in
terms of performance and possibly memory usage.<br/>
In the end, I did it, but it wasn't very satisfying. Actually it wasn't
satisfying at all. The fastest and nothing more, fairly little indeed. When I
realized it, I tried hard to keep intact the great performance of `EnTT` and to
add all the features I wanted to see in *my own library* at the same time.
Nowadays, `EnTT` is finally what I was looking for: still faster than its
_competitors_, lower memory usage in the average case, a really good API and an
amazing set of features. And even more, of course.
## Benchmark
For what it's worth, you'll **never** see me trying to make other projects look
bad or offer dubious comparisons just to make this library seem cooler.<br/>
I leave this activity to others, if they enjoy it (and it seems that some people
actually like it). I prefer to make better use of my time.
If you are interested, you can compile the `benchmark` test in release mode (to
enable compiler optimizations, otherwise it would make little sense) by setting
the `ENTT_BUILD_BENCHMARK` option of `CMak
没有合适的资源?快使用搜索试试~ 我知道了~
EnTT,快速可靠的实体组件系统 (ECS)
共272个文件
cpp:94个
hpp:75个
h:22个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 184 浏览量
2024-02-06
22:53:03
上传
评论
收藏 955KB ZIP 举报
温馨提示
EnTT 是一个仅标头、小巧且易于使用的库,用于游戏编程以及更多用现代 C++ 编写的库。其中,它被用于 Mojang 的 Minecraft、Esri 的 ArcGIS Runtime SDK 和令人惊叹的 Ragdoll。实体组件系统(也称为 ECS)是一种主要用于游戏开发的架构模式。这个项目最初是一个纯粹的实体组件系统。随着时间的流逝,随着越来越多的类和功能的添加,代码库也在增长。静态生成的类型的整数标识符(在编译时或运行时分配)。用于人类可读资源名称的 constexpr 实用程序。一个基于稀疏集的令人难以置信的快速实体组件系统,它有自己的付费策略,可根据用户的要求调整性能和内存使用量。提供使用单态模式构建的最小配置系统。 特征 用于迭代实体和组件的视图和分组,并允许不同的访问模式,从完美的 SoA 到完全随机 许多设施建立在实体组件系统之上,以帮助用户并避免重新发明轮子 有史以来最小、最基本的服务定位器实现内置、非侵入式、无宏的运行时反射系统 静态多态性变得简单,触手可及适用于任何类型的进程的协作调度程序
资源推荐
资源详情
资源评论
收起资源包目录
EnTT,快速可靠的实体组件系统 (ECS) (272个子文件)
AUTHORS 503B
BUILD.bazel 648B
BUILD.bazel 648B
MODULE.bazel 271B
BUILD.bazel 255B
BUILD.bazel 229B
MODULE.bazel 186B
BUILD.bazel 110B
WORKSPACE.bazel 20B
WORKSPACE.bazel 19B
BUILD.bazel 0B
BUILD.bazel 0B
.bazelignore 5B
.bazeliskrc 22B
.bazelrc 472B
.bazelrc 32B
copts.bzl 397B
.clang-format 1KB
.clang-tidy 955B
JoinPaths.cmake 815B
sparse_set.cpp 73KB
registry.cpp 72KB
storage.cpp 65KB
group.cpp 56KB
view.cpp 55KB
any.cpp 44KB
dense_map.cpp 40KB
meta_any.cpp 39KB
benchmark.cpp 36KB
snapshot.cpp 34KB
dense_set.cpp 31KB
meta_type.cpp 25KB
storage_no_instance.cpp 25KB
storage_entity.cpp 24KB
meta_container.cpp 24KB
meta_data.cpp 20KB
sigh_mixin.cpp 20KB
adjacency_matrix.cpp 17KB
meta_func.cpp 17KB
meta_context.cpp 15KB
organizer.cpp 15KB
delegate.cpp 14KB
type_traits.cpp 13KB
resource_cache.cpp 13KB
meta_pointer.cpp 12KB
sigh.cpp 11KB
meta_utility.cpp 11KB
runtime_view.cpp 10KB
poly.cpp 10KB
memory.cpp 10KB
handle.cpp 9KB
observer.cpp 9KB
flow.cpp 8KB
hashed_string.cpp 7KB
snapshot.cpp 6KB
process.cpp 6KB
entity.cpp 6KB
meta_ctor.cpp 6KB
meta_base.cpp 6KB
compressed_pair.cpp 5KB
dispatcher.cpp 5KB
helper.cpp 5KB
scheduler.cpp 5KB
type_info.cpp 4KB
emitter.cpp 4KB
reserved_bits.cpp 4KB
entity_copy.cpp 4KB
resource.cpp 4KB
meta_prop.cpp 3KB
algorithm.cpp 3KB
locator.cpp 3KB
meta_range.cpp 3KB
meta_dtor.cpp 2KB
tuple.cpp 2KB
enum.cpp 2KB
main.cpp 2KB
meta_conv.cpp 2KB
dot.cpp 2KB
meta_template.cpp 2KB
utility.cpp 2KB
meta_handle.cpp 2KB
main.cpp 2KB
main.cpp 2KB
component.cpp 2KB
signal_less.cpp 2KB
custom_identifier.cpp 1KB
storage_utility.cpp 1KB
iterator.cpp 1KB
plugin.cpp 1KB
plugin.cpp 1KB
test_package.cpp 1KB
lib.cpp 981B
ident.cpp 941B
main.cpp 931B
plugin.cpp 901B
main.cpp 843B
main.cpp 728B
lib.cpp 677B
main.cpp 667B
family.cpp 655B
共 272 条
- 1
- 2
- 3
资源评论
新华
- 粉丝: 8537
- 资源: 609
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功