Skip to content

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.

fix: Fix property editor hitTest and add modifier key support

esengine676bbaf2f47f
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 000000000..d4189da8c
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,31 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Debug ESEngine Editor",
+ "type": "cppdbg",
+ "request": "launch",
+ "program": "${workspaceFolder}/build/bin/esengine_editor.exe",
+ "args": [],
+ "stopAtEntry": false,
+ "cwd": "${workspaceFolder}",
+ "environment": [],
+ "externalConsole": false,
+ "MIMode": "gdb",
+ "miDebuggerPath": "C:/msys64/mingw64/bin/gdb.exe",
+ "setupCommands": [
+ {
+ "description": "Enable pretty-printing for gdb",
+ "text": "-enable-pretty-printing",
+ "ignoreFailures": true
+ },
+ {
+ "description": "Set Disassembly Flavor to Intel",
+ "text": "-gdb-set disassembly-flavor intel",
+ "ignoreFailures": true
+ }
+ ],
+ "preLaunchTask": "build-debug"
+ }
+ ]
+}
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 000000000..32f82e793
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,22 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "build-debug",
+ "type": "shell",
+ "command": "cmake",
+ "args": [
+ "--build",
+ "build"
+ ],
+ "options": {
+ "cwd": "${workspaceFolder}"
+ },
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ },
+ "problemMatcher": ["$gcc"]
+ }
+ ]
+}
diff --git a/assets/.esengine/assets.db b/assets/.esengine/assets.db
index ea2f5e212..ad3d697aa 100644
--- a/assets/.esengine/assets.db
+++ b/assets/.esengine/assets.db
@@ -2,13 +2,13 @@
"version": "1.0",
"assets": [
{
- "guid": "a6dd418b-dd75-0249-f26e-bb1b4cc294c8",
- "path": "F:\\microes\\assets\\shaders\\postprocess.glsl",
- "name": "postprocess.glsl",
- "type": 5,
+ "guid": "83dd6048-d8fa-b62a-47d1-6f17771c459f",
+ "path": "F:\\microes\\assets\\scripts",
+ "name": "scripts",
+ "type": 1,
"fileSize": 0,
- "lastModified": 1769503002,
- "isDirectory": false
+ "lastModified": 1769503001,
+ "isDirectory": true
},
{
"guid": "835ed25e-a75f-3a42-0953-d9af26b1cc87",
@@ -20,183 +20,210 @@
"isDirectory": false
},
{
- "guid": "fb6e1999-a210-5293-9dc9-f648e6e8fc1f",
- "path": "assets\\shaders\\sprite.glsl",
- "name": "sprite.glsl",
+ "guid": "a6dd418b-dd75-0249-f26e-bb1b4cc294c8",
+ "path": "F:\\microes\\assets\\shaders\\postprocess.glsl",
+ "name": "postprocess.glsl",
"type": 5,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "539c3218-76fb-bed8-1442-3c43ae5be464",
- "path": "F:\\microes\\assets\\textures\\tileset.png",
- "name": "tileset.png",
- "type": 2,
- "fileSize": 0,
- "lastModified": 1769503002,
- "isDirectory": false
- },
- {
- "guid": "f928d327-1c23-3d66-2009-d4d3daea8e31",
- "path": "F:\\microes\\assets\\textures\\skybox.png",
- "name": "skybox.png",
+ "guid": "0f5a7d56-b021-7cfe-9ffd-b6deba57b565",
+ "path": "assets\\textures\\ui_panel.png",
+ "name": "ui_panel.png",
"type": 2,
"fileSize": 0,
- "lastModified": 1769503002,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "30c0a678-ec31-5c3c-f60c-2b982d208861",
- "path": "F:\\microes\\assets\\textures\\background.png",
- "name": "background.png",
- "type": 2,
+ "guid": "0926ee8f-8eef-58fa-8d75-0ac49a8bf2b1",
+ "path": "F:\\microes\\assets\\scenes",
+ "name": "scenes",
+ "type": 1,
"fileSize": 0,
"lastModified": 1769503002,
- "isDirectory": false
+ "isDirectory": true
},
{
- "guid": "182aa6a4-c774-8473-5238-49e1d28f1c5d",
- "path": "assets\\prefabs\\Enemy.prefab",
- "name": "Enemy.prefab",
+ "guid": "bbbdbf23-cecf-5053-0ebe-f3daf5b9e103",
+ "path": "assets\\prefabs\\Explosion.prefab",
+ "name": "Explosion.prefab",
"type": 7,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "9db35f84-665c-e687-86b1-cc78a3934216",
- "path": "assets\\test.txt",
- "name": "test.txt",
- "type": 0,
- "fileSize": 5,
- "lastModified": 1769488062,
- "isDirectory": false
+ "guid": "ab8960b7-4b05-8029-7577-571c44b9c394",
+ "path": "F:\\microes\\assets\\fonts",
+ "name": "fonts",
+ "type": 1,
+ "fileSize": 0,
+ "lastModified": 1769653160,
+ "isDirectory": true
},
{
- "guid": "e1d87090-38ce-2d60-5bdd-1f928fdaf88a",
- "path": "assets\\scenes\\Level1.scene",
- "name": "Level1.scene",
- "type": 6,
+ "guid": "2402078f-7772-c860-8bce-dfdb1fc37788",
+ "path": "F:\\microes\\assets\\audio\\bgm_main.mp3",
+ "name": "bgm_main.mp3",
+ "type": 3,
"fileSize": 0,
- "lastModified": 1769503002,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "53cf7de5-ae26-2632-e022-e9108f6bbc2c",
- "path": "F:\\microes\\assets\\audio\\sfx_coin.wav",
- "name": "sfx_coin.wav",
- "type": 3,
+ "guid": "ed1cf9a5-9d96-50d7-e385-82c605f70a63",
+ "path": "F:\\microes\\assets\\prefabs\\Explosion.prefab",
+ "name": "Explosion.prefab",
+ "type": 7,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "e0220f45-6261-175f-883b-ba80783788f2",
- "path": "assets\\textures",
- "name": "textures",
+ "guid": "08964537-6809-2c47-8997-7bbf1c75029f",
+ "path": "assets\\scripts",
+ "name": "scripts",
"type": 1,
"fileSize": 0,
- "lastModified": 1769503001,
+ "lastModified": 1769503002,
"isDirectory": true
},
{
- "guid": "d44064b6-5cd8-29c4-8dc3-e6f0b71c6ad1",
- "path": "F:\\microes\\assets\\textures\\ui_panel.png",
- "name": "ui_panel.png",
+ "guid": "8af759e0-a053-8e8c-1e34-48843f734d2f",
+ "path": "assets\\textures\\enemy.png",
+ "name": "enemy.png",
"type": 2,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "32dd883f-81c7-59a9-8229-5920e8152da1",
- "path": "assets\\prefabs",
- "name": "prefabs",
- "type": 1,
+ "guid": "c6908b3b-7d16-8e81-5c2d-c65c46fee0d4",
+ "path": "assets\\audio\\bgm_battle.mp3",
+ "name": "bgm_battle.mp3",
+ "type": 3,
"fileSize": 0,
- "lastModified": 1769503001,
- "isDirectory": true
+ "lastModified": 1769503002,
+ "isDirectory": false
},
{
- "guid": "a424334b-4399-6ab1-440c-7da10d865e15",
- "path": "assets\\scripts\\UIManager.js",
- "name": "UIManager.js",
- "type": 4,
+ "guid": "d11c2d62-5870-5040-3e1a-bf5bc046b98a",
+ "path": "F:\\microes\\assets\\textures\\ui_button.png",
+ "name": "ui_button.png",
+ "type": 2,
"fileSize": 0,
- "lastModified": 1769503001,
+ "lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "4b48ff38-aeb0-7a1b-38ec-03ad938736e9",
- "path": "F:\\microes\\assets\\shaders\\sprite.glsl",
- "name": "sprite.glsl",
- "type": 5,
+ "guid": "0b354ef8-0528-35e8-b628-bed14b4960db",
+ "path": "F:\\microes\\assets\\audio\\bgm_battle.mp3",
+ "name": "bgm_battle.mp3",
+ "type": 3,
"fileSize": 0,
"lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "234c30b6-359c-51c1-a526-a970984ad90a",
- "path": "F:\\microes\\assets\\textures\\enemy.png",
- "name": "enemy.png",
+ "guid": "06d02285-6f13-7665-e142-87cc08b9f6b8",
+ "path": "assets\\fonts\\lucide.ttf",
+ "name": "lucide.ttf",
+ "type": 8,
+ "fileSize": 793848,
+ "lastModified": 1769501796,
+ "isDirectory": false
+ },
+ {
+ "guid": "9db35f84-665c-e687-86b1-cc78a3934216",
+ "path": "assets\\test.txt",
+ "name": "test.txt",
+ "type": 0,
+ "fileSize": 5,
+ "lastModified": 1769488062,
+ "isDirectory": false
+ },
+ {
+ "guid": "f928d327-1c23-3d66-2009-d4d3daea8e31",
+ "path": "F:\\microes\\assets\\textures\\skybox.png",
+ "name": "skybox.png",
"type": 2,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "986b148c-b4ea-cf89-2e04-37dc26624976",
- "path": "F:\\microes\\assets\\textures\\particle.png",
- "name": "particle.png",
+ "guid": "30c0a678-ec31-5c3c-f60c-2b982d208861",
+ "path": "F:\\microes\\assets\\textures\\background.png",
+ "name": "background.png",
"type": 2,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "9d69bbdf-276b-8f14-cc66-10e8dfcdb283",
- "path": "F:\\microes\\assets\\scripts\\CameraFollow.js",
- "name": "CameraFollow.js",
- "type": 4,
+ "guid": "182aa6a4-c774-8473-5238-49e1d28f1c5d",
+ "path": "assets\\prefabs\\Enemy.prefab",
+ "name": "Enemy.prefab",
+ "type": 7,
"fileSize": 0,
- "lastModified": 1769503001,
+ "lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "99c227eb-f8d3-d0e8-843b-ceb126687e8b",
- "path": "F:\\microes\\assets\\audio",
- "name": "audio",
- "type": 1,
+ "guid": "abf642da-9512-d0bd-e306-e1bce616320c",
+ "path": "F:\\microes\\assets\\scenes\\Level2.scene",
+ "name": "Level2.scene",
+ "type": 6,
"fileSize": 0,
"lastModified": 1769503002,
- "isDirectory": true
+ "isDirectory": false
},
{
- "guid": "1c90475d-0d57-c627-f004-15d52bee4319",
- "path": "F:\\microes\\assets\\shaders\\water.glsl",
- "name": "water.glsl",
- "type": 5,
+ "guid": "ff5ba3b5-d524-f202-72ae-a40add555353",
+ "path": "assets\\scenes\\Level2.scene",
+ "name": "Level2.scene",
+ "type": 6,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "f23cff38-7fcd-d864-b487-6ca733c33582",
- "path": "F:\\microes\\assets\\scripts\\EnemyAI.js",
- "name": "EnemyAI.js",
- "type": 4,
+ "guid": "ca417dff-fe94-4361-ec9b-16504f048514",
+ "path": "F:\\microes\\assets\\prefabs\\Bullet.prefab",
+ "name": "Bullet.prefab",
+ "type": 7,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "cc395f8f-d6f9-a23d-db3b-7253b437aa8a",
- "path": "F:\\microes\\assets\\.esengine",
- "name": ".esengine",
+ "guid": "7d86b8df-60d3-330a-ae99-ae597a929a9b",
+ "path": "assets\\textures\\player.png",
+ "name": "player.png",
+ "type": 2,
+ "fileSize": 0,
+ "lastModified": 1769503002,
+ "isDirectory": false
+ },
+ {
+ "guid": "a424334b-4399-6ab1-440c-7da10d865e15",
+ "path": "assets\\scripts\\UIManager.js",
+ "name": "UIManager.js",
+ "type": 4,
+ "fileSize": 0,
+ "lastModified": 1769503001,
+ "isDirectory": false
+ },
+ {
+ "guid": "32dd883f-81c7-59a9-8229-5920e8152da1",
+ "path": "assets\\prefabs",
+ "name": "prefabs",
"type": 1,
"fileSize": 0,
- "lastModified": 1769495856,
+ "lastModified": 1769503001,
"isDirectory": true
},
{
@@ -218,10 +245,19 @@
"isDirectory": false
},
{
- "guid": "6650f3d3-a906-b4a9-1873-b75759499bf8",
- "path": "F:\\microes\\assets\\audio\\sfx_jump.wav",
- "name": "sfx_jump.wav",
- "type": 3,
+ "guid": "02f1f294-5a7f-d28b-7095-a04518207f9c",
+ "path": "F:\\microes\\assets\\scripts\\GameManager.js",
+ "name": "GameManager.js",
+ "type": 4,
+ "fileSize": 0,
+ "lastModified": 1769503002,
+ "isDirectory": false
+ },
+ {
+ "guid": "3cc64ba4-5416-2768-7eff-dbba531179c4",
+ "path": "assets\\textures\\particle.png",
+ "name": "particle.png",
+ "type": 2,
"fileSize": 0,
"lastModified": 1769503001,
"isDirectory": false
@@ -236,219 +272,201 @@
"isDirectory": true
},
{
- "guid": "90db01ce-eadb-5131-35ee-a55e9f60bb4d",
- "path": "assets\\shaders\\water.glsl",
- "name": "water.glsl",
- "type": 5,
+ "guid": "c71b2168-6faf-8d98-2ce8-4175ecfc98f2",
+ "path": "assets\\prefabs\\Bullet.prefab",
+ "name": "Bullet.prefab",
+ "type": 7,
"fileSize": 0,
- "lastModified": 1769503001,
+ "lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "c6113f63-03d0-811d-550a-8f26f331233d",
- "path": "assets\\textures\\tileset.png",
- "name": "tileset.png",
- "type": 2,
- "fileSize": 0,
- "lastModified": 1769503002,
+ "guid": "6a7bd38a-6b72-be37-a497-9628dafb35e1",
+ "path": "F:\\microes\\assets\\.esengine\\assets.db",
+ "name": "assets.db",
+ "type": 0,
+ "fileSize": 23550,
+ "lastModified": 1769668840,
"isDirectory": false
},
{
- "guid": "b55ead52-b974-950b-26a3-a227e2ac41e9",
- "path": "assets\\audio\\sfx_coin.wav",
- "name": "sfx_coin.wav",
- "type": 3,
+ "guid": "f543cca8-b481-a8be-8507-770c03c75eab",
+ "path": "assets\\scenes",
+ "name": "scenes",
+ "type": 1,
"fileSize": 0,
"lastModified": 1769503002,
- "isDirectory": false
+ "isDirectory": true
},
{
- "guid": "6e88b347-db2d-b526-87c6-301569094b15",
- "path": "F:\\microes\\assets\\audio\\sfx_explosion.wav",
- "name": "sfx_explosion.wav",
- "type": 3,
+ "guid": "9d69bbdf-276b-8f14-cc66-10e8dfcdb283",
+ "path": "F:\\microes\\assets\\scripts\\CameraFollow.js",
+ "name": "CameraFollow.js",
+ "type": 4,
"fileSize": 0,
- "lastModified": 1769503002,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "0e48ebc1-25c8-2588-29aa-fb40564e2355",
- "path": "assets\\scenes\\MainMenu.scene",
- "name": "MainMenu.scene",
- "type": 6,
+ "guid": "99c227eb-f8d3-d0e8-843b-ceb126687e8b",
+ "path": "F:\\microes\\assets\\audio",
+ "name": "audio",
+ "type": 1,
"fileSize": 0,
"lastModified": 1769503002,
- "isDirectory": false
+ "isDirectory": true
},
{
- "guid": "e11483d8-2203-6eff-1b7e-0932b819f1c9",
- "path": "assets\\audio\\sfx_attack.wav",
- "name": "sfx_attack.wav",
- "type": 3,
+ "guid": "1c90475d-0d57-c627-f004-15d52bee4319",
+ "path": "F:\\microes\\assets\\shaders\\water.glsl",
+ "name": "water.glsl",
+ "type": 5,
"fileSize": 0,
"lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "57c85655-8b7d-e5b6-d5a6-80eb2b0b49d3",
- "path": "assets\\scripts\\Inventory.js",
- "name": "Inventory.js",
- "type": 4,
+ "guid": "49fa3441-7d74-bf79-c116-717b849b78ce",
+ "path": "F:\\microes\\assets\\prefabs\\Player.prefab",
+ "name": "Player.prefab",
+ "type": 7,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "bca66dcd-f892-9c43-f176-62ac939c4de4",
- "path": "F:\\microes\\assets\\audio\\sfx_attack.wav",
- "name": "sfx_attack.wav",
- "type": 3,
+ "guid": "f29a2ee0-016a-f018-436a-9c11731f251a",
+ "path": "F:\\microes\\assets\\scripts\\Inventory.js",
+ "name": "Inventory.js",
+ "type": 4,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "2402078f-7772-c860-8bce-dfdb1fc37788",
- "path": "F:\\microes\\assets\\audio\\bgm_main.mp3",
- "name": "bgm_main.mp3",
- "type": 3,
+ "guid": "d3d9a556-8861-fbc2-504a-151ef73f41de",
+ "path": "F:\\microes\\assets\\textures\\player.png",
+ "name": "player.png",
+ "type": 2,
"fileSize": 0,
- "lastModified": 1769503002,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "ff5ba3b5-d524-f202-72ae-a40add555353",
- "path": "assets\\scenes\\Level2.scene",
- "name": "Level2.scene",
- "type": 6,
+ "guid": "ce69c963-c0ea-0fb2-c96c-bf1afc0e0802",
+ "path": "assets\\shaders\\postprocess.glsl",
+ "name": "postprocess.glsl",
+ "type": 5,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "7d86b8df-60d3-330a-ae99-ae597a929a9b",
- "path": "assets\\textures\\player.png",
- "name": "player.png",
- "type": 2,
+ "guid": "44626f54-604d-ae12-0f2e-2087f068acbf",
+ "path": "F:\\microes\\assets\\prefabs\\Enemy.prefab",
+ "name": "Enemy.prefab",
+ "type": 7,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "ca417dff-fe94-4361-ec9b-16504f048514",
- "path": "F:\\microes\\assets\\prefabs\\Bullet.prefab",
- "name": "Bullet.prefab",
- "type": 7,
+ "guid": "cf70754c-26ba-346d-c01d-ff9fc29a6e9e",
+ "path": "assets\\.esengine",
+ "name": ".esengine",
+ "type": 1,
"fileSize": 0,
- "lastModified": 1769503001,
- "isDirectory": false
+ "lastModified": 1769495857,
+ "isDirectory": true
},
{
- "guid": "d6dbbbb3-87ce-a096-8027-f7b9d7129e6f",
- "path": "assets\\scripts\\EnemyAI.js",
- "name": "EnemyAI.js",
- "type": 4,
- "fileSize": 0,
- "lastModified": 1769503001,
+ "guid": "a638dc81-b60d-567f-6820-13f4e9998407",
+ "path": "assets\\.esengine\\assets.db",
+ "name": "assets.db",
+ "type": 0,
+ "fileSize": 2186,
+ "lastModified": 1769502460,
"isDirectory": false
},
{
- "guid": "8283ad01-d8a2-48ae-c4e7-c1f8f0de7955",
- "path": "F:\\microes\\assets\\scripts\\UIManager.js",
- "name": "UIManager.js",
- "type": 4,
+ "guid": "e19fb621-dd86-3c0c-6b10-142a848c6a14",
+ "path": "assets\\audio\\sfx_jump.wav",
+ "name": "sfx_jump.wav",
+ "type": 3,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "04f5ced8-9d11-fa20-d612-06f12e563341",
- "path": "assets\\prefabs\\Coin.prefab",
- "name": "Coin.prefab",
- "type": 7,
+ "guid": "0e48ebc1-25c8-2588-29aa-fb40564e2355",
+ "path": "assets\\scenes\\MainMenu.scene",
+ "name": "MainMenu.scene",
+ "type": 6,
"fileSize": 0,
- "lastModified": 1769503001,
+ "lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "3cc64ba4-5416-2768-7eff-dbba531179c4",
- "path": "assets\\textures\\particle.png",
- "name": "particle.png",
- "type": 2,
+ "guid": "e11483d8-2203-6eff-1b7e-0932b819f1c9",
+ "path": "assets\\audio\\sfx_attack.wav",
+ "name": "sfx_attack.wav",
+ "type": 3,
"fileSize": 0,
"lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "02f1f294-5a7f-d28b-7095-a04518207f9c",
- "path": "F:\\microes\\assets\\scripts\\GameManager.js",
- "name": "GameManager.js",
- "type": 4,
+ "guid": "7fe2a865-bb30-1847-62e3-d289b5616a3a",
+ "path": "F:\\microes\\assets\\scenes\\BossRoom.scene",
+ "name": "BossRoom.scene",
+ "type": 6,
"fileSize": 0,
- "lastModified": 1769503002,
- "isDirectory": false
- },
- {
- "guid": "3750f28c-b12f-4245-2036-9c552be15aea",
- "path": "F:\\microes\\assets\\fonts\\lucide.ttf",
- "name": "lucide.ttf",
- "type": 8,
- "fileSize": 793848,
- "lastModified": 1769501795,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "6837963f-192a-0bcb-80e2-1cb45a8e35e7",
- "path": "assets\\scripts\\PlayerController.js",
- "name": "PlayerController.js",
- "type": 4,
+ "guid": "53cf7de5-ae26-2632-e022-e9108f6bbc2c",
+ "path": "F:\\microes\\assets\\audio\\sfx_coin.wav",
+ "name": "sfx_coin.wav",
+ "type": 3,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "a9993ed8-9802-fb1c-f5e4-15864011fa2c",
- "path": "F:\\microes\\assets\\textures\\test.png",
- "name": "test.png",
- "type": 2,
- "fileSize": 6,
- "lastModified": 1769488063,
- "isDirectory": false
- },
- {
- "guid": "458ea613-0ce1-0325-3f9c-9f6937eafacf",
- "path": "assets\\prefabs\\Player.prefab",
- "name": "Player.prefab",
- "type": 7,
+ "guid": "e1d87090-38ce-2d60-5bdd-1f928fdaf88a",
+ "path": "assets\\scenes\\Level1.scene",
+ "name": "Level1.scene",
+ "type": 6,
"fileSize": 0,
- "lastModified": 1769503001,
+ "lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "d11c2d62-5870-5040-3e1a-bf5bc046b98a",
- "path": "F:\\microes\\assets\\textures\\ui_button.png",
- "name": "ui_button.png",
- "type": 2,
+ "guid": "57c85655-8b7d-e5b6-d5a6-80eb2b0b49d3",
+ "path": "assets\\scripts\\Inventory.js",
+ "name": "Inventory.js",
+ "type": 4,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "c6908b3b-7d16-8e81-5c2d-c65c46fee0d4",
- "path": "assets\\audio\\bgm_battle.mp3",
- "name": "bgm_battle.mp3",
+ "guid": "bca66dcd-f892-9c43-f176-62ac939c4de4",
+ "path": "F:\\microes\\assets\\audio\\sfx_attack.wav",
+ "name": "sfx_attack.wav",
"type": 3,
"fileSize": 0,
- "lastModified": 1769503002,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "0b354ef8-0528-35e8-b628-bed14b4960db",
- "path": "F:\\microes\\assets\\audio\\bgm_battle.mp3",
- "name": "bgm_battle.mp3",
- "type": 3,
- "fileSize": 0,
- "lastModified": 1769503001,
+ "guid": "44aa95ad-d460-37e0-041f-c6a4449f8b17",
+ "path": "assets\\textures\\test.png",
+ "name": "test.png",
+ "type": 2,
+ "fileSize": 6,
+ "lastModified": 1769488063,
"isDirectory": false
},
{
@@ -470,355 +488,346 @@
"isDirectory": false
},
{
- "guid": "44aa95ad-d460-37e0-041f-c6a4449f8b17",
- "path": "assets\\textures\\test.png",
- "name": "test.png",
- "type": 2,
- "fileSize": 6,
- "lastModified": 1769488063,
+ "guid": "d6dbbbb3-87ce-a096-8027-f7b9d7129e6f",
+ "path": "assets\\scripts\\EnemyAI.js",
+ "name": "EnemyAI.js",
+ "type": 4,
+ "fileSize": 0,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "c771ea16-ad7f-3333-df52-9426cff8a384",
- "path": "assets\\textures\\ui_button.png",
- "name": "ui_button.png",
- "type": 2,
+ "guid": "8283ad01-d8a2-48ae-c4e7-c1f8f0de7955",
+ "path": "F:\\microes\\assets\\scripts\\UIManager.js",
+ "name": "UIManager.js",
+ "type": 4,
"fileSize": 0,
- "lastModified": 1769503002,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "a19bf5bf-7a78-8cbd-00c8-8f38cf141628",
- "path": "F:\\microes\\assets\\fonts\\msyh.ttc",
- "name": "msyh.ttc",
- "type": 0,
- "fileSize": 19704352,
- "lastModified": 1769511858,
+ "guid": "04f5ced8-9d11-fa20-d612-06f12e563341",
+ "path": "assets\\prefabs\\Coin.prefab",
+ "name": "Coin.prefab",
+ "type": 7,
+ "fileSize": 0,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "88f4512c-08fc-7521-0720-aa75e35defbc",
- "path": "assets\\audio\\bgm_main.mp3",
- "name": "bgm_main.mp3",
- "type": 3,
+ "guid": "90db01ce-eadb-5131-35ee-a55e9f60bb4d",
+ "path": "assets\\shaders\\water.glsl",
+ "name": "water.glsl",
+ "type": 5,
"fileSize": 0,
"lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "9d4aa6d5-4f32-3634-e6fa-2c79467a2a9c",
- "path": "F:\\microes\\assets\\shaders",
- "name": "shaders",
- "type": 1,
+ "guid": "c6113f63-03d0-811d-550a-8f26f331233d",
+ "path": "assets\\textures\\tileset.png",
+ "name": "tileset.png",
+ "type": 2,
"fileSize": 0,
"lastModified": 1769503002,
- "isDirectory": true
+ "isDirectory": false
},
{
- "guid": "6f4b1d08-8b77-b7eb-629d-c2ea4efba441",
- "path": "F:\\microes\\assets\\prefabs\\Coin.prefab",
- "name": "Coin.prefab",
- "type": 7,
+ "guid": "b55ead52-b974-950b-26a3-a227e2ac41e9",
+ "path": "assets\\audio\\sfx_coin.wav",
+ "name": "sfx_coin.wav",
+ "type": 3,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "7fe2a865-bb30-1847-62e3-d289b5616a3a",
- "path": "F:\\microes\\assets\\scenes\\BossRoom.scene",
- "name": "BossRoom.scene",
- "type": 6,
+ "guid": "6e88b347-db2d-b526-87c6-301569094b15",
+ "path": "F:\\microes\\assets\\audio\\sfx_explosion.wav",
+ "name": "sfx_explosion.wav",
+ "type": 3,
"fileSize": 0,
"lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "abf642da-9512-d0bd-e306-e1bce616320c",
- "path": "F:\\microes\\assets\\scenes\\Level2.scene",
- "name": "Level2.scene",
- "type": 6,
+ "guid": "86ed9e0d-442c-a047-9b51-09011c881685",
+ "path": "assets\\audio",
+ "name": "audio",
+ "type": 1,
"fileSize": 0,
- "lastModified": 1769503002,
- "isDirectory": false
+ "lastModified": 1769503001,
+ "isDirectory": true
},
{
- "guid": "02f457d5-e200-7f62-6850-7612ed829a63",
- "path": "assets\\scenes\\BossRoom.scene",
- "name": "BossRoom.scene",
- "type": 6,
+ "guid": "0dd456da-eb9c-cdac-c429-b918b2f78b00",
+ "path": "F:\\microes\\assets\\shaders\\particle.glsl",
+ "name": "particle.glsl",
+ "type": 5,
"fileSize": 0,
- "lastModified": 1769503002,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "b162bd84-eee3-1b79-807c-c64d2c64cb2b",
- "path": "F:\\microes\\assets\\scripts\\PlayerController.js",
- "name": "PlayerController.js",
- "type": 4,
+ "guid": "83d5664f-9f0b-4687-73b2-b854c5e6d5cf",
+ "path": "assets\\fonts",
+ "name": "fonts",
+ "type": 1,
"fileSize": 0,
- "lastModified": 1769503001,
- "isDirectory": false
+ "lastModified": 1769501795,
+ "isDirectory": true
},
{
- "guid": "38633421-fb34-4766-58e7-b4ba7c8b5ee3",
- "path": "assets\\audio\\sfx_explosion.wav",
- "name": "sfx_explosion.wav",
- "type": 3,
+ "guid": "d0e72f1c-981f-5995-dade-848b8b18813e",
+ "path": "assets\\textures\\background.png",
+ "name": "background.png",
+ "type": 2,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "44626f54-604d-ae12-0f2e-2087f068acbf",
- "path": "F:\\microes\\assets\\prefabs\\Enemy.prefab",
- "name": "Enemy.prefab",
- "type": 7,
+ "guid": "6650f3d3-a906-b4a9-1873-b75759499bf8",
+ "path": "F:\\microes\\assets\\audio\\sfx_jump.wav",
+ "name": "sfx_jump.wav",
+ "type": 3,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "83dd6048-d8fa-b62a-47d1-6f17771c459f",
- "path": "F:\\microes\\assets\\scripts",
- "name": "scripts",
+ "guid": "e0220f45-6261-175f-883b-ba80783788f2",
+ "path": "assets\\textures",
+ "name": "textures",
"type": 1,
"fileSize": 0,
- "lastModified": 1769503002,
+ "lastModified": 1769503001,
"isDirectory": true
},
{
- "guid": "06d02285-6f13-7665-e142-87cc08b9f6b8",
- "path": "assets\\fonts\\lucide.ttf",
- "name": "lucide.ttf",
- "type": 8,
- "fileSize": 793848,
- "lastModified": 1769501796,
- "isDirectory": false
- },
- {
- "guid": "f543cca8-b481-a8be-8507-770c03c75eab",
- "path": "assets\\scenes",
- "name": "scenes",
+ "guid": "cc395f8f-d6f9-a23d-db3b-7253b437aa8a",
+ "path": "F:\\microes\\assets\\.esengine",
+ "name": ".esengine",
"type": 1,
"fileSize": 0,
- "lastModified": 1769503002,
+ "lastModified": 1769495856,
"isDirectory": true
},
{
- "guid": "c71b2168-6faf-8d98-2ce8-4175ecfc98f2",
- "path": "assets\\prefabs\\Bullet.prefab",
- "name": "Bullet.prefab",
- "type": 7,
+ "guid": "f23cff38-7fcd-d864-b487-6ca733c33582",
+ "path": "F:\\microes\\assets\\scripts\\EnemyAI.js",
+ "name": "EnemyAI.js",
+ "type": 4,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "6a7bd38a-6b72-be37-a497-9628dafb35e1",
- "path": "F:\\microes\\assets\\.esengine\\assets.db",
- "name": "assets.db",
- "type": 0,
- "fileSize": 23278,
- "lastModified": 1769570293,
+ "guid": "986b148c-b4ea-cf89-2e04-37dc26624976",
+ "path": "F:\\microes\\assets\\textures\\particle.png",
+ "name": "particle.png",
+ "type": 2,
+ "fileSize": 0,
+ "lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "d0e72f1c-981f-5995-dade-848b8b18813e",
- "path": "assets\\textures\\background.png",
- "name": "background.png",
+ "guid": "234c30b6-359c-51c1-a526-a970984ad90a",
+ "path": "F:\\microes\\assets\\textures\\enemy.png",
+ "name": "enemy.png",
"type": 2,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "83d5664f-9f0b-4687-73b2-b854c5e6d5cf",
- "path": "assets\\fonts",
- "name": "fonts",
- "type": 1,
+ "guid": "4b48ff38-aeb0-7a1b-38ec-03ad938736e9",
+ "path": "F:\\microes\\assets\\shaders\\sprite.glsl",
+ "name": "sprite.glsl",
+ "type": 5,
"fileSize": 0,
- "lastModified": 1769501795,
- "isDirectory": true
+ "lastModified": 1769503002,
+ "isDirectory": false
},
{
- "guid": "ca89cb26-11ee-a95a-940a-4d952d33b936",
- "path": "F:\\microes\\assets\\scenes\\MainMenu.scene",
- "name": "MainMenu.scene",
- "type": 6,
- "fileSize": 0,
- "lastModified": 1769503001,
+ "guid": "3750f28c-b12f-4245-2036-9c552be15aea",
+ "path": "F:\\microes\\assets\\fonts\\lucide.ttf",
+ "name": "lucide.ttf",
+ "type": 8,
+ "fileSize": 793848,
+ "lastModified": 1769501796,
"isDirectory": false
},
{
- "guid": "602e5d05-e6b5-3cbe-a3a4-857b4290f255",
- "path": "assets\\scripts\\CameraFollow.js",
- "name": "CameraFollow.js",
+ "guid": "6837963f-192a-0bcb-80e2-1cb45a8e35e7",
+ "path": "assets\\scripts\\PlayerController.js",
+ "name": "PlayerController.js",
"type": 4,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "0dd456da-eb9c-cdac-c429-b918b2f78b00",
- "path": "F:\\microes\\assets\\shaders\\particle.glsl",
- "name": "particle.glsl",
- "type": 5,
- "fileSize": 0,
- "lastModified": 1769503001,
+ "guid": "a9993ed8-9802-fb1c-f5e4-15864011fa2c",
+ "path": "F:\\microes\\assets\\textures\\test.png",
+ "name": "test.png",
+ "type": 2,
+ "fileSize": 6,
+ "lastModified": 1769488062,
"isDirectory": false
},
{
- "guid": "86ed9e0d-442c-a047-9b51-09011c881685",
- "path": "assets\\audio",
- "name": "audio",
- "type": 1,
+ "guid": "458ea613-0ce1-0325-3f9c-9f6937eafacf",
+ "path": "assets\\prefabs\\Player.prefab",
+ "name": "Player.prefab",
+ "type": 7,
"fileSize": 0,
"lastModified": 1769503001,
- "isDirectory": true
+ "isDirectory": false
},
{
- "guid": "bbbdbf23-cecf-5053-0ebe-f3daf5b9e103",
- "path": "assets\\prefabs\\Explosion.prefab",
- "name": "Explosion.prefab",
+ "guid": "6f4b1d08-8b77-b7eb-629d-c2ea4efba441",
+ "path": "F:\\microes\\assets\\prefabs\\Coin.prefab",
+ "name": "Coin.prefab",
"type": 7,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "0f5a7d56-b021-7cfe-9ffd-b6deba57b565",
- "path": "assets\\textures\\ui_panel.png",
- "name": "ui_panel.png",
- "type": 2,
+ "guid": "88f4512c-08fc-7521-0720-aa75e35defbc",
+ "path": "assets\\audio\\bgm_main.mp3",
+ "name": "bgm_main.mp3",
+ "type": 3,
"fileSize": 0,
"lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "0926ee8f-8eef-58fa-8d75-0ac49a8bf2b1",
- "path": "F:\\microes\\assets\\scenes",
- "name": "scenes",
+ "guid": "9d4aa6d5-4f32-3634-e6fa-2c79467a2a9c",
+ "path": "F:\\microes\\assets\\shaders",
+ "name": "shaders",
"type": 1,
"fileSize": 0,
"lastModified": 1769503001,
"isDirectory": true
},
{
- "guid": "ab8960b7-4b05-8029-7577-571c44b9c394",
- "path": "F:\\microes\\assets\\fonts",
- "name": "fonts",
- "type": 1,
+ "guid": "22bdfe10-0ff6-620f-56ec-26a8142aec33",
+ "path": "assets\\textures\\skybox.png",
+ "name": "skybox.png",
+ "type": 2,
"fileSize": 0,
- "lastModified": 1769511858,
- "isDirectory": true
+ "lastModified": 1769503001,
+ "isDirectory": false
},
{
- "guid": "ce69c963-c0ea-0fb2-c96c-bf1afc0e0802",
- "path": "assets\\shaders\\postprocess.glsl",
- "name": "postprocess.glsl",
- "type": 5,
+ "guid": "090ed68c-0dbe-382c-e163-5ad3bc22abad",
+ "path": "F:\\microes\\assets\\scenes\\Level1.scene",
+ "name": "Level1.scene",
+ "type": 6,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "f29a2ee0-016a-f018-436a-9c11731f251a",
- "path": "F:\\microes\\assets\\scripts\\Inventory.js",
- "name": "Inventory.js",
- "type": 4,
+ "guid": "d44064b6-5cd8-29c4-8dc3-e6f0b71c6ad1",
+ "path": "F:\\microes\\assets\\textures\\ui_panel.png",
+ "name": "ui_panel.png",
+ "type": 2,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "d3d9a556-8861-fbc2-504a-151ef73f41de",
- "path": "F:\\microes\\assets\\textures\\player.png",
- "name": "player.png",
- "type": 2,
+ "guid": "38633421-fb34-4766-58e7-b4ba7c8b5ee3",
+ "path": "assets\\audio\\sfx_explosion.wav",
+ "name": "sfx_explosion.wav",
+ "type": 3,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "49fa3441-7d74-bf79-c116-717b849b78ce",
- "path": "F:\\microes\\assets\\prefabs\\Player.prefab",
- "name": "Player.prefab",
- "type": 7,
+ "guid": "02f457d5-e200-7f62-6850-7612ed829a63",
+ "path": "assets\\scenes\\BossRoom.scene",
+ "name": "BossRoom.scene",
+ "type": 6,
"fileSize": 0,
- "lastModified": 1769503001,
+ "lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "22bdfe10-0ff6-620f-56ec-26a8142aec33",
- "path": "assets\\textures\\skybox.png",
- "name": "skybox.png",
- "type": 2,
+ "guid": "b162bd84-eee3-1b79-807c-c64d2c64cb2b",
+ "path": "F:\\microes\\assets\\scripts\\PlayerController.js",
+ "name": "PlayerController.js",
+ "type": 4,
"fileSize": 0,
- "lastModified": 1769503001,
+ "lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "090ed68c-0dbe-382c-e163-5ad3bc22abad",
- "path": "F:\\microes\\assets\\scenes\\Level1.scene",
- "name": "Level1.scene",
- "type": 6,
- "fileSize": 0,
- "lastModified": 1769503002,
+ "guid": "a19bf5bf-7a78-8cbd-00c8-8f38cf141628",
+ "path": "F:\\microes\\assets\\fonts\\msyh.ttc",
+ "name": "msyh.ttc",
+ "type": 0,
+ "fileSize": 19704352,
+ "lastModified": 1769511858,
"isDirectory": false
},
{
- "guid": "08964537-6809-2c47-8997-7bbf1c75029f",
- "path": "assets\\scripts",
- "name": "scripts",
- "type": 1,
+ "guid": "c771ea16-ad7f-3333-df52-9426cff8a384",
+ "path": "assets\\textures\\ui_button.png",
+ "name": "ui_button.png",
+ "type": 2,
"fileSize": 0,
"lastModified": 1769503002,
- "isDirectory": true
+ "isDirectory": false
},
{
- "guid": "ed1cf9a5-9d96-50d7-e385-82c605f70a63",
- "path": "F:\\microes\\assets\\prefabs\\Explosion.prefab",
- "name": "Explosion.prefab",
- "type": 7,
+ "guid": "602e5d05-e6b5-3cbe-a3a4-857b4290f255",
+ "path": "assets\\scripts\\CameraFollow.js",
+ "name": "CameraFollow.js",
+ "type": 4,
"fileSize": 0,
- "lastModified": 1769503001,
+ "lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "8af759e0-a053-8e8c-1e34-48843f734d2f",
- "path": "assets\\textures\\enemy.png",
- "name": "enemy.png",
- "type": 2,
+ "guid": "ca89cb26-11ee-a95a-940a-4d952d33b936",
+ "path": "F:\\microes\\assets\\scenes\\MainMenu.scene",
+ "name": "MainMenu.scene",
+ "type": 6,
"fileSize": 0,
"lastModified": 1769503002,
"isDirectory": false
},
{
- "guid": "a638dc81-b60d-567f-6820-13f4e9998407",
- "path": "assets\\.esengine\\assets.db",
- "name": "assets.db",
- "type": 0,
- "fileSize": 2186,
- "lastModified": 1769502460,
+ "guid": "ce792685-9959-2c9f-d909-597cab98305a",
+ "path": "F:\\microes\\assets\\fonts\\lucide_new.ttf",
+ "name": "lucide_new.ttf",
+ "type": 8,
+ "fileSize": 793848,
+ "lastModified": 1769653162,
"isDirectory": false
},
{
- "guid": "e19fb621-dd86-3c0c-6b10-142a848c6a14",
- "path": "assets\\audio\\sfx_jump.wav",
- "name": "sfx_jump.wav",
- "type": 3,
+ "guid": "539c3218-76fb-bed8-1442-3c43ae5be464",
+ "path": "F:\\microes\\assets\\textures\\tileset.png",
+ "name": "tileset.png",
+ "type": 2,
"fileSize": 0,
- "lastModified": 1769503002,
+ "lastModified": 1769503001,
"isDirectory": false
},
{
- "guid": "cf70754c-26ba-346d-c01d-ff9fc29a6e9e",
- "path": "assets\\.esengine",
- "name": ".esengine",
- "type": 1,
+ "guid": "fb6e1999-a210-5293-9dc9-f648e6e8fc1f",
+ "path": "assets\\shaders\\sprite.glsl",
+ "name": "sprite.glsl",
+ "type": 5,
"fileSize": 0,
- "lastModified": 1769495857,
- "isDirectory": true
+ "lastModified": 1769503002,
+ "isDirectory": false
}
]
}
diff --git a/assets/fonts/lucide_new.ttf b/assets/fonts/lucide_new.ttf
new file mode 100644
index 000000000..72c0bf60b
Binary files /dev/null and b/assets/fonts/lucide_new.ttf differ
diff --git a/src/esengine/core/CrashHandler.cpp b/src/esengine/core/CrashHandler.cpp
deleted file mode 100644
index 9e10206e1..000000000
--- a/src/esengine/core/CrashHandler.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/**
- * @file CrashHandler.cpp
- * @brief Crash handling implementation
- *
- * @author ESEngine Team
- * @date 2026
- *
- * @copyright Copyright (c) 2026 ESEngine Team
- * Licensed under the MIT License.
- */
-
-#include "CrashHandler.hpp"
-#include "Log.hpp"
-
-#include <cstdio>
-#include <cstdlib>
-#include <csignal>
-
-#ifdef ES_PLATFORM_WINDOWS
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#include <dbghelp.h>
-#pragma comment(lib, "dbghelp.lib")
-#endif
-
-namespace esengine {
-
-std::string CrashHandler::app_name_ = "ESEngine";
-
-// =============================================================================
-// Windows Implementation
-// =============================================================================
-
-#ifdef ES_PLATFORM_WINDOWS
-
-static std::string getExceptionCodeString(DWORD code) {
- switch (code) {
- case EXCEPTION_ACCESS_VIOLATION:
- return "Access Violation (EXCEPTION_ACCESS_VIOLATION)";
- case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
- return "Array Bounds Exceeded (EXCEPTION_ARRAY_BOUNDS_EXCEEDED)";
- case EXCEPTION_BREAKPOINT:
- return "Breakpoint (EXCEPTION_BREAKPOINT)";
- case EXCEPTION_DATATYPE_MISALIGNMENT:
- return "Datatype Misalignment (EXCEPTION_DATATYPE_MISALIGNMENT)";
- case EXCEPTION_FLT_DENORMAL_OPERAND:
- return "Float Denormal Operand (EXCEPTION_FLT_DENORMAL_OPERAND)";
- case EXCEPTION_FLT_DIVIDE_BY_ZERO:
- return "Float Divide By Zero (EXCEPTION_FLT_DIVIDE_BY_ZERO)";
- case EXCEPTION_FLT_INEXACT_RESULT:
- return "Float Inexact Result (EXCEPTION_FLT_INEXACT_RESULT)";
- case EXCEPTION_FLT_INVALID_OPERATION:
- return "Float Invalid Operation (EXCEPTION_FLT_INVALID_OPERATION)";
- case EXCEPTION_FLT_OVERFLOW:
- return "Float Overflow (EXCEPTION_FLT_OVERFLOW)";
- case EXCEPTION_FLT_STACK_CHECK:
- return "Float Stack Check (EXCEPTION_FLT_STACK_CHECK)";
- case EXCEPTION_FLT_UNDERFLOW:
- return "Float Underflow (EXCEPTION_FLT_UNDERFLOW)";
- case EXCEPTION_ILLEGAL_INSTRUCTION:
- return "Illegal Instruction (EXCEPTION_ILLEGAL_INSTRUCTION)";
- case EXCEPTION_IN_PAGE_ERROR:
- return "In Page Error (EXCEPTION_IN_PAGE_ERROR)";
- case EXCEPTION_INT_DIVIDE_BY_ZERO:
- return "Integer Divide By Zero (EXCEPTION_INT_DIVIDE_BY_ZERO)";
- case EXCEPTION_INT_OVERFLOW:
- return "Integer Overflow (EXCEPTION_INT_OVERFLOW)";
- case EXCEPTION_INVALID_DISPOSITION:
- return "Invalid Disposition (EXCEPTION_INVALID_DISPOSITION)";
- case EXCEPTION_NONCONTINUABLE_EXCEPTION:
- return "Noncontinuable Exception (EXCEPTION_NONCONTINUABLE_EXCEPTION)";
- case EXCEPTION_PRIV_INSTRUCTION:
- return "Privileged Instruction (EXCEPTION_PRIV_INSTRUCTION)";
- case EXCEPTION_SINGLE_STEP:
- return "Single Step (EXCEPTION_SINGLE_STEP)";
- case EXCEPTION_STACK_OVERFLOW:
- return "Stack Overflow (EXCEPTION_STACK_OVERFLOW)";
- default:
- return "Unknown Exception (0x" + std::to_string(code) + ")";
- }
-}
-
-static std::string captureStackTrace(CONTEXT* context) {
- std::string result;
-
- HANDLE process = GetCurrentProcess();
- HANDLE thread = GetCurrentThread();
-
- SymInitialize(process, NULL, TRUE);
-
- STACKFRAME64 stackFrame = {};
-#ifdef _M_X64
- DWORD machineType = IMAGE_FILE_MACHINE_AMD64;
- stackFrame.AddrPC.Offset = context->Rip;
- stackFrame.AddrPC.Mode = AddrModeFlat;
- stackFrame.AddrFrame.Offset = context->Rbp;
- stackFrame.AddrFrame.Mode = AddrModeFlat;
- stackFrame.AddrStack.Offset = context->Rsp;
- stackFrame.AddrStack.Mode = AddrModeFlat;
-#else
- DWORD machineType = IMAGE_FILE_MACHINE_I386;
- stackFrame.AddrPC.Offset = context->Eip;
- stackFrame.AddrPC.Mode = AddrModeFlat;
- stackFrame.AddrFrame.Offset = context->Ebp;
- stackFrame.AddrFrame.Mode = AddrModeFlat;
- stackFrame.AddrStack.Offset = context->Esp;
- stackFrame.AddrStack.Mode = AddrModeFlat;
-#endif
-
- char symbolBuffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
- PSYMBOL_INFO symbol = (PSYMBOL_INFO)symbolBuffer;
- symbol->SizeOfStruct = sizeof(SYMBOL_INFO);
- symbol->MaxNameLen = MAX_SYM_NAME;
-
- int frameCount = 0;
- const int maxFrames = 32;
-
- while (frameCount < maxFrames) {
- if (!StackWalk64(machineType, process, thread, &stackFrame, context,
- NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL)) {
- break;
- }
-
- if (stackFrame.AddrPC.Offset == 0) {
- break;
- }
-
- DWORD64 displacement = 0;
- char frameLine[512];
-
- if (SymFromAddr(process, stackFrame.AddrPC.Offset, &displacement, symbol)) {
- IMAGEHLP_LINE64 line = {};
- line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
- DWORD lineDisplacement = 0;
-
- if (SymGetLineFromAddr64(process, stackFrame.AddrPC.Offset,
- &lineDisplacement, &line)) {
- snprintf(frameLine, sizeof(frameLine), " [%d] %s (%s:%lu)\n",
- frameCount, symbol->Name, line.FileName, line.LineNumber);
- } else {
- snprintf(frameLine, sizeof(frameLine), " [%d] %s + 0x%llx\n",
- frameCount, symbol->Name, displacement);
- }
- } else {
- snprintf(frameLine, sizeof(frameLine), " [%d] 0x%llx\n",
- frameCount, stackFrame.AddrPC.Offset);
- }
-
- result += frameLine;
- frameCount++;
- }
-
- SymCleanup(process);
-
- if (result.empty()) {
- result = " (Unable to capture stack trace)\n";
- }
-
- return result;
-}
-
-static LONG WINAPI unhandledExceptionFilter(EXCEPTION_POINTERS* exceptionInfo) {
- std::string errorType = getExceptionCodeString(exceptionInfo->ExceptionRecord->ExceptionCode);
-
- std::string stackTrace = captureStackTrace(exceptionInfo->ContextRecord);
-
- std::string message = CrashHandler::getAppName() + " has crashed!\n\n";
- message += "Error: " + errorType + "\n";
- message += "Address: 0x" + std::to_string((uintptr_t)exceptionInfo->ExceptionRecord->ExceptionAddress) + "\n\n";
- message += "Stack Trace:\n" + stackTrace;
- message += "\nThe application will now close.";
-
- ES_LOG_FATAL("CRASH: {}", errorType);
- ES_LOG_FATAL("Stack Trace:\n{}", stackTrace);
-
- MessageBoxA(NULL, message.c_str(), "Application Crash", MB_OK | MB_ICONERROR);
-
- return EXCEPTION_EXECUTE_HANDLER;
-}
-
-static void signalHandler(int signal) {
- const char* signalName = "Unknown";
- switch (signal) {
- case SIGABRT: signalName = "SIGABRT (Abort)"; break;
- case SIGFPE: signalName = "SIGFPE (Floating Point Exception)"; break;
- case SIGILL: signalName = "SIGILL (Illegal Instruction)"; break;
- case SIGSEGV: signalName = "SIGSEGV (Segmentation Fault)"; break;
- }
-
- std::string message = CrashHandler::getAppName() + " has crashed!\n\n";
- message += "Signal: ";
- message += signalName;
- message += "\n\nThe application will now close.";
-
- ES_LOG_FATAL("CRASH: Signal {}", signalName);
-
- MessageBoxA(NULL, message.c_str(), "Application Crash", MB_OK | MB_ICONERROR);
-
- std::_Exit(1);
-}
-
-void CrashHandler::init() {
- SetUnhandledExceptionFilter(unhandledExceptionFilter);
-
- signal(SIGABRT, signalHandler);
- signal(SIGFPE, signalHandler);
- signal(SIGILL, signalHandler);
- signal(SIGSEGV, signalHandler);
-
- ES_LOG_INFO("CrashHandler initialized");
-}
-
-void CrashHandler::shutdown() {
- SetUnhandledExceptionFilter(NULL);
-
- signal(SIGABRT, SIG_DFL);
- signal(SIGFPE, SIG_DFL);
- signal(SIGILL, SIG_DFL);
- signal(SIGSEGV, SIG_DFL);
-}
-
-void CrashHandler::setAppName(const std::string& name) {
- app_name_ = name;
-}
-
-// =============================================================================
-// Other Platforms (Stub)
-// =============================================================================
-
-#else
-
-void CrashHandler::init() {
- ES_LOG_INFO("CrashHandler: Not implemented for this platform");
-}
-
-void CrashHandler::shutdown() {
-}
-
-void CrashHandler::setAppName(const std::string& name) {
- app_name_ = name;
-}
-
-#endif
-
-} // namespace esengine
diff --git a/src/esengine/core/CrashHandler.hpp b/src/esengine/core/CrashHandler.hpp
deleted file mode 100644
index 73126f1cb..000000000
--- a/src/esengine/core/CrashHandler.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * @file CrashHandler.hpp
- * @brief Crash handling and reporting utilities
- * @details Captures unhandled exceptions and displays error information
- * before the application terminates.
- *
- * @author ESEngine Team
- * @date 2026
- *
- * @copyright Copyright (c) 2026 ESEngine Team
- * Licensed under the MIT License.
- */
-#pragma once
-
-#include <string>
-
-namespace esengine {
-
-// =============================================================================
-// CrashHandler
-// =============================================================================
-
-class CrashHandler {
-public:
- static void init();
- static void shutdown();
-
- static void setAppName(const std::string& name);
- static const std::string& getAppName() { return app_name_; }
-
-private:
- static std::string app_name_;
-
-#ifdef _WIN32
- friend long __stdcall unhandledExceptionFilterImpl(void*);
-#endif
- friend void signalHandlerImpl(int);
-};
-
-} // namespace esengine
diff --git a/src/esengine/editor/main.cpp b/src/esengine/editor/main.cpp
index bc66eb71c..08ff98983 100644
--- a/src/esengine/editor/main.cpp
+++ b/src/esengine/editor/main.cpp
@@ -11,16 +11,8 @@
#include "EditorApplication.hpp"
#include "../core/Log.hpp"
-#include "../core/CrashHandler.hpp"
-/**
- * @brief Editor application entry point
- * @return Exit code (0 on success)
- */
int main() {
- esengine::CrashHandler::init();
- esengine::CrashHandler::setAppName("ESEngine Editor");
-
esengine::Log::init();
ES_LOG_INFO("Starting ESEngine Editor...");
@@ -30,6 +22,5 @@ int main() {
ES_LOG_INFO("ESEngine Editor exited");
- esengine::CrashHandler::shutdown();
return 0;
}
diff --git a/src/esengine/editor/property/editors/BoolEditor.cpp b/src/esengine/editor/property/editors/BoolEditor.cpp
index d8bab897b..6af5bc46a 100644
--- a/src/esengine/editor/property/editors/BoolEditor.cpp
+++ b/src/esengine/editor/property/editors/BoolEditor.cpp
@@ -88,17 +88,14 @@ glm::vec2 BoolEditor::measure(f32 availableWidth, f32 availableHeight) {
return glm::vec2(width, height);
}
-void BoolEditor::render(ui::UIBatchRenderer& renderer) {
- const ui::Rect& bounds = getBounds();
- f32 x = bounds.x;
+void BoolEditor::layout(const ui::Rect& bounds) {
+ Widget::layout(bounds);
- constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
+ f32 x = bounds.x;
if (labelWidget_ && showLabel_) {
- labelWidget_->setColor(labelColor);
ui::Rect labelBounds{x, bounds.y, LABEL_WIDTH, bounds.height};
labelWidget_->layout(labelBounds);
- labelWidget_->renderTree(renderer);
x += LABEL_WIDTH + SPACING;
}
@@ -106,6 +103,18 @@ void BoolEditor::render(ui::UIBatchRenderer& renderer) {
f32 checkboxY = bounds.y + (bounds.height - CHECKBOX_SIZE) * 0.5f;
ui::Rect checkboxBounds{x, checkboxY, CHECKBOX_SIZE, CHECKBOX_SIZE};
checkbox_->layout(checkboxBounds);
+ }
+}
+
+void BoolEditor::render(ui::UIBatchRenderer& renderer) {
+ constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
+
+ if (labelWidget_ && showLabel_) {
+ labelWidget_->setColor(labelColor);
+ labelWidget_->renderTree(renderer);
+ }
+
+ if (checkbox_) {
checkbox_->renderTree(renderer);
}
}
diff --git a/src/esengine/editor/property/editors/BoolEditor.hpp b/src/esengine/editor/property/editors/BoolEditor.hpp
index 0470caa35..cf62e398d 100644
--- a/src/esengine/editor/property/editors/BoolEditor.hpp
+++ b/src/esengine/editor/property/editors/BoolEditor.hpp
@@ -35,6 +35,7 @@ public:
std::any getValue() const override;
glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
+ void layout(const ui::Rect& bounds) override;
void render(ui::UIBatchRenderer& renderer) override;
protected:
diff --git a/src/esengine/editor/property/editors/ColorEditor.cpp b/src/esengine/editor/property/editors/ColorEditor.cpp
index 7256d35e9..45a9f8d6e 100644
--- a/src/esengine/editor/property/editors/ColorEditor.cpp
+++ b/src/esengine/editor/property/editors/ColorEditor.cpp
@@ -151,93 +151,122 @@ glm::vec2 ColorEditor::measure(f32 availableWidth, f32 availableHeight) {
return glm::vec2(width, height);
}
-void ColorEditor::render(ui::UIBatchRenderer& renderer) {
- const ui::Rect& bounds = getBounds();
+void ColorEditor::layout(const ui::Rect& bounds) {
+ Widget::layout(bounds);
+
f32 x = bounds.x;
f32 y = bounds.y;
- constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
- constexpr glm::vec4 rColor{0.9f, 0.4f, 0.4f, 1.0f};
- constexpr glm::vec4 gColor{0.4f, 0.9f, 0.4f, 1.0f};
- constexpr glm::vec4 bColor{0.4f, 0.6f, 0.9f, 1.0f};
- constexpr glm::vec4 aColor{0.7f, 0.7f, 0.7f, 1.0f};
-
if (mainLabel_ && showLabel_) {
- mainLabel_->setColor(labelColor);
ui::Rect labelBounds{x, y, MAIN_LABEL_WIDTH, ROW_HEIGHT};
mainLabel_->layout(labelBounds);
- mainLabel_->renderTree(renderer);
x += MAIN_LABEL_WIDTH + SPACING;
}
if (colorPreview_) {
- colorPreview_->setBackgroundColor(value_);
ui::Rect previewBounds{x, y, COLOR_PREVIEW_SIZE, ROW_HEIGHT * 2.0f + SPACING};
colorPreview_->layout(previewBounds);
- colorPreview_->renderTree(renderer);
x += COLOR_PREVIEW_SIZE + SPACING;
}
f32 rowX = x;
if (rLabel_) {
- rLabel_->setColor(rColor);
ui::Rect labelBounds{rowX, y, COMPONENT_LABEL_WIDTH, ROW_HEIGHT};
rLabel_->layout(labelBounds);
- rLabel_->renderTree(renderer);
rowX += COMPONENT_LABEL_WIDTH + SPACING;
}
if (rEditor_) {
ui::Rect editorBounds{rowX, y, FLOAT_EDITOR_WIDTH, ROW_HEIGHT};
rEditor_->layout(editorBounds);
- rEditor_->renderTree(renderer);
rowX += FLOAT_EDITOR_WIDTH + SPACING;
}
if (gLabel_) {
- gLabel_->setColor(gColor);
ui::Rect labelBounds{rowX, y, COMPONENT_LABEL_WIDTH, ROW_HEIGHT};
gLabel_->layout(labelBounds);
- gLabel_->renderTree(renderer);
rowX += COMPONENT_LABEL_WIDTH + SPACING;
}
if (gEditor_) {
ui::Rect editorBounds{rowX, y, FLOAT_EDITOR_WIDTH, ROW_HEIGHT};
gEditor_->layout(editorBounds);
- gEditor_->renderTree(renderer);
}
y += ROW_HEIGHT + SPACING;
rowX = x;
if (bLabel_) {
- bLabel_->setColor(bColor);
ui::Rect labelBounds{rowX, y, COMPONENT_LABEL_WIDTH, ROW_HEIGHT};
bLabel_->layout(labelBounds);
- bLabel_->renderTree(renderer);
rowX += COMPONENT_LABEL_WIDTH + SPACING;
}
if (bEditor_) {
ui::Rect editorBounds{rowX, y, FLOAT_EDITOR_WIDTH, ROW_HEIGHT};
bEditor_->layout(editorBounds);
- bEditor_->renderTree(renderer);
rowX += FLOAT_EDITOR_WIDTH + SPACING;
}
if (aLabel_) {
- aLabel_->setColor(aColor);
ui::Rect labelBounds{rowX, y, COMPONENT_LABEL_WIDTH, ROW_HEIGHT};
aLabel_->layout(labelBounds);
- aLabel_->renderTree(renderer);
rowX += COMPONENT_LABEL_WIDTH + SPACING;
}
if (aEditor_) {
ui::Rect editorBounds{rowX, y, FLOAT_EDITOR_WIDTH, ROW_HEIGHT};
aEditor_->layout(editorBounds);
+ }
+}
+
+void ColorEditor::render(ui::UIBatchRenderer& renderer) {
+ constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
+ constexpr glm::vec4 rColor{0.9f, 0.4f, 0.4f, 1.0f};
+ constexpr glm::vec4 gColor{0.4f, 0.9f, 0.4f, 1.0f};
+ constexpr glm::vec4 bColor{0.4f, 0.6f, 0.9f, 1.0f};
+ constexpr glm::vec4 aColor{0.7f, 0.7f, 0.7f, 1.0f};
+
+ if (mainLabel_ && showLabel_) {
+ mainLabel_->setColor(labelColor);
+ mainLabel_->renderTree(renderer);
+ }
+
+ if (colorPreview_) {
+ colorPreview_->setBackgroundColor(value_);
+ colorPreview_->renderTree(renderer);
+ }
+
+ if (rLabel_) {
+ rLabel_->setColor(rColor);
+ rLabel_->renderTree(renderer);
+ }
+ if (rEditor_) {
+ rEditor_->renderTree(renderer);
+ }
+
+ if (gLabel_) {
+ gLabel_->setColor(gColor);
+ gLabel_->renderTree(renderer);
+ }
+ if (gEditor_) {
+ gEditor_->renderTree(renderer);
+ }
+
+ if (bLabel_) {
+ bLabel_->setColor(bColor);
+ bLabel_->renderTree(renderer);
+ }
+ if (bEditor_) {
+ bEditor_->renderTree(renderer);
+ }
+
+ if (aLabel_) {
+ aLabel_->setColor(aColor);
+ aLabel_->renderTree(renderer);
+ }
+ if (aEditor_) {
aEditor_->renderTree(renderer);
}
}
diff --git a/src/esengine/editor/property/editors/ColorEditor.hpp b/src/esengine/editor/property/editors/ColorEditor.hpp
index cfb1d008c..8c9b7326d 100644
--- a/src/esengine/editor/property/editors/ColorEditor.hpp
+++ b/src/esengine/editor/property/editors/ColorEditor.hpp
@@ -38,6 +38,7 @@ public:
std::any getValue() const override;
glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
+ void layout(const ui::Rect& bounds) override;
void render(ui::UIBatchRenderer& renderer) override;
protected:
diff --git a/src/esengine/editor/property/editors/EnumEditor.cpp b/src/esengine/editor/property/editors/EnumEditor.cpp
index d718d9fe8..5f350c559 100644
--- a/src/esengine/editor/property/editors/EnumEditor.cpp
+++ b/src/esengine/editor/property/editors/EnumEditor.cpp
@@ -120,18 +120,15 @@ glm::vec2 EnumEditor::measure(f32 availableWidth, f32 availableHeight) {
return glm::vec2(width, height);
}
-void EnumEditor::render(ui::UIBatchRenderer& renderer) {
- const ui::Rect& bounds = getBounds();
+void EnumEditor::layout(const ui::Rect& bounds) {
+ Widget::layout(bounds);
+
f32 x = bounds.x;
f32 remainingWidth = bounds.width;
- constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
-
if (labelWidget_ && showLabel_) {
- labelWidget_->setColor(labelColor);
ui::Rect labelBounds{x, bounds.y, LABEL_WIDTH, bounds.height};
labelWidget_->layout(labelBounds);
- labelWidget_->renderTree(renderer);
x += LABEL_WIDTH + SPACING;
remainingWidth -= LABEL_WIDTH + SPACING;
}
@@ -139,6 +136,18 @@ void EnumEditor::render(ui::UIBatchRenderer& renderer) {
if (dropdown_) {
ui::Rect dropdownBounds{x, bounds.y, remainingWidth, bounds.height};
dropdown_->layout(dropdownBounds);
+ }
+}
+
+void EnumEditor::render(ui::UIBatchRenderer& renderer) {
+ constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
+
+ if (labelWidget_ && showLabel_) {
+ labelWidget_->setColor(labelColor);
+ labelWidget_->renderTree(renderer);
+ }
+
+ if (dropdown_) {
dropdown_->renderTree(renderer);
}
}
diff --git a/src/esengine/editor/property/editors/EnumEditor.hpp b/src/esengine/editor/property/editors/EnumEditor.hpp
index 45b9ff60d..5b9025ef2 100644
--- a/src/esengine/editor/property/editors/EnumEditor.hpp
+++ b/src/esengine/editor/property/editors/EnumEditor.hpp
@@ -84,6 +84,7 @@ public:
// =========================================================================
glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
+ void layout(const ui::Rect& bounds) override;
void render(ui::UIBatchRenderer& renderer) override;
protected:
diff --git a/src/esengine/editor/property/editors/FloatEditor.cpp b/src/esengine/editor/property/editors/FloatEditor.cpp
index ff4cd0feb..30b81dd03 100644
--- a/src/esengine/editor/property/editors/FloatEditor.cpp
+++ b/src/esengine/editor/property/editors/FloatEditor.cpp
@@ -153,18 +153,15 @@ glm::vec2 FloatEditor::measure(f32 availableWidth, f32 availableHeight) {
return glm::vec2(width, height);
}
-void FloatEditor::render(ui::UIBatchRenderer& renderer) {
- const ui::Rect& bounds = getBounds();
+void FloatEditor::layout(const ui::Rect& bounds) {
+ Widget::layout(bounds);
+
f32 x = bounds.x;
f32 remainingWidth = bounds.width;
- constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
-
if (labelWidget_ && showLabel_) {
- labelWidget_->setColor(labelColor);
ui::Rect labelBounds{x, bounds.y, LABEL_WIDTH, bounds.height};
labelWidget_->layout(labelBounds);
- labelWidget_->renderTree(renderer);
x += LABEL_WIDTH + SPACING;
remainingWidth -= LABEL_WIDTH + SPACING;
}
@@ -176,7 +173,6 @@ void FloatEditor::render(ui::UIBatchRenderer& renderer) {
}
ui::Rect textBounds{x, bounds.y, textFieldWidth, bounds.height};
textField_->layout(textBounds);
- textField_->renderTree(renderer);
x += textFieldWidth;
}
@@ -185,6 +181,22 @@ void FloatEditor::render(ui::UIBatchRenderer& renderer) {
f32 sliderWidth = bounds.x + bounds.width - x;
ui::Rect sliderBounds{x, bounds.y, sliderWidth, bounds.height};
slider_->layout(sliderBounds);
+ }
+}
+
+void FloatEditor::render(ui::UIBatchRenderer& renderer) {
+ constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
+
+ if (labelWidget_ && showLabel_) {
+ labelWidget_->setColor(labelColor);
+ labelWidget_->renderTree(renderer);
+ }
+
+ if (textField_) {
+ textField_->renderTree(renderer);
+ }
+
+ if (slider_ && showSlider_) {
slider_->renderTree(renderer);
}
}
diff --git a/src/esengine/editor/property/editors/FloatEditor.hpp b/src/esengine/editor/property/editors/FloatEditor.hpp
index 199bcf631..4cb2a3ca0 100644
--- a/src/esengine/editor/property/editors/FloatEditor.hpp
+++ b/src/esengine/editor/property/editors/FloatEditor.hpp
@@ -119,6 +119,7 @@ public:
// =========================================================================
glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
+ void layout(const ui::Rect& bounds) override;
void render(ui::UIBatchRenderer& renderer) override;
protected:
diff --git a/src/esengine/editor/property/editors/IntEditor.cpp b/src/esengine/editor/property/editors/IntEditor.cpp
index 8c7def330..f1850deaa 100644
--- a/src/esengine/editor/property/editors/IntEditor.cpp
+++ b/src/esengine/editor/property/editors/IntEditor.cpp
@@ -138,18 +138,15 @@ glm::vec2 IntEditor::measure(f32 availableWidth, f32 availableHeight) {
return glm::vec2(width, height);
}
-void IntEditor::render(ui::UIBatchRenderer& renderer) {
- const ui::Rect& bounds = getBounds();
+void IntEditor::layout(const ui::Rect& bounds) {
+ Widget::layout(bounds);
+
f32 x = bounds.x;
f32 remainingWidth = bounds.width;
- constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
-
if (labelWidget_ && showLabel_) {
- labelWidget_->setColor(labelColor);
ui::Rect labelBounds{x, bounds.y, LABEL_WIDTH, bounds.height};
labelWidget_->layout(labelBounds);
- labelWidget_->renderTree(renderer);
x += LABEL_WIDTH + SPACING;
remainingWidth -= LABEL_WIDTH + SPACING;
}
@@ -161,7 +158,6 @@ void IntEditor::render(ui::UIBatchRenderer& renderer) {
}
ui::Rect textBounds{x, bounds.y, textFieldWidth, bounds.height};
textField_->layout(textBounds);
- textField_->renderTree(renderer);
x += textFieldWidth;
}
@@ -170,6 +166,22 @@ void IntEditor::render(ui::UIBatchRenderer& renderer) {
f32 sliderWidth = bounds.x + bounds.width - x;
ui::Rect sliderBounds{x, bounds.y, sliderWidth, bounds.height};
slider_->layout(sliderBounds);
+ }
+}
+
+void IntEditor::render(ui::UIBatchRenderer& renderer) {
+ constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
+
+ if (labelWidget_ && showLabel_) {
+ labelWidget_->setColor(labelColor);
+ labelWidget_->renderTree(renderer);
+ }
+
+ if (textField_) {
+ textField_->renderTree(renderer);
+ }
+
+ if (slider_ && showSlider_) {
slider_->renderTree(renderer);
}
}
diff --git a/src/esengine/editor/property/editors/IntEditor.hpp b/src/esengine/editor/property/editors/IntEditor.hpp
index e3cadb9b5..e3429b565 100644
--- a/src/esengine/editor/property/editors/IntEditor.hpp
+++ b/src/esengine/editor/property/editors/IntEditor.hpp
@@ -43,6 +43,7 @@ public:
bool getShowSlider() const { return showSlider_; }
glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
+ void layout(const ui::Rect& bounds) override;
void render(ui::UIBatchRenderer& renderer) override;
protected:
diff --git a/src/esengine/editor/property/editors/StringEditor.cpp b/src/esengine/editor/property/editors/StringEditor.cpp
index e45bd48bc..23f001822 100644
--- a/src/esengine/editor/property/editors/StringEditor.cpp
+++ b/src/esengine/editor/property/editors/StringEditor.cpp
@@ -102,17 +102,14 @@ glm::vec2 StringEditor::measure(f32 availableWidth, f32 availableHeight) {
return glm::vec2(width, height);
}
-void StringEditor::render(ui::UIBatchRenderer& renderer) {
- const ui::Rect& bounds = getBounds();
- f32 x = bounds.x;
+void StringEditor::layout(const ui::Rect& bounds) {
+ Widget::layout(bounds);
- constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
+ f32 x = bounds.x;
if (labelWidget_ && showLabel_) {
- labelWidget_->setColor(labelColor);
ui::Rect labelBounds{x, bounds.y, LABEL_WIDTH, bounds.height};
labelWidget_->layout(labelBounds);
- labelWidget_->renderTree(renderer);
x += LABEL_WIDTH + SPACING;
}
@@ -120,6 +117,18 @@ void StringEditor::render(ui::UIBatchRenderer& renderer) {
f32 textFieldWidth = bounds.x + bounds.width - x;
ui::Rect textBounds{x, bounds.y, textFieldWidth, bounds.height};
textField_->layout(textBounds);
+ }
+}
+
+void StringEditor::render(ui::UIBatchRenderer& renderer) {
+ constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
+
+ if (labelWidget_ && showLabel_) {
+ labelWidget_->setColor(labelColor);
+ labelWidget_->renderTree(renderer);
+ }
+
+ if (textField_) {
textField_->renderTree(renderer);
}
}
diff --git a/src/esengine/editor/property/editors/StringEditor.hpp b/src/esengine/editor/property/editors/StringEditor.hpp
index afc1638fd..3681e0c08 100644
--- a/src/esengine/editor/property/editors/StringEditor.hpp
+++ b/src/esengine/editor/property/editors/StringEditor.hpp
@@ -37,6 +37,7 @@ public:
void setPlaceholder(const std::string& placeholder);
glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
+ void layout(const ui::Rect& bounds) override;
void render(ui::UIBatchRenderer& renderer) override;
protected:
diff --git a/src/esengine/editor/property/editors/Vector2Editor.cpp b/src/esengine/editor/property/editors/Vector2Editor.cpp
index 6eec734ef..801cef56f 100644
--- a/src/esengine/editor/property/editors/Vector2Editor.cpp
+++ b/src/esengine/editor/property/editors/Vector2Editor.cpp
@@ -32,23 +32,11 @@ Vector2Editor::Vector2Editor(const ui::WidgetId& id, const std::string& property
addChild(std::move(mainLabelWidget));
}
- auto xLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_x_label"));
- xLabelWidget->setText("X");
- xLabelWidget->setFontSize(12.0f);
- xLabel_ = xLabelWidget.get();
- addChild(std::move(xLabelWidget));
-
auto xEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_x"), "x");
xEditorWidget->setShowLabel(false);
xEditor_ = xEditorWidget.get();
addChild(std::move(xEditorWidget));
- auto yLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_y_label"));
- yLabelWidget->setText("Y");
- yLabelWidget->setFontSize(12.0f);
- yLabel_ = yLabelWidget.get();
- addChild(std::move(yLabelWidget));
-
auto yEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_y"), "y");
yEditorWidget->setShowLabel(false);
yEditor_ = yEditorWidget.get();
@@ -96,64 +84,172 @@ glm::vec2 Vector2Editor::measure(f32 availableWidth, f32 availableHeight) {
(void)availableHeight;
f32 width = 0.0f;
- f32 height = 20.0f;
+ f32 height = 22.0f;
if (mainLabel_ && showLabel_) {
width += MAIN_LABEL_WIDTH + SPACING;
}
- width += COMPONENT_LABEL_WIDTH + SPACING + FLOAT_EDITOR_WIDTH + SPACING;
- width += COMPONENT_LABEL_WIDTH + SPACING + FLOAT_EDITOR_WIDTH;
+ f32 axisWidth = AXIS_BAR_WIDTH + AXIS_INPUT_WIDTH;
+ width += axisWidth + SPACING + axisWidth;
return glm::vec2(width, height);
}
-void Vector2Editor::render(ui::UIBatchRenderer& renderer) {
- const ui::Rect& bounds = getBounds();
- f32 x = bounds.x;
+void Vector2Editor::layout(const ui::Rect& bounds) {
+ Widget::layout(bounds);
- constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
- constexpr glm::vec4 xColor{0.9f, 0.4f, 0.4f, 1.0f};
- constexpr glm::vec4 yColor{0.4f, 0.9f, 0.4f, 1.0f};
+ f32 x = bounds.x;
+ f32 axisWidth = AXIS_BAR_WIDTH + AXIS_INPUT_WIDTH;
if (mainLabel_ && showLabel_) {
- mainLabel_->setColor(labelColor);
ui::Rect labelBounds{x, bounds.y, MAIN_LABEL_WIDTH, bounds.height};
mainLabel_->layout(labelBounds);
- mainLabel_->renderTree(renderer);
x += MAIN_LABEL_WIDTH + SPACING;
}
- if (xLabel_) {
- xLabel_->setColor(xColor);
- ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};
- xLabel_->layout(labelBounds);
- xLabel_->renderTree(renderer);
- x += COMPONENT_LABEL_WIDTH + SPACING;
- }
-
+ xAxisBounds_ = ui::Rect{x, bounds.y, AXIS_BAR_WIDTH, bounds.height};
if (xEditor_) {
- ui::Rect editorBounds{x, bounds.y, FLOAT_EDITOR_WIDTH, bounds.height};
+ ui::Rect editorBounds{x + AXIS_BAR_WIDTH, bounds.y, AXIS_INPUT_WIDTH, bounds.height};
xEditor_->layout(editorBounds);
- xEditor_->renderTree(renderer);
- x += FLOAT_EDITOR_WIDTH + SPACING;
+ }
+ x += axisWidth + SPACING;
+
+ yAxisBounds_ = ui::Rect{x, bounds.y, AXIS_BAR_WIDTH, bounds.height};
+ if (yEditor_) {
+ ui::Rect editorBounds{x + AXIS_BAR_WIDTH, bounds.y, AXIS_INPUT_WIDTH, bounds.height};
+ yEditor_->layout(editorBounds);
+ }
+}
+
+void Vector2Editor::render(ui::UIBatchRenderer& renderer) {
+ const ui::Rect& bounds = getBounds();
+
+ constexpr glm::vec4 labelColor{0.6f, 0.6f, 0.6f, 1.0f};
+ constexpr glm::vec4 xBarColor{0.75f, 0.25f, 0.25f, 1.0f};
+ constexpr glm::vec4 yBarColor{0.25f, 0.63f, 0.25f, 1.0f};
+ constexpr glm::vec4 inputBg{0.1f, 0.1f, 0.1f, 1.0f};
+ constexpr glm::vec4 inputBorder{0.27f, 0.27f, 0.27f, 1.0f};
+
+ f32 axisWidth = AXIS_BAR_WIDTH + AXIS_INPUT_WIDTH;
+
+ if (mainLabel_ && showLabel_) {
+ mainLabel_->setColor(labelColor);
+ mainLabel_->renderTree(renderer);
}
- if (yLabel_) {
- yLabel_->setColor(yColor);
- ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};
- yLabel_->layout(labelBounds);
- yLabel_->renderTree(renderer);
- x += COMPONENT_LABEL_WIDTH + SPACING;
+ renderer.drawRoundedRect(
+ ui::Rect{xAxisBounds_.x, bounds.y, axisWidth, bounds.height},
+ inputBg,
+ ui::CornerRadii::all(2.0f)
+ );
+ renderer.drawRoundedRectOutline(
+ ui::Rect{xAxisBounds_.x, bounds.y, axisWidth, bounds.height},
+ inputBorder,
+ ui::CornerRadii::all(2.0f),
+ 1.0f
+ );
+ renderer.drawRect(ui::Rect{xAxisBounds_.x, bounds.y + 1.0f, AXIS_BAR_WIDTH, bounds.height - 2.0f}, xBarColor);
+ if (xEditor_) {
+ xEditor_->renderTree(renderer);
}
+ renderer.drawRoundedRect(
+ ui::Rect{yAxisBounds_.x, bounds.y, axisWidth, bounds.height},
+ inputBg,
+ ui::CornerRadii::all(2.0f)
+ );
+ renderer.drawRoundedRectOutline(
+ ui::Rect{yAxisBounds_.x, bounds.y, axisWidth, bounds.height},
+ inputBorder,
+ ui::CornerRadii::all(2.0f),
+ 1.0f
+ );
+ renderer.drawRect(ui::Rect{yAxisBounds_.x, bounds.y + 1.0f, AXIS_BAR_WIDTH, bounds.height - 2.0f}, yBarColor);
if (yEditor_) {
- ui::Rect editorBounds{x, bounds.y, FLOAT_EDITOR_WIDTH, bounds.height};
- yEditor_->layout(editorBounds);
yEditor_->renderTree(renderer);
}
}
+bool Vector2Editor::onMouseDown(const ui::MouseButtonEvent& event) {
+ if (event.button != ui::MouseButton::Left) {
+ return false;
+ }
+
+ i32 axis = getAxisAtPosition(event.x, event.y);
+ if (axis < 0) {
+ return false;
+ }
+
+ dragStartX_ = event.x;
+
+ switch (axis) {
+ case 0:
+ draggingAxis_ = DragAxis::X;
+ dragStartValue_ = value_.x;
+ break;
+ case 1:
+ draggingAxis_ = DragAxis::Y;
+ dragStartValue_ = value_.y;
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool Vector2Editor::onMouseMove(const ui::MouseMoveEvent& event) {
+ if (draggingAxis_ == DragAxis::None) {
+ return false;
+ }
+
+ f32 delta = event.x - dragStartX_;
+ f32 sensitivity = 0.1f;
+
+ if (event.shift) {
+ sensitivity = 0.01f;
+ } else if (event.ctrl) {
+ sensitivity = 1.0f;
+ }
+
+ f32 newValue = dragStartValue_ + delta * sensitivity;
+ newValue = std::round(newValue * 1000.0f) / 1000.0f;
+
+ glm::vec2 oldValue = value_;
+
+ switch (draggingAxis_) {
+ case DragAxis::X:
+ value_.x = newValue;
+ break;
+ case DragAxis::Y:
+ value_.y = newValue;
+ break;
+ default:
+ break;
+ }
+
+ if (oldValue != value_) {
+ updatingFromValue_ = true;
+ xEditor_->setValue(value_.x);
+ yEditor_->setValue(value_.y);
+ updatingFromValue_ = false;
+
+ notifyValueChanged(oldValue, value_);
+ }
+
+ return true;
+}
+
+bool Vector2Editor::onMouseUp(const ui::MouseButtonEvent& event) {
+ if (event.button != ui::MouseButton::Left || draggingAxis_ == DragAxis::None) {
+ return false;
+ }
+
+ draggingAxis_ = DragAxis::None;
+ return true;
+}
+
// =============================================================================
// Protected Methods
// =============================================================================
@@ -201,4 +297,14 @@ void Vector2Editor::onComponentChanged() {
}
}
+i32 Vector2Editor::getAxisAtPosition(f32 x, f32 y) const {
+ if (xAxisBounds_.contains(x, y)) {
+ return 0;
+ }
+ if (yAxisBounds_.contains(x, y)) {
+ return 1;
+ }
+ return -1;
+}
+
} // namespace esengine::editor
diff --git a/src/esengine/editor/property/editors/Vector2Editor.hpp b/src/esengine/editor/property/editors/Vector2Editor.hpp
index 911a581f0..b3c3de414 100644
--- a/src/esengine/editor/property/editors/Vector2Editor.hpp
+++ b/src/esengine/editor/property/editors/Vector2Editor.hpp
@@ -28,6 +28,13 @@ namespace esengine::editor {
// Vector2Editor Class
// =============================================================================
+/**
+ * @brief Property editor for glm::vec2 values
+ *
+ * @details Renders two axis inputs with colored bars and drag-to-adjust
+ * support. Drag on axis bars to change values with different
+ * sensitivities (Shift for fine, Ctrl for coarse).
+ */
class Vector2Editor : public PropertyEditor {
public:
explicit Vector2Editor(const ui::WidgetId& id, const std::string& propertyName);
@@ -37,30 +44,42 @@ public:
std::any getValue() const override;
glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
+ void layout(const ui::Rect& bounds) override;
void render(ui::UIBatchRenderer& renderer) override;
+ bool onMouseDown(const ui::MouseButtonEvent& event) override;
+ bool onMouseMove(const ui::MouseMoveEvent& event) override;
+ bool onMouseUp(const ui::MouseButtonEvent& event) override;
+
protected:
Unique<Command> createCommand(const std::any& oldValue,
const std::any& newValue) override;
private:
+ enum class DragAxis { None, X, Y };
+
void onComponentChanged();
+ i32 getAxisAtPosition(f32 x, f32 y) const;
glm::vec2 value_{0.0f};
bool updatingFromValue_ = false;
ui::Label* mainLabel_ = nullptr;
- ui::Label* xLabel_ = nullptr;
- ui::Label* yLabel_ = nullptr;
-
FloatEditor* xEditor_ = nullptr;
FloatEditor* yEditor_ = nullptr;
ConnectionHolder connections_;
+ DragAxis draggingAxis_ = DragAxis::None;
+ f32 dragStartX_ = 0.0f;
+ f32 dragStartValue_ = 0.0f;
+
+ ui::Rect xAxisBounds_{};
+ ui::Rect yAxisBounds_{};
+
static constexpr f32 MAIN_LABEL_WIDTH = 60.0f;
- static constexpr f32 COMPONENT_LABEL_WIDTH = 12.0f;
- static constexpr f32 FLOAT_EDITOR_WIDTH = 60.0f;
- static constexpr f32 SPACING = 4.0f;
+ static constexpr f32 AXIS_BAR_WIDTH = 4.0f;
+ static constexpr f32 AXIS_INPUT_WIDTH = 54.0f;
+ static constexpr f32 SPACING = 2.0f;
};
} // namespace esengine::editor
diff --git a/src/esengine/editor/property/editors/Vector3Editor.cpp b/src/esengine/editor/property/editors/Vector3Editor.cpp
index 201b0ffe9..2998a2f40 100644
--- a/src/esengine/editor/property/editors/Vector3Editor.cpp
+++ b/src/esengine/editor/property/editors/Vector3Editor.cpp
@@ -32,34 +32,16 @@ Vector3Editor::Vector3Editor(const ui::WidgetId& id, const std::string& property
addChild(std::move(mainLabelWidget));
}
- auto xLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_x_label"));
- xLabelWidget->setText("X");
- xLabelWidget->setFontSize(12.0f);
- xLabel_ = xLabelWidget.get();
- addChild(std::move(xLabelWidget));
-
auto xEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_x"), "x");
xEditorWidget->setShowLabel(false);
xEditor_ = xEditorWidget.get();
addChild(std::move(xEditorWidget));
- auto yLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_y_label"));
- yLabelWidget->setText("Y");
- yLabelWidget->setFontSize(12.0f);
- yLabel_ = yLabelWidget.get();
- addChild(std::move(yLabelWidget));
-
auto yEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_y"), "y");
yEditorWidget->setShowLabel(false);
yEditor_ = yEditorWidget.get();
addChild(std::move(yEditorWidget));
- auto zLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_z_label"));
- zLabelWidget->setText("Z");
- zLabelWidget->setFontSize(12.0f);
- zLabel_ = zLabelWidget.get();
- addChild(std::move(zLabelWidget));
-
auto zEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_z"), "z");
zEditorWidget->setShowLabel(false);
zEditor_ = zEditorWidget.get();
@@ -108,15 +90,14 @@ std::any Vector3Editor::getValue() const {
glm::vec2 Vector3Editor::measure(f32 availableWidth, f32 availableHeight) {
f32 width = 0.0f;
- f32 height = 20.0f;
+ f32 height = 22.0f;
if (mainLabel_ && showLabel_) {
width += MAIN_LABEL_WIDTH + SPACING;
}
- width += COMPONENT_LABEL_WIDTH + SPACING + FLOAT_EDITOR_WIDTH + SPACING;
- width += COMPONENT_LABEL_WIDTH + SPACING + FLOAT_EDITOR_WIDTH + SPACING;
- width += COMPONENT_LABEL_WIDTH + SPACING + FLOAT_EDITOR_WIDTH;
+ f32 axisWidth = AXIS_BAR_WIDTH + AXIS_INPUT_WIDTH;
+ width += axisWidth + SPACING + axisWidth + SPACING + axisWidth;
const ui::SizeConstraints& constraints = getConstraints();
width = glm::clamp(width, constraints.minWidth, constraints.maxWidth);
@@ -125,68 +106,193 @@ glm::vec2 Vector3Editor::measure(f32 availableWidth, f32 availableHeight) {
return glm::vec2(width, height);
}
-void Vector3Editor::render(ui::UIBatchRenderer& renderer) {
- const ui::Rect& bounds = getBounds();
- f32 x = bounds.x;
+void Vector3Editor::layout(const ui::Rect& bounds) {
+ Widget::layout(bounds);
- constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
- constexpr glm::vec4 xColor{0.9f, 0.4f, 0.4f, 1.0f};
- constexpr glm::vec4 yColor{0.4f, 0.9f, 0.4f, 1.0f};
- constexpr glm::vec4 zColor{0.4f, 0.6f, 0.9f, 1.0f};
+ f32 x = bounds.x;
+ f32 axisWidth = AXIS_BAR_WIDTH + AXIS_INPUT_WIDTH;
if (mainLabel_ && showLabel_) {
- mainLabel_->setColor(labelColor);
ui::Rect labelBounds{x, bounds.y, MAIN_LABEL_WIDTH, bounds.height};
mainLabel_->layout(labelBounds);
- mainLabel_->renderTree(renderer);
x += MAIN_LABEL_WIDTH + SPACING;
}
- if (xLabel_) {
- xLabel_->setColor(xColor);
- ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};
- xLabel_->layout(labelBounds);
- xLabel_->renderTree(renderer);
- x += COMPONENT_LABEL_WIDTH + SPACING;
- }
-
+ xAxisBounds_ = ui::Rect{x, bounds.y, AXIS_BAR_WIDTH, bounds.height};
if (xEditor_) {
- ui::Rect editorBounds{x, bounds.y, FLOAT_EDITOR_WIDTH, bounds.height};
+ ui::Rect editorBounds{x + AXIS_BAR_WIDTH, bounds.y, AXIS_INPUT_WIDTH, bounds.height};
xEditor_->layout(editorBounds);
- xEditor_->renderTree(renderer);
- x += FLOAT_EDITOR_WIDTH + SPACING;
- }
-
- if (yLabel_) {
- yLabel_->setColor(yColor);
- ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};
- yLabel_->layout(labelBounds);
- yLabel_->renderTree(renderer);
- x += COMPONENT_LABEL_WIDTH + SPACING;
}
+ x += axisWidth + SPACING;
+ yAxisBounds_ = ui::Rect{x, bounds.y, AXIS_BAR_WIDTH, bounds.height};
if (yEditor_) {
- ui::Rect editorBounds{x, bounds.y, FLOAT_EDITOR_WIDTH, bounds.height};
+ ui::Rect editorBounds{x + AXIS_BAR_WIDTH, bounds.y, AXIS_INPUT_WIDTH, bounds.height};
yEditor_->layout(editorBounds);
- yEditor_->renderTree(renderer);
- x += FLOAT_EDITOR_WIDTH + SPACING;
}
+ x += axisWidth + SPACING;
- if (zLabel_) {
- zLabel_->setColor(zColor);
- ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};
- zLabel_->layout(labelBounds);
- zLabel_->renderTree(renderer);
- x += COMPONENT_LABEL_WIDTH + SPACING;
+ zAxisBounds_ = ui::Rect{x, bounds.y, AXIS_BAR_WIDTH, bounds.height};
+ if (zEditor_) {
+ ui::Rect editorBounds{x + AXIS_BAR_WIDTH, bounds.y, AXIS_INPUT_WIDTH, bounds.height};
+ zEditor_->layout(editorBounds);
}
+}
+void Vector3Editor::render(ui::UIBatchRenderer& renderer) {
+ const ui::Rect& bounds = getBounds();
+
+ constexpr glm::vec4 labelColor{0.6f, 0.6f, 0.6f, 1.0f};
+ constexpr glm::vec4 xBarColor{0.75f, 0.25f, 0.25f, 1.0f};
+ constexpr glm::vec4 yBarColor{0.25f, 0.63f, 0.25f, 1.0f};
+ constexpr glm::vec4 zBarColor{0.25f, 0.38f, 0.75f, 1.0f};
+ constexpr glm::vec4 inputBg{0.1f, 0.1f, 0.1f, 1.0f};
+ constexpr glm::vec4 inputBorder{0.27f, 0.27f, 0.27f, 1.0f};
+
+ f32 axisWidth = AXIS_BAR_WIDTH + AXIS_INPUT_WIDTH;
+
+ if (mainLabel_ && showLabel_) {
+ mainLabel_->setColor(labelColor);
+ mainLabel_->renderTree(renderer);
+ }
+
+ renderer.drawRoundedRect(
+ ui::Rect{xAxisBounds_.x, bounds.y, axisWidth, bounds.height},
+ inputBg,
+ ui::CornerRadii::all(2.0f)
+ );
+ renderer.drawRoundedRectOutline(
+ ui::Rect{xAxisBounds_.x, bounds.y, axisWidth, bounds.height},
+ inputBorder,
+ ui::CornerRadii::all(2.0f),
+ 1.0f
+ );
+ renderer.drawRect(ui::Rect{xAxisBounds_.x, bounds.y + 1.0f, AXIS_BAR_WIDTH, bounds.height - 2.0f}, xBarColor);
+ if (xEditor_) {
+ xEditor_->renderTree(renderer);
+ }
+
+ renderer.drawRoundedRect(
+ ui::Rect{yAxisBounds_.x, bounds.y, axisWidth, bounds.height},
+ inputBg,
+ ui::CornerRadii::all(2.0f)
+ );
+ renderer.drawRoundedRectOutline(
+ ui::Rect{yAxisBounds_.x, bounds.y, axisWidth, bounds.height},
+ inputBorder,
+ ui::CornerRadii::all(2.0f),
+ 1.0f
+ );
+ renderer.drawRect(ui::Rect{yAxisBounds_.x, bounds.y + 1.0f, AXIS_BAR_WIDTH, bounds.height - 2.0f}, yBarColor);
+ if (yEditor_) {
+ yEditor_->renderTree(renderer);
+ }
+
+ renderer.drawRoundedRect(
+ ui::Rect{zAxisBounds_.x, bounds.y, axisWidth, bounds.height},
+ inputBg,
+ ui::CornerRadii::all(2.0f)
+ );
+ renderer.drawRoundedRectOutline(
+ ui::Rect{zAxisBounds_.x, bounds.y, axisWidth, bounds.height},
+ inputBorder,
+ ui::CornerRadii::all(2.0f),
+ 1.0f
+ );
+ renderer.drawRect(ui::Rect{zAxisBounds_.x, bounds.y + 1.0f, AXIS_BAR_WIDTH, bounds.height - 2.0f}, zBarColor);
if (zEditor_) {
- ui::Rect editorBounds{x, bounds.y, FLOAT_EDITOR_WIDTH, bounds.height};
- zEditor_->layout(editorBounds);
zEditor_->renderTree(renderer);
}
}
+bool Vector3Editor::onMouseDown(const ui::MouseButtonEvent& event) {
+ if (event.button != ui::MouseButton::Left) {
+ return false;
+ }
+
+ i32 axis = getAxisAtPosition(event.x, event.y);
+ if (axis < 0) {
+ return false;
+ }
+
+ valueBeforeDrag_ = value_;
+ dragStartX_ = event.x;
+
+ switch (axis) {
+ case 0:
+ draggingAxis_ = DragAxis::X;
+ dragStartValue_ = value_.x;
+ break;
+ case 1:
+ draggingAxis_ = DragAxis::Y;
+ dragStartValue_ = value_.y;
+ break;
+ case 2:
+ draggingAxis_ = DragAxis::Z;
+ dragStartValue_ = value_.z;
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool Vector3Editor::onMouseMove(const ui::MouseMoveEvent& event) {
+ if (draggingAxis_ == DragAxis::None) {
+ return false;
+ }
+
+ f32 delta = event.x - dragStartX_;
+ f32 sensitivity = 0.1f;
+
+ if (event.shift) {
+ sensitivity = 0.01f;
+ } else if (event.ctrl) {
+ sensitivity = 1.0f;
+ }
+
+ f32 newValue = dragStartValue_ + delta * sensitivity;
+ newValue = std::round(newValue * 1000.0f) / 1000.0f;
+
+ glm::vec3 oldValue = value_;
+
+ switch (draggingAxis_) {
+ case DragAxis::X:
+ value_.x = newValue;
+ break;
+ case DragAxis::Y:
+ value_.y = newValue;
+ break;
+ case DragAxis::Z:
+ value_.z = newValue;
+ break;
+ default:
+ break;
+ }
+
+ if (oldValue != value_) {
+ updatingFromValue_ = true;
+ xEditor_->setValue(value_.x);
+ yEditor_->setValue(value_.y);
+ zEditor_->setValue(value_.z);
+ updatingFromValue_ = false;
+
+ notifyValueChanged(oldValue, value_);
+ }
+
+ return true;
+}
+
+bool Vector3Editor::onMouseUp(const ui::MouseButtonEvent& event) {
+ if (event.button != ui::MouseButton::Left || draggingAxis_ == DragAxis::None) {
+ return false;
+ }
+
+ draggingAxis_ = DragAxis::None;
+ return true;
+}
+
// =============================================================================
// Protected Methods
// =============================================================================
@@ -235,4 +341,17 @@ void Vector3Editor::onComponentChanged() {
}
}
+i32 Vector3Editor::getAxisAtPosition(f32 x, f32 y) const {
+ if (xAxisBounds_.contains(x, y)) {
+ return 0;
+ }
+ if (yAxisBounds_.contains(x, y)) {
+ return 1;
+ }
+ if (zAxisBounds_.contains(x, y)) {
+ return 2;
+ }
+ return -1;
+}
+
} // namespace esengine::editor
diff --git a/src/esengine/editor/property/editors/Vector3Editor.hpp b/src/esengine/editor/property/editors/Vector3Editor.hpp
index a48b0336c..7eba4136e 100644
--- a/src/esengine/editor/property/editors/Vector3Editor.hpp
+++ b/src/esengine/editor/property/editors/Vector3Editor.hpp
@@ -31,8 +31,9 @@ namespace esengine::editor {
/**
* @brief Property editor for glm::vec3 values
*
- * @details Renders three FloatEditors for X, Y, Z components with labels.
- * Creates LambdaCommand for undo/redo support.
+ * @details Renders three axis inputs with colored bars and drag-to-adjust
+ * support. Drag on axis bars to change values with different
+ * sensitivities (Shift for fine, Ctrl for coarse).
*
* @code
* auto editor = makeUnique<Vector3Editor>(WidgetId("position"), "Position");
@@ -66,32 +67,45 @@ public:
// =========================================================================
glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
+ void layout(const ui::Rect& bounds) override;
void render(ui::UIBatchRenderer& renderer) override;
+ bool onMouseDown(const ui::MouseButtonEvent& event) override;
+ bool onMouseMove(const ui::MouseMoveEvent& event) override;
+ bool onMouseUp(const ui::MouseButtonEvent& event) override;
+
protected:
Unique<Command> createCommand(const std::any& oldValue,
const std::any& newValue) override;
private:
+ enum class DragAxis { None, X, Y, Z };
+
void onComponentChanged();
+ i32 getAxisAtPosition(f32 x, f32 y) const;
glm::vec3 value_{0.0f};
bool updatingFromValue_ = false;
ui::Label* mainLabel_ = nullptr;
- ui::Label* xLabel_ = nullptr;
- ui::Label* yLabel_ = nullptr;
- ui::Label* zLabel_ = nullptr;
-
FloatEditor* xEditor_ = nullptr;
FloatEditor* yEditor_ = nullptr;
FloatEditor* zEditor_ = nullptr;
ConnectionHolder connections_;
+ DragAxis draggingAxis_ = DragAxis::None;
+ f32 dragStartX_ = 0.0f;
+ f32 dragStartValue_ = 0.0f;
+ glm::vec3 valueBeforeDrag_{0.0f};
+
+ ui::Rect xAxisBounds_{};
+ ui::Rect yAxisBounds_{};
+ ui::Rect zAxisBounds_{};
+
static constexpr f32 MAIN_LABEL_WIDTH = 60.0f;
- static constexpr f32 COMPONENT_LABEL_WIDTH = 12.0f;
- static constexpr f32 FLOAT_EDITOR_WIDTH = 60.0f;
- static constexpr f32 SPACING = 4.0f;
+ static constexpr f32 AXIS_BAR_WIDTH = 4.0f;
+ static constexpr f32 AXIS_INPUT_WIDTH = 54.0f;
+ static constexpr f32 SPACING = 2.0f;
};
} // namespace esengine::editor
diff --git a/src/esengine/ui/UIContext.cpp b/src/esengine/ui/UIContext.cpp
index 58e9df16a..05f66c974 100644
--- a/src/esengine/ui/UIContext.cpp
+++ b/src/esengine/ui/UIContext.cpp
@@ -301,6 +301,9 @@ void UIContext::processMouseMove(f32 x, f32 y) {
event.y = y;
event.deltaX = deltaX;
event.deltaY = deltaY;
+ event.ctrl = ctrlDown_;
+ event.shift = shiftDown_;
+ event.alt = altDown_;
overlay->onMouseMove(event);
}
}
@@ -316,6 +319,9 @@ void UIContext::processMouseMove(f32 x, f32 y) {
event.leftButton = mouseButtonDown_[static_cast<usize>(MouseButton::Left)];
event.rightButton = mouseButtonDown_[static_cast<usize>(MouseButton::Right)];
event.middleButton = mouseButtonDown_[static_cast<usize>(MouseButton::Middle)];
+ event.ctrl = ctrlDown_;
+ event.shift = shiftDown_;
+ event.alt = altDown_;
pressedWidget_->onMouseMove(event);
} else if (hoveredWidget_) {
@@ -324,6 +330,9 @@ void UIContext::processMouseMove(f32 x, f32 y) {
event.y = y;
event.deltaX = deltaX;
event.deltaY = deltaY;
+ event.ctrl = ctrlDown_;
+ event.shift = shiftDown_;
+ event.alt = altDown_;
hoveredWidget_->onMouseMove(event);
}
@@ -418,6 +427,10 @@ void UIContext::processMouseScroll(f32 deltaX, f32 deltaY, f32 x, f32 y) {
}
void UIContext::processKeyDown(KeyCode key, bool ctrl, bool shift, bool alt) {
+ ctrlDown_ = ctrl;
+ shiftDown_ = shift;
+ altDown_ = alt;
+
if (focusedWidget_) {
KeyEvent event;
event.key = key;
@@ -431,6 +444,10 @@ void UIContext::processKeyDown(KeyCode key, bool ctrl, bool shift, bool alt) {
}
void UIContext::processKeyUp(KeyCode key, bool ctrl, bool shift, bool alt) {
+ ctrlDown_ = ctrl;
+ shiftDown_ = shift;
+ altDown_ = alt;
+
if (focusedWidget_) {
KeyEvent event;
event.key = key;
diff --git a/src/esengine/ui/UIContext.hpp b/src/esengine/ui/UIContext.hpp
index 8b0191225..3be8789d5 100644
--- a/src/esengine/ui/UIContext.hpp
+++ b/src/esengine/ui/UIContext.hpp
@@ -404,6 +404,9 @@ private:
f32 lastMouseX_ = 0.0f;
f32 lastMouseY_ = 0.0f;
bool mouseButtonDown_[static_cast<usize>(MouseButton::Count)] = {};
+ bool ctrlDown_ = false;
+ bool shiftDown_ = false;
+ bool altDown_ = false;
std::string clipboardText_;
diff --git a/src/esengine/ui/events/UIEvent.hpp b/src/esengine/ui/events/UIEvent.hpp
index abd84000e..8564b3561 100644
--- a/src/esengine/ui/events/UIEvent.hpp
+++ b/src/esengine/ui/events/UIEvent.hpp
@@ -85,6 +85,9 @@ struct MouseMoveEvent : UIEvent {
bool leftButton = false;
bool rightButton = false;
bool middleButton = false;
+ bool ctrl = false;
+ bool shift = false;
+ bool alt = false;
glm::vec2 position() const { return {x, y}; }
glm::vec2 delta() const { return {deltaX, deltaY}; }