A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix: Fix CI build errors and InspectorPanel button connections
esenginec80fab4aaa8c
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 600f191f5..2d6cb556a 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -140,7 +140,7 @@ jobs:- name: Build Side Modulesrun: |- cmake --build build_modular --target es_ui_core es_ui_widgets es_ui_docking es_font_bitmap+ cmake --build build_modular --target es_ui_core es_ui_widgets es_ui_docking- name: Check Module Sizesrun: |diff --git a/cmake/Emscripten.cmake b/cmake/Emscripten.cmakeindex fdc91dc72..9b69e5cb7 100644--- a/cmake/Emscripten.cmake+++ b/cmake/Emscripten.cmake@@ -30,7 +30,7 @@ set(ES_EMSCRIPTEN_LINK_FLAGS-sMODULARIZE=1 # Wrap in module factory function"-sEXPORT_NAME='ESEngineModule'" # Module name# Exported functions (EMSCRIPTEN_KEEPALIVE + stdlib)- "-sEXPORTED_FUNCTIONS=['_malloc','_free','_es_app_init','_es_sdk_init','_es_sdk_version']"+ "-sEXPORTED_FUNCTIONS=['_malloc','_free','_es_app_init']""-sEXPORTED_RUNTIME_METHODS=['ccall','cwrap','HEAPF32','HEAPU8','HEAPU32']"# Embed assets (fonts, etc.)"--embed-file=${CMAKE_SOURCE_DIR}/assets/fonts@/assets/fonts"diff --git a/src/esengine/editor/panels/InspectorPanel.cpp b/src/esengine/editor/panels/InspectorPanel.cppindex 131af31dc..3fefa72d6 100644--- a/src/esengine/editor/panels/InspectorPanel.cpp+++ b/src/esengine/editor/panels/InspectorPanel.cpp@@ -47,6 +47,7 @@ InspectorPanel::InspectorPanel(ecs::Registry& registry,setMinSize(glm::vec2(250.0f, 200.0f));buildUI();+ connectToolbarButtons();selectionListenerId_ = selection_.addListener([this](const std::vector<Entity>&, const std::vector<Entity>&) {@@ -97,6 +98,7 @@ void InspectorPanel::buildUI() {lockButton->setWidth(ui::SizeValue::px(26.0f));lockButton->setHeight(ui::SizeValue::px(26.0f));lockButton->setCornerRadii(ui::CornerRadii::all(3.0f));+ lockButton_ = lockButton.get();toolbar->addChild(std::move(lockButton));auto debugButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + "_debug_btn"), ui::icons::Bug);@@ -104,6 +106,7 @@ void InspectorPanel::buildUI() {debugButton->setWidth(ui::SizeValue::px(26.0f));debugButton->setHeight(ui::SizeValue::px(26.0f));debugButton->setCornerRadii(ui::CornerRadii::all(3.0f));+ debugButton_ = debugButton.get();toolbar->addChild(std::move(debugButton));auto spacer = makeUnique<ui::Panel>(ui::WidgetId(getId().path + "_spacer"));@@ -117,6 +120,7 @@ void InspectorPanel::buildUI() {addComponentButton->setWidth(ui::SizeValue::px(26.0f));addComponentButton->setHeight(ui::SizeValue::px(26.0f));addComponentButton->setCornerRadii(ui::CornerRadii::all(3.0f));+ addComponentButton_ = addComponentButton.get();toolbar->addChild(std::move(addComponentButton));auto settingsButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + "_settings_btn"), ui::icons::Settings);@@ -124,6 +128,7 @@ void InspectorPanel::buildUI() {settingsButton->setWidth(ui::SizeValue::px(26.0f));settingsButton->setHeight(ui::SizeValue::px(26.0f));settingsButton->setCornerRadii(ui::CornerRadii::all(3.0f));+ settingsButton_ = settingsButton.get();toolbar->addChild(std::move(settingsButton));rootPanel->addChild(std::move(toolbar));@@ -1245,4 +1250,39 @@ void InspectorPanel::addScriptComponentEditors(Entity entity) {}}+void InspectorPanel::connectToolbarButtons() {+ if (addComponentButton_) {+ toolbarConnections_.add(sink(addComponentButton_->onClick).connect(+ [this]() { onAddComponentClicked(); }+ ));+ }+}++void InspectorPanel::onAddComponentClicked() {+ if (currentEntity_ == INVALID_ENTITY || !registry_.valid(currentEntity_)) {+ ES_LOG_WARN("No entity selected to add component");+ return;+ }++ ES_LOG_INFO("Add component clicked for entity {}", currentEntity_);++ // Add Camera component if not already present+ if (!registry_.has<ecs::Camera>(currentEntity_)) {+ registry_.emplace<ecs::Camera>(currentEntity_);+ ES_LOG_INFO("Added Camera component to entity {}", currentEntity_);+ rebuildInspector();+ return;+ }++ // Add Sprite component if not already present+ if (!registry_.has<ecs::Sprite>(currentEntity_)) {+ registry_.emplace<ecs::Sprite>(currentEntity_);+ ES_LOG_INFO("Added Sprite component to entity {}", currentEntity_);+ rebuildInspector();+ return;+ }++ ES_LOG_INFO("Entity already has all available components");+}+} // namespace esengine::editordiff --git a/src/esengine/editor/panels/InspectorPanel.hpp b/src/esengine/editor/panels/InspectorPanel.hppindex de5a1b418..ccc72171d 100644--- a/src/esengine/editor/panels/InspectorPanel.hpp+++ b/src/esengine/editor/panels/InspectorPanel.hpp@@ -20,6 +20,7 @@#include "../../ui/widgets/Label.hpp"#include "../../ui/widgets/Panel.hpp"#include "../../ui/widgets/TextField.hpp"+#include "../../ui/widgets/Button.hpp"#include "../../ecs/Registry.hpp"#include "../../ecs/Entity.hpp"#include "../core/Selection.hpp"@@ -134,10 +135,20 @@ private:u32 selectionListenerId_ = 0;ConnectionHolder editorConnections_;+ ConnectionHolder toolbarConnections_;Vector3Editor* positionEditor_ = nullptr;Vector3Editor* rotationEditor_ = nullptr;Vector3Editor* scaleEditor_ = nullptr;++ // Toolbar buttons+ ui::Button* addComponentButton_ = nullptr;+ ui::Button* lockButton_ = nullptr;+ ui::Button* debugButton_ = nullptr;+ ui::Button* settingsButton_ = nullptr;++ void connectToolbarButtons();+ void onAddComponentClicked();};} // namespace esengine::editor