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: Add Doxygen headers and section separators to editor files
esengine32e28ffc2f81
diff --git a/src/esengine/editor/AssetDatabase.cpp b/src/esengine/editor/AssetDatabase.cppindex eaa6c3780..e3778c623 100644--- a/src/esengine/editor/AssetDatabase.cpp+++ b/src/esengine/editor/AssetDatabase.cpp@@ -1,3 +1,14 @@+/**+ * @file AssetDatabase.cpp+ * @brief Asset database implementation+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */+#include "AssetDatabase.hpp"#include "../platform/FileSystem.hpp"#include "../core/Log.hpp"@@ -9,63 +20,77 @@namespace esengine::editor {+// =============================================================================+// Helper Functions+// =============================================================================+namespace {- std::string getFileName(const std::string& path) {- usize pos = path.find_last_of("/\\");- if (pos != std::string::npos) {- return path.substr(pos + 1);- }- return path;++std::string getFileName(const std::string& path) {+ usize pos = path.find_last_of("/\\");+ if (pos != std::string::npos) {+ return path.substr(pos + 1);}+ return path;+}- std::string getFileExtension(const std::string& path) {- usize pos = path.find_last_of('.');- if (pos != std::string::npos) {- return path.substr(pos);- }- return "";+std::string getFileExtension(const std::string& path) {+ usize pos = path.find_last_of('.');+ if (pos != std::string::npos) {+ return path.substr(pos);}+ return "";+}- std::string escapeJsonString(const std::string& str) {- std::string result;- result.reserve(str.size() + 16);- for (char c : str) {- switch (c) {- case '"': result += "\\\""; break;- case '\\': result += "\\\\"; break;- case '\n': result += "\\n"; break;- case '\r': result += "\\r"; break;- case '\t': result += "\\t"; break;- default: result += c; break;- }+std::string escapeJsonString(const std::string& str) {+ std::string result;+ result.reserve(str.size() + 16);+ for (char c : str) {+ switch (c) {+ case '"': result += "\\\""; break;+ case '\\': result += "\\\\"; break;+ case '\n': result += "\\n"; break;+ case '\r': result += "\\r"; break;+ case '\t': result += "\\t"; break;+ default: result += c; break;}- return result;}+ return result;+}- std::string unescapeJsonString(const std::string& str) {- std::string result;- result.reserve(str.size());- for (usize i = 0; i < str.size(); ++i) {- if (str[i] == '\\' && i + 1 < str.size()) {- switch (str[i + 1]) {- case '"': result += '"'; ++i; break;- case '\\': result += '\\'; ++i; break;- case 'n': result += '\n'; ++i; break;- case 'r': result += '\r'; ++i; break;- case 't': result += '\t'; ++i; break;- default: result += str[i]; break;- }- } else {- result += str[i];+std::string unescapeJsonString(const std::string& str) {+ std::string result;+ result.reserve(str.size());+ for (usize i = 0; i < str.size(); ++i) {+ if (str[i] == '\\' && i + 1 < str.size()) {+ switch (str[i + 1]) {+ case '"': result += '"'; ++i; break;+ case '\\': result += '\\'; ++i; break;+ case 'n': result += '\n'; ++i; break;+ case 'r': result += '\r'; ++i; break;+ case 't': result += '\t'; ++i; break;+ default: result += str[i]; break;}+ } else {+ result += str[i];}- return result;}+ return result;+}+} // namespace+// =============================================================================+// Constructor / Destructor+// =============================================================================+AssetDatabase::AssetDatabase() = default;AssetDatabase::~AssetDatabase() = default;+// =============================================================================+// Public Methods+// =============================================================================+void AssetDatabase::setProjectPath(const std::string& path) {if (projectPath_ != path) {projectPath_ = path;@@ -94,6 +119,10 @@ void AssetDatabase::refresh() {scan();}+// =============================================================================+// Directory Scanning+// =============================================================================+void AssetDatabase::scanDirectory(const std::string& directory, bool recursive) {#ifdef ES_PLATFORM_WEBreturn;@@ -140,6 +169,10 @@ void AssetDatabase::scanDirectory(const std::string& directory, bool recursive)}}+// =============================================================================+// Query Methods+// =============================================================================+const AssetMetadata* AssetDatabase::findByPath(const std::string& path) const {auto it = pathToGUID_.find(path);if (it != pathToGUID_.end()) {@@ -233,6 +266,10 @@ AssetType AssetDatabase::detectAssetType(const std::string& path) const {return getAssetTypeFromExtension(ext);}+// =============================================================================+// Database Persistence+// =============================================================================+void AssetDatabase::saveDatabase() {#ifdef ES_PLATFORM_WEBreturn;@@ -336,6 +373,10 @@ void AssetDatabase::loadDatabase() {ES_LOG_DEBUG("AssetDatabase: Loaded {} assets from {}", assetsByGUID_.size(), dbPath);}+// =============================================================================+// Callbacks+// =============================================================================+void AssetDatabase::setOnAssetAdded(std::function<void(const AssetMetadata&)> callback) {onAssetAdded_ = std::move(callback);}diff --git a/src/esengine/editor/AssetDatabase.hpp b/src/esengine/editor/AssetDatabase.hppindex 615327edc..63f08dcf3 100644--- a/src/esengine/editor/AssetDatabase.hpp+++ b/src/esengine/editor/AssetDatabase.hpp@@ -1,5 +1,21 @@+/**+ * @file AssetDatabase.hpp+ * @brief Centralized asset management and tracking+ * @details Maintains a database of all project assets with GUID-based+ * identification and metadata caching.+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */#pragma once+// =============================================================================+// Includes+// =============================================================================+#include "../core/Types.hpp"#include "panels/AssetBrowserTypes.hpp"@@ -10,6 +26,10 @@namespace esengine::editor {+// =============================================================================+// Data Structures+// =============================================================================+struct AssetMetadata {std::string guid;std::string path;@@ -21,6 +41,10 @@ struct AssetMetadata {bool isDirectory = false;};+// =============================================================================+// AssetDatabase Class+// =============================================================================+class AssetDatabase {public:AssetDatabase();diff --git a/src/esengine/editor/DragDropManager.cpp b/src/esengine/editor/DragDropManager.cppindex de8c06a73..ebbe69f72 100644--- a/src/esengine/editor/DragDropManager.cpp+++ b/src/esengine/editor/DragDropManager.cpp@@ -1,9 +1,24 @@+/**+ * @file DragDropManager.cpp+ * @brief Drag-and-drop manager implementation+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */+#include "DragDropManager.hpp"#include <cmath>namespace esengine::editor {+// =============================================================================+// Drag Operations+// =============================================================================+void DragDropManager::beginDrag(const DragDropPayload& payload, const glm::vec2& startPos) {if (isDragging_) {return;@@ -54,6 +69,10 @@ void DragDropManager::cancelDrag() {pendingPayload_.reset();}+// =============================================================================+// Accessors+// =============================================================================+const DragDropPayload* DragDropManager::getPayload() const {if (isDragging_) {return &activePayload_;diff --git a/src/esengine/editor/DragDropManager.hpp b/src/esengine/editor/DragDropManager.hppindex 23111a2c7..934a79401 100644--- a/src/esengine/editor/DragDropManager.hpp+++ b/src/esengine/editor/DragDropManager.hpp@@ -1,5 +1,21 @@+/**+ * @file DragDropManager.hpp+ * @brief Manager for editor drag-and-drop operations+ * @details Handles drag state tracking, threshold detection, and+ * signal dispatch for drag-and-drop interactions.+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */#pragma once+// =============================================================================+// Includes+// =============================================================================+#include "DragDropTypes.hpp"#include "../events/Signal.hpp"@@ -9,6 +25,10 @@namespace esengine::editor {+// =============================================================================+// DragDropManager Class+// =============================================================================+class DragDropManager {public:static constexpr f32 DRAG_THRESHOLD = 5.0f;diff --git a/src/esengine/editor/DragDropTypes.hpp b/src/esengine/editor/DragDropTypes.hppindex 516edef44..ad8bd2f51 100644--- a/src/esengine/editor/DragDropTypes.hpp+++ b/src/esengine/editor/DragDropTypes.hpp@@ -1,5 +1,19 @@+/**+ * @file DragDropTypes.hpp+ * @brief Type definitions for drag-and-drop operations+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */#pragma once+// =============================================================================+// Includes+// =============================================================================+#include "../core/Types.hpp"#include "../ecs/Entity.hpp"@@ -10,6 +24,10 @@namespace esengine::editor {+// =============================================================================+// Enumerations+// =============================================================================+enum class DragDropType : u8 {None,Asset,@@ -17,6 +35,10 @@ enum class DragDropType : u8 {Component};+// =============================================================================+// Data Structures+// =============================================================================+struct AssetDragData {std::string guid;std::string path;diff --git a/src/esengine/editor/ThumbnailGenerator.cpp b/src/esengine/editor/ThumbnailGenerator.cppindex b9407fa43..d9e953f00 100644--- a/src/esengine/editor/ThumbnailGenerator.cpp+++ b/src/esengine/editor/ThumbnailGenerator.cpp@@ -1,3 +1,14 @@+/**+ * @file ThumbnailGenerator.cpp+ * @brief Thumbnail generator implementation+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */+#include "ThumbnailGenerator.hpp"#include "panels/AssetBrowserTypes.hpp"#include "../core/Log.hpp"@@ -9,6 +20,10 @@namespace esengine::editor {+// =============================================================================+// Helper Functions+// =============================================================================+namespace {std::vector<u8> resizeImage(const u8* src, u32 srcWidth, u32 srcHeight, u32 dstWidth, u32 dstHeight, u32 channels) {@@ -48,10 +63,18 @@ glm::vec4 getColorForType(AssetType type) {} // namespace+// =============================================================================+// Constructor / Destructor+// =============================================================================+ThumbnailGenerator::ThumbnailGenerator() = default;ThumbnailGenerator::~ThumbnailGenerator() = default;+// =============================================================================+// Public Methods+// =============================================================================+void ThumbnailGenerator::generateThumbnail(const std::string& guid, const std::string& path, AssetType type) {if (hasThumbnail(guid)) {return;@@ -84,6 +107,10 @@ void ThumbnailGenerator::removeThumbnail(const std::string& guid) {thumbnails_.erase(guid);}+// =============================================================================+// Private Methods+// =============================================================================+void ThumbnailGenerator::generateTextureThumbnail(const std::string& guid, const std::string& path) {int width, height, channels;stbi_set_flip_vertically_on_load(false);diff --git a/src/esengine/editor/ThumbnailGenerator.hpp b/src/esengine/editor/ThumbnailGenerator.hppindex 60b297673..63b3e236c 100644--- a/src/esengine/editor/ThumbnailGenerator.hpp+++ b/src/esengine/editor/ThumbnailGenerator.hpp@@ -1,5 +1,21 @@+/**+ * @file ThumbnailGenerator.hpp+ * @brief Asset thumbnail generation and caching+ * @details Generates and caches thumbnail images for various asset types+ * for display in the asset browser.+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */#pragma once+// =============================================================================+// Includes+// =============================================================================+#include "../core/Types.hpp"#include "../renderer/Texture.hpp"@@ -8,8 +24,16 @@namespace esengine::editor {+// =============================================================================+// Forward Declarations+// =============================================================================+enum class AssetType : u8;+// =============================================================================+// ThumbnailGenerator Class+// =============================================================================+class ThumbnailGenerator {public:static constexpr u32 THUMBNAIL_SIZE = 64;