mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-12-06 16:46:35 +01:00
Compare commits
4 Commits
negative_b
...
3a885ee250
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a885ee250 | |||
| 00e48f9967 | |||
| c791f4c6a1 | |||
| 7a3823db78 |
2
external/entt
vendored
2
external/entt
vendored
Submodule external/entt updated: fef921132c...344e03ac64
2
external/imgui/CMakeLists.txt
vendored
2
external/imgui/CMakeLists.txt
vendored
@@ -41,7 +41,7 @@ target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
#target_include_directories(imgui PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
|
||||
target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/imgui") # im sad
|
||||
|
||||
target_compile_definitions(imgui PUBLIC IMGUI_DISABLE_OBSOLETE_FUNCTIONS=1)
|
||||
#target_compile_definitions(imgui PUBLIC IMGUI_DISABLE_OBSOLETE_FUNCTIONS=1) # more sad
|
||||
|
||||
if(EMSCRIPTEN)
|
||||
target_compile_options(imgui PUBLIC -sUSE_SDL=2)
|
||||
|
||||
2
external/imgui/imgui
vendored
2
external/imgui/imgui
vendored
Submodule external/imgui/imgui updated: 458a109031...c6e0284ac5
2
external/spdlog
vendored
2
external/spdlog
vendored
Submodule external/spdlog updated: ad0e89cbfb...7e635fca68
@@ -134,10 +134,10 @@ public:
|
||||
e = registry.create();
|
||||
|
||||
// create a copy of an entity component by component
|
||||
for (auto &&curr: registry.storage()) {
|
||||
if (auto &storage = curr.second; storage.contains(old_e)) {
|
||||
for(auto &&curr: registry.storage()) {
|
||||
if(auto &storage = curr.second; storage.contains(old_e)) {
|
||||
// TODO: do something with the return value. returns false on failure.
|
||||
storage.emplace(e, storage.get(old_e));
|
||||
storage.push(e, storage.value(old_e));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,11 +237,11 @@ public:
|
||||
|
||||
if (comp_list.empty()) {
|
||||
ImGui::Text("Orphans:");
|
||||
registry.each([®istry](auto e){
|
||||
for (EntityType e : registry.template storage<EntityType>()) {
|
||||
if (registry.orphan(e)) {
|
||||
MM_IEEE_ENTITY_WIDGET(e, registry, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
entt::runtime_view view{};
|
||||
for (const auto type : comp_list) {
|
||||
@@ -264,17 +264,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
[[deprecated("Use renderEditor() instead. And manage the window yourself.")]]
|
||||
void render(Registry& registry, EntityType& e)
|
||||
{
|
||||
if (show_window) {
|
||||
if (ImGui::Begin("Entity Editor", &show_window)) {
|
||||
renderEditor(registry, e);
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
||||
// displays both, editor and list
|
||||
// uses static internally, use only as a quick way to get going!
|
||||
void renderSimpleCombo(Registry& registry, EntityType& e)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <imgui.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <imgui/misc/cpp/imgui_stdlib.h>
|
||||
#include <cinttypes>
|
||||
|
||||
namespace MM::ImGuiWidgets {
|
||||
|
||||
@@ -55,16 +56,16 @@ void JsonViewerSimple(const char* name, const JsonObjectType& json) {
|
||||
}
|
||||
break;
|
||||
case JsonObjectType::value_t::number_integer:
|
||||
ImGui::TextColored(int_color, "%ld", json.template get<int64_t>());
|
||||
ImGui::TextColored(int_color, "%" PRId64, json.template get<int64_t>());
|
||||
break;
|
||||
case JsonObjectType::value_t::number_unsigned:
|
||||
ImGui::TextColored(unsigned_color, "%lu", json.template get<uint64_t>());
|
||||
ImGui::TextColored(unsigned_color, "%" PRIu64, json.template get<uint64_t>());
|
||||
break;
|
||||
case JsonObjectType::value_t::number_float:
|
||||
ImGui::TextColored(float_color, "%f", json.template get<float>());
|
||||
break;
|
||||
case JsonObjectType::value_t::object:
|
||||
ImGui::TextDisabled("{%d}", json.size());
|
||||
ImGui::TextDisabled("{%zu}", json.size());
|
||||
|
||||
ImGui::Indent();
|
||||
for (auto& [key, value] : json.items()) {
|
||||
@@ -74,7 +75,7 @@ void JsonViewerSimple(const char* name, const JsonObjectType& json) {
|
||||
|
||||
break;
|
||||
case JsonObjectType::value_t::array:
|
||||
ImGui::TextDisabled("[%d]", json.size());
|
||||
ImGui::TextDisabled("[%zu]", json.size());
|
||||
|
||||
ImGui::Indent();
|
||||
for (auto& [key, value] : json.items()) {
|
||||
@@ -103,9 +104,9 @@ void JsonViewerTree(const char* name, const JsonObjectType& json) {
|
||||
|
||||
ImGui::SameLine();
|
||||
if (json.is_object()) {
|
||||
ImGui::TextDisabled("{%d}", json.size());
|
||||
ImGui::TextDisabled("{%zu}", json.size());
|
||||
} else { // is_array()
|
||||
ImGui::TextDisabled("[%d]", json.size());
|
||||
ImGui::TextDisabled("[%zu]", json.size());
|
||||
}
|
||||
|
||||
if (tree_open) {
|
||||
@@ -143,10 +144,10 @@ void JsonViewerTree(const char* name, const JsonObjectType& json) {
|
||||
}
|
||||
break;
|
||||
case JsonObjectType::value_t::number_integer:
|
||||
ImGui::TextColored(int_color, "%ld", json.template get<int64_t>());
|
||||
ImGui::TextColored(int_color, "%" PRId64, json.template get<int64_t>());
|
||||
break;
|
||||
case JsonObjectType::value_t::number_unsigned:
|
||||
ImGui::TextColored(unsigned_color, "%lu", json.template get<uint64_t>());
|
||||
ImGui::TextColored(unsigned_color, "%" PRIu64, json.template get<uint64_t>());
|
||||
break;
|
||||
case JsonObjectType::value_t::number_float:
|
||||
ImGui::TextColored(float_color, "%f", json.template get<float>());
|
||||
@@ -200,9 +201,9 @@ void JsonEditor(const char* name, JsonObjectType& json) {
|
||||
|
||||
ImGui::SameLine();
|
||||
if (json.is_object()) {
|
||||
ImGui::TextDisabled("{%d}", json.size());
|
||||
ImGui::TextDisabled("{%zu}", json.size());
|
||||
} else { // is_array()
|
||||
ImGui::TextDisabled("[%d]", json.size());
|
||||
ImGui::TextDisabled("[%zu]", json.size());
|
||||
}
|
||||
|
||||
if (tree_open) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "./scene_tools.hpp"
|
||||
#include "mm/engine_fwd.hpp"
|
||||
|
||||
#include <mm/engine.hpp>
|
||||
|
||||
@@ -109,16 +110,19 @@ namespace MM::Services {
|
||||
|
||||
if (_show_scene_metrics) {
|
||||
if (ImGui::Begin("Scene Metrics##ImGuiSceneToolsService", &_show_scene_metrics)) {
|
||||
ImGui::Text("capacity: %lu", scene.capacity());
|
||||
ImGui::Text("size: %lu", scene.size());
|
||||
ImGui::Text("alive: %lu", scene.alive());
|
||||
size_t orphans = 0;
|
||||
scene.each([&orphans, &scene](auto entity) {
|
||||
if (scene.orphan(entity)) {
|
||||
orphans++;
|
||||
ImGui::Text("capacity: %zu", scene.storage<::MM::Entity>().capacity());
|
||||
ImGui::Text("size: %zu", scene.storage<::MM::Entity>().size());
|
||||
ImGui::Text("alive: %zu", scene.storage<::MM::Entity>().in_use());
|
||||
if (ImGui::CollapsingHeader("orphans")) {
|
||||
// iterating all entities is expensive
|
||||
size_t orphans = 0;
|
||||
for (const auto it : scene.storage<MM::Entity>().each()) {
|
||||
if (scene.orphan(std::get<0>(it))) {
|
||||
orphans++;
|
||||
}
|
||||
}
|
||||
});
|
||||
ImGui::Text("orphans: %lu", orphans);
|
||||
ImGui::Text("orphans: %lu", orphans);
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user