mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2024-12-04 19:23:28 +01:00
update to entt master (v3.6.0-pre)
This commit is contained in:
parent
840b663d5e
commit
7cf434d877
2
external/entt
vendored
2
external/entt
vendored
@ -1 +1 @@
|
||||
Subproject commit 3a3a2c270273c8b45294f9f6135081fdb1628574
|
||||
Subproject commit 820d52428f3b3cb1a49652cbccf3c742fb960538
|
@ -4,7 +4,6 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include <entt/entt.hpp>
|
||||
#include <imgui.h>
|
||||
@ -70,7 +69,8 @@ template <class EntityType>
|
||||
class EntityEditor {
|
||||
public:
|
||||
using Registry = entt::basic_registry<EntityType>;
|
||||
using ComponentTypeID = ENTT_ID_TYPE;
|
||||
//using ComponentTypeID = ENTT_ID_TYPE;
|
||||
using ComponentTypeID = entt::id_type;
|
||||
|
||||
struct ComponentInfo {
|
||||
using Callback = std::function<void(Registry&, EntityType)>;
|
||||
@ -93,7 +93,8 @@ public:
|
||||
template <class Component>
|
||||
ComponentInfo& registerComponent(const ComponentInfo& component_info)
|
||||
{
|
||||
auto index = entt::type_info<Component>::id();
|
||||
//auto index = entt::type_info<Component>::id();
|
||||
auto index = entt::type_hash<Component>::value();
|
||||
[[maybe_unused]] auto [it, insert_result] = component_infos.insert_or_assign(index, component_info);
|
||||
MM_IEEE_ASSERT(insert_result);
|
||||
return std::get<ComponentInfo>(*it);
|
||||
@ -234,7 +235,7 @@ public:
|
||||
});
|
||||
} else {
|
||||
auto view = registry.runtime_view(comp_list.begin(), comp_list.end());
|
||||
ImGui::Text("%lu Entities Matching:", view.size());
|
||||
ImGui::Text("%lu Entities Matching:", view.size_hint());
|
||||
|
||||
if (ImGui::BeginChild("entity list")) {
|
||||
for (auto e : view) {
|
||||
|
@ -30,6 +30,7 @@ void TextureResourceManagerList(void) {
|
||||
}
|
||||
|
||||
void TextureResourceManagerLoader(MM::Engine& engine) {
|
||||
using namespace entt::literals;
|
||||
auto& rm = MM::ResourceManager<MM::OpenGL::Texture>::ref();
|
||||
static MM::OpenGL::Texture::handle texture = rm.get("default"_hs);
|
||||
|
||||
|
@ -79,7 +79,7 @@ void SimpleRect::render(Services::OpenGLRenderer& rs, Engine& engine) {
|
||||
auto view = scene.view<MM::Components::Transform2D>();
|
||||
|
||||
for (auto& e : view) {
|
||||
auto& t = view.get(e);
|
||||
auto& t = view.get<Components::Transform2D>(e);
|
||||
|
||||
_shader->setUniformMat4f("_WVP", vp * t.getTransform4(t.position.y/10.f + 500.f));
|
||||
|
||||
|
@ -111,6 +111,7 @@ bool OpenGLRenderer::enable(Engine& engine) {
|
||||
}
|
||||
|
||||
{ // default texures
|
||||
using namespace entt::literals;
|
||||
auto& rm_t = MM::ResourceManager<MM::OpenGL::Texture>::ref();
|
||||
if (!rm_t.contains("default"_hs)) {
|
||||
if (!rm_t.load<MM::OpenGL::TextureLoaderConstBuffer>("default", default_png, default_png_len)) {
|
||||
|
@ -108,6 +108,8 @@ class ResourceManager {
|
||||
}
|
||||
|
||||
handle_type get(const res_id_type id) const {
|
||||
using namespace entt::literals;
|
||||
|
||||
auto it = _storage.find(id);
|
||||
if (it == _storage.end()) {
|
||||
if (id != "default"_hs) {
|
||||
|
@ -210,6 +210,7 @@ bool Tilemap::parseTiled_Layers(MM::Engine& engine, MM::Scene& scene, nlohmann::
|
||||
}
|
||||
|
||||
bool Tilemap::parseTiled_Tileset(MM::Engine& engine, std::string_view src_path, nlohmann::json& jts, uint32_t first_g_id) {
|
||||
using namespace entt::literals;
|
||||
auto& fs = engine.getService<MM::Services::FilesystemService>();
|
||||
auto& rm_t = MM::ResourceManager<MM::OpenGL::Texture>::ref();
|
||||
|
||||
|
@ -24,6 +24,7 @@ namespace MM::Screens {
|
||||
|
||||
void create_mm_logo(MM::Engine& engine, MM::Services::ScreenDirector::Screen& screen,
|
||||
const std::string next_screen, float anim_duration, float screen_duration) {
|
||||
using namespace entt::literals;
|
||||
|
||||
screen.start_enable.push_back(engine.type<MM::Services::OpenGLRenderer>());
|
||||
screen.start_enable.push_back(engine.type<MM::Services::SimpleSceneService>());
|
||||
|
Loading…
Reference in New Issue
Block a user