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
feat: Add Canvas component for 2D resolution management
esenginefc3861ce4821
diff --git a/assets/.esengine/assets.db b/assets/.esengine/assets.dbindex f72cfc718..1e2b612fb 100644--- a/assets/.esengine/assets.db+++ b/assets/.esengine/assets.db@@ -2,53 +2,53 @@"version": "1.0","assets": [{- "guid": "cf70754c-26ba-346d-c01d-ff9fc29a6e9e",- "path": "assets\\.esengine",- "name": ".esengine",- "type": 1,+ "guid": "d6dbbbb3-87ce-a096-8027-f7b9d7129e6f",+ "path": "assets\\scripts\\EnemyAI.js",+ "name": "EnemyAI.js",+ "type": 4,"fileSize": 0,- "lastModified": 1769495857,- "isDirectory": true+ "lastModified": 1769503001,+ "isDirectory": false},{- "guid": "e19fb621-dd86-3c0c-6b10-142a848c6a14",- "path": "assets\\audio\\sfx_jump.wav",- "name": "sfx_jump.wav",- "type": 3,+ "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": "a638dc81-b60d-567f-6820-13f4e9998407",- "path": "assets\\.esengine\\assets.db",- "name": "assets.db",- "type": 0,- "fileSize": 2186,- "lastModified": 1769502460,+ "guid": "04f5ced8-9d11-fa20-d612-06f12e563341",+ "path": "assets\\prefabs\\Coin.prefab",+ "name": "Coin.prefab",+ "type": 7,+ "fileSize": 0,+ "lastModified": 1769503001,"isDirectory": false},{- "guid": "8af759e0-a053-8e8c-1e34-48843f734d2f",- "path": "assets\\textures\\enemy.png",- "name": "enemy.png",- "type": 2,+ "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": "ed1cf9a5-9d96-50d7-e385-82c605f70a63",- "path": "F:\\microes\\assets\\prefabs\\Explosion.prefab",- "name": "Explosion.prefab",- "type": 7,- "fileSize": 0,- "lastModified": 1769503002,+ "guid": "835ed25e-a75f-3a42-0953-d9af26b1cc87",+ "path": "F:\\microes\\assets\\test.txt",+ "name": "test.txt",+ "type": 0,+ "fileSize": 5,+ "lastModified": 1769488063,"isDirectory": false},{- "guid": "08964537-6809-2c47-8997-7bbf1c75029f",- "path": "assets\\scripts",+ "guid": "83dd6048-d8fa-b62a-47d1-6f17771c459f",+ "path": "F:\\microes\\assets\\scripts","name": "scripts","type": 1,"fileSize": 0,@@ -56,36 +56,54 @@"isDirectory": true},{- "guid": "53cf7de5-ae26-2632-e022-e9108f6bbc2c",- "path": "F:\\microes\\assets\\audio\\sfx_coin.wav",- "name": "sfx_coin.wav",- "type": 3,+ "guid": "c6113f63-03d0-811d-550a-8f26f331233d",+ "path": "assets\\textures\\tileset.png",+ "name": "tileset.png",+ "type": 2,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},{- "guid": "e1d87090-38ce-2d60-5bdd-1f928fdaf88a",- "path": "assets\\scenes\\Level1.scene",- "name": "Level1.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": 1769503002,+ "lastModified": 1769503001,"isDirectory": false},{- "guid": "ca417dff-fe94-4361-ec9b-16504f048514",- "path": "F:\\microes\\assets\\prefabs\\Bullet.prefab",- "name": "Bullet.prefab",- "type": 7,+ "guid": "90db01ce-eadb-5131-35ee-a55e9f60bb4d",+ "path": "assets\\shaders\\water.glsl",+ "name": "water.glsl",+ "type": 5,+ "fileSize": 0,+ "lastModified": 1769503001,+ "isDirectory": false+ },+ {+ "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": "7d86b8df-60d3-330a-ae99-ae597a929a9b",- "path": "assets\\textures\\player.png",- "name": "player.png",+ "guid": "f928d327-1c23-3d66-2009-d4d3daea8e31",+ "path": "F:\\microes\\assets\\textures\\skybox.png",+ "name": "skybox.png",+ "type": 2,+ "fileSize": 0,+ "lastModified": 1769503001,+ "isDirectory": false+ },+ {+ "guid": "30c0a678-ec31-5c3c-f60c-2b982d208861",+ "path": "F:\\microes\\assets\\textures\\background.png",+ "name": "background.png","type": 2,"fileSize": 0,"lastModified": 1769503002,@@ -110,55 +128,73 @@"isDirectory": false},{- "guid": "b9c53311-d99a-e00b-9ba2-358e123efa4e",- "path": "assets\\scripts\\GameManager.js",- "name": "GameManager.js",- "type": 4,+ "guid": "9db35f84-665c-e687-86b1-cc78a3934216",+ "path": "assets\\test.txt",+ "name": "test.txt",+ "type": 0,+ "fileSize": 5,+ "lastModified": 1769488062,+ "isDirectory": false+ },+ {+ "guid": "7fe2a865-bb30-1847-62e3-d289b5616a3a",+ "path": "F:\\microes\\assets\\scenes\\BossRoom.scene",+ "name": "BossRoom.scene",+ "type": 6,+ "fileSize": 0,+ "lastModified": 1769503001,+ "isDirectory": false+ },+ {+ "guid": "abf642da-9512-d0bd-e306-e1bce616320c",+ "path": "F:\\microes\\assets\\scenes\\Level2.scene",+ "name": "Level2.scene",+ "type": 6,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},{- "guid": "44aa95ad-d460-37e0-041f-c6a4449f8b17",- "path": "assets\\textures\\test.png",- "name": "test.png",- "type": 2,- "fileSize": 6,- "lastModified": 1769488063,+ "guid": "bbbdbf23-cecf-5053-0ebe-f3daf5b9e103",+ "path": "assets\\prefabs\\Explosion.prefab",+ "name": "Explosion.prefab",+ "type": 7,+ "fileSize": 0,+ "lastModified": 1769503002,"isDirectory": false},{- "guid": "4f4e6a0b-08fb-1c62-5a27-830f643cacff",- "path": "F:\\microes\\assets\\prefabs",- "name": "prefabs",+ "guid": "ab8960b7-4b05-8029-7577-571c44b9c394",+ "path": "F:\\microes\\assets\\fonts",+ "name": "fonts","type": 1,"fileSize": 0,- "lastModified": 1769503001,+ "lastModified": 1769653161,"isDirectory": true},{- "guid": "e11483d8-2203-6eff-1b7e-0932b819f1c9",- "path": "assets\\audio\\sfx_attack.wav",- "name": "sfx_attack.wav",- "type": 3,+ "guid": "0f5a7d56-b021-7cfe-9ffd-b6deba57b565",+ "path": "assets\\textures\\ui_panel.png",+ "name": "ui_panel.png",+ "type": 2,"fileSize": 0,"lastModified": 1769503001,"isDirectory": false},{- "guid": "0e48ebc1-25c8-2588-29aa-fb40564e2355",- "path": "assets\\scenes\\MainMenu.scene",- "name": "MainMenu.scene",- "type": 6,+ "guid": "0926ee8f-8eef-58fa-8d75-0ac49a8bf2b1",+ "path": "F:\\microes\\assets\\scenes",+ "name": "scenes",+ "type": 1,"fileSize": 0,- "lastModified": 1769503002,- "isDirectory": false+ "lastModified": 1769503001,+ "isDirectory": true},{- "guid": "2402078f-7772-c860-8bce-dfdb1fc37788",- "path": "F:\\microes\\assets\\audio\\bgm_main.mp3",- "name": "bgm_main.mp3",- "type": 3,+ "guid": "ff5ba3b5-d524-f202-72ae-a40add555353",+ "path": "assets\\scenes\\Level2.scene",+ "name": "Level2.scene",+ "type": 6,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false@@ -173,37 +209,10 @@"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": "c771ea16-ad7f-3333-df52-9426cff8a384",- "path": "assets\\textures\\ui_button.png",- "name": "ui_button.png",- "type": 2,- "fileSize": 0,- "lastModified": 1769503002,- "isDirectory": false- },- {- "guid": "a19bf5bf-7a78-8cbd-00c8-8f38cf141628",- "path": "F:\\microes\\assets\\fonts\\msyh.ttc",- "name": "msyh.ttc",- "type": 0,- "fileSize": 19704352,- "lastModified": 1769511857,- "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@@ -218,98 +227,44 @@"isDirectory": false},{- "guid": "6650f3d3-a906-b4a9-1873-b75759499bf8",- "path": "F:\\microes\\assets\\audio\\sfx_jump.wav",- "name": "sfx_jump.wav",- "type": 3,+ "guid": "986b148c-b4ea-cf89-2e04-37dc26624976",+ "path": "F:\\microes\\assets\\textures\\particle.png",+ "name": "particle.png",+ "type": 2,"fileSize": 0,- "lastModified": 1769503002,+ "lastModified": 1769503001,"isDirectory": false},{- "guid": "08719359-3487-beb2-0d62-f54a2a8634c4",- "path": "assets\\shaders",- "name": "shaders",- "type": 1,+ "guid": "234c30b6-359c-51c1-a526-a970984ad90a",+ "path": "F:\\microes\\assets\\textures\\enemy.png",+ "name": "enemy.png",+ "type": 2,"fileSize": 0,- "lastModified": 1769503002,- "isDirectory": true+ "lastModified": 1769503001,+ "isDirectory": false},{- "guid": "22bdfe10-0ff6-620f-56ec-26a8142aec33",- "path": "assets\\textures\\skybox.png",- "name": "skybox.png",- "type": 2,+ "guid": "38633421-fb34-4766-58e7-b4ba7c8b5ee3",+ "path": "assets\\audio\\sfx_explosion.wav",+ "name": "sfx_explosion.wav",+ "type": 3,"fileSize": 0,- "lastModified": 1769503001,+ "lastModified": 1769503002,"isDirectory": false},{- "guid": "090ed68c-0dbe-382c-e163-5ad3bc22abad",- "path": "F:\\microes\\assets\\scenes\\Level1.scene",- "name": "Level1.scene",+ "guid": "02f457d5-e200-7f62-6850-7612ed829a63",+ "path": "assets\\scenes\\BossRoom.scene",+ "name": "BossRoom.scene","type": 6,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},{- "guid": "4b48ff38-aeb0-7a1b-38ec-03ad938736e9",- "path": "F:\\microes\\assets\\shaders\\sprite.glsl",- "name": "sprite.glsl",- "type": 5,- "fileSize": 0,- "lastModified": 1769503002,- "isDirectory": false- },- {- "guid": "32dd883f-81c7-59a9-8229-5920e8152da1",- "path": "assets\\prefabs",- "name": "prefabs",- "type": 1,- "fileSize": 0,- "lastModified": 1769503001,- "isDirectory": true- },- {- "guid": "a424334b-4399-6ab1-440c-7da10d865e15",- "path": "assets\\scripts\\UIManager.js",- "name": "UIManager.js",- "type": 4,- "fileSize": 0,- "lastModified": 1769503001,- "isDirectory": false- },- {- "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": "458ea613-0ce1-0325-3f9c-9f6937eafacf",- "path": "assets\\prefabs\\Player.prefab",- "name": "Player.prefab",- "type": 7,- "fileSize": 0,- "lastModified": 1769503001,- "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": "6837963f-192a-0bcb-80e2-1cb45a8e35e7",- "path": "assets\\scripts\\PlayerController.js",+ "guid": "b162bd84-eee3-1b79-807c-c64d2c64cb2b",+ "path": "F:\\microes\\assets\\scripts\\PlayerController.js","name": "PlayerController.js","type": 4,"fileSize": 0,@@ -317,50 +272,23 @@"isDirectory": false},{- "guid": "182aa6a4-c774-8473-5238-49e1d28f1c5d",- "path": "assets\\prefabs\\Enemy.prefab",- "name": "Enemy.prefab",- "type": 7,+ "guid": "c6908b3b-7d16-8e81-5c2d-c65c46fee0d4",+ "path": "assets\\audio\\bgm_battle.mp3",+ "name": "bgm_battle.mp3",+ "type": 3,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},{- "guid": "d0e72f1c-981f-5995-dade-848b8b18813e",- "path": "assets\\textures\\background.png",- "name": "background.png",+ "guid": "d11c2d62-5870-5040-3e1a-bf5bc046b98a",+ "path": "F:\\microes\\assets\\textures\\ui_button.png",+ "name": "ui_button.png","type": 2,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},- {- "guid": "83d5664f-9f0b-4687-73b2-b854c5e6d5cf",- "path": "assets\\fonts",- "name": "fonts",- "type": 1,- "fileSize": 0,- "lastModified": 1769501795,- "isDirectory": true- },- {- "guid": "602e5d05-e6b5-3cbe-a3a4-857b4290f255",- "path": "assets\\scripts\\CameraFollow.js",- "name": "CameraFollow.js",- "type": 4,- "fileSize": 0,- "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": 1769503002,- "isDirectory": false- },{"guid": "d44064b6-5cd8-29c4-8dc3-e6f0b71c6ad1","path": "F:\\microes\\assets\\textures\\ui_panel.png",@@ -370,15 +298,6 @@"lastModified": 1769503001,"isDirectory": false},- {- "guid": "57c85655-8b7d-e5b6-d5a6-80eb2b0b49d3",- "path": "assets\\scripts\\Inventory.js",- "name": "Inventory.js",- "type": 4,- "fileSize": 0,- "lastModified": 1769503002,- "isDirectory": false- },{"guid": "bca66dcd-f892-9c43-f176-62ac939c4de4","path": "F:\\microes\\assets\\audio\\sfx_attack.wav",@@ -389,130 +308,94 @@"isDirectory": false},{- "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": "0dd456da-eb9c-cdac-c429-b918b2f78b00",- "path": "F:\\microes\\assets\\shaders\\particle.glsl",- "name": "particle.glsl",- "type": 5,+ "guid": "57c85655-8b7d-e5b6-d5a6-80eb2b0b49d3",+ "path": "assets\\scripts\\Inventory.js",+ "name": "Inventory.js",+ "type": 4,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},{- "guid": "86ed9e0d-442c-a047-9b51-09011c881685",- "path": "assets\\audio",- "name": "audio",+ "guid": "f543cca8-b481-a8be-8507-770c03c75eab",+ "path": "assets\\scenes",+ "name": "scenes","type": 1,"fileSize": 0,- "lastModified": 1769503001,- "isDirectory": true- },- {- "guid": "d3d9a556-8861-fbc2-504a-151ef73f41de",- "path": "F:\\microes\\assets\\textures\\player.png",- "name": "player.png",- "type": 2,- "fileSize": 0,- "lastModified": 1769503001,- "isDirectory": false- },- {- "guid": "f29a2ee0-016a-f018-436a-9c11731f251a",- "path": "F:\\microes\\assets\\scripts\\Inventory.js",- "name": "Inventory.js",- "type": 4,- "fileSize": 0,"lastModified": 1769503002,- "isDirectory": false+ "isDirectory": true},{- "guid": "49fa3441-7d74-bf79-c116-717b849b78ce",- "path": "F:\\microes\\assets\\prefabs\\Player.prefab",- "name": "Player.prefab",+ "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": "b162bd84-eee3-1b79-807c-c64d2c64cb2b",- "path": "F:\\microes\\assets\\scripts\\PlayerController.js",- "name": "PlayerController.js",- "type": 4,- "fileSize": 0,- "lastModified": 1769503001,+ "guid": "6a7bd38a-6b72-be37-a497-9628dafb35e1",+ "path": "F:\\microes\\assets\\.esengine\\assets.db",+ "name": "assets.db",+ "type": 0,+ "fileSize": 23550,+ "lastModified": 1769685192,"isDirectory": false},{- "guid": "02f457d5-e200-7f62-6850-7612ed829a63",- "path": "assets\\scenes\\BossRoom.scene",- "name": "BossRoom.scene",- "type": 6,+ "guid": "08719359-3487-beb2-0d62-f54a2a8634c4",+ "path": "assets\\shaders",+ "name": "shaders",+ "type": 1,"fileSize": 0,"lastModified": 1769503002,- "isDirectory": false+ "isDirectory": true},{- "guid": "38633421-fb34-4766-58e7-b4ba7c8b5ee3",- "path": "assets\\audio\\sfx_explosion.wav",- "name": "sfx_explosion.wav",+ "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": "234c30b6-359c-51c1-a526-a970984ad90a",- "path": "F:\\microes\\assets\\textures\\enemy.png",- "name": "enemy.png",- "type": 2,- "fileSize": 0,"lastModified": 1769503001,"isDirectory": false},{- "guid": "986b148c-b4ea-cf89-2e04-37dc26624976",- "path": "F:\\microes\\assets\\textures\\particle.png",- "name": "particle.png",- "type": 2,- "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": 1769511857,"isDirectory": false},{- "guid": "c71b2168-6faf-8d98-2ce8-4175ecfc98f2",- "path": "assets\\prefabs\\Bullet.prefab",- "name": "Bullet.prefab",- "type": 7,+ "guid": "c771ea16-ad7f-3333-df52-9426cff8a384",+ "path": "assets\\textures\\ui_button.png",+ "name": "ui_button.png",+ "type": 2,"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": 23550,- "lastModified": 1769679593,+ "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",- "type": 1,+ "guid": "ce69c963-c0ea-0fb2-c96c-bf1afc0e0802",+ "path": "assets\\shaders\\postprocess.glsl",+ "name": "postprocess.glsl",+ "type": 5,"fileSize": 0,"lastModified": 1769503002,- "isDirectory": true+ "isDirectory": false},{"guid": "99c227eb-f8d3-d0e8-843b-ceb126687e8b",@@ -520,7 +403,7 @@"name": "audio","type": 1,"fileSize": 0,- "lastModified": 1769503001,+ "lastModified": 1769503002,"isDirectory": true},{@@ -538,7 +421,7 @@"name": "CameraFollow.js","type": 4,"fileSize": 0,- "lastModified": 1769503002,+ "lastModified": 1769503001,"isDirectory": false},{@@ -560,147 +443,156 @@"isDirectory": true},{- "guid": "78390dfc-f548-9908-8279-6b3064ea26b3",- "path": "F:\\microes\\assets\\textures",- "name": "textures",- "type": 1,+ "guid": "b9c53311-d99a-e00b-9ba2-358e123efa4e",+ "path": "assets\\scripts\\GameManager.js",+ "name": "GameManager.js",+ "type": 4,"fileSize": 0,"lastModified": 1769503002,- "isDirectory": true- },- {- "guid": "e704f3d4-170b-fecb-d4f9-4534e5056d78",- "path": "assets\\shaders\\particle.glsl",- "name": "particle.glsl",- "type": 5,- "fileSize": 0,- "lastModified": 1769503001,"isDirectory": false},{- "guid": "ff5ba3b5-d524-f202-72ae-a40add555353",- "path": "assets\\scenes\\Level2.scene",- "name": "Level2.scene",- "type": 6,- "fileSize": 0,- "lastModified": 1769503002,+ "guid": "44aa95ad-d460-37e0-041f-c6a4449f8b17",+ "path": "assets\\textures\\test.png",+ "name": "test.png",+ "type": 2,+ "fileSize": 6,+ "lastModified": 1769488063,"isDirectory": false},{- "guid": "0926ee8f-8eef-58fa-8d75-0ac49a8bf2b1",- "path": "F:\\microes\\assets\\scenes",- "name": "scenes",+ "guid": "4f4e6a0b-08fb-1c62-5a27-830f643cacff",+ "path": "F:\\microes\\assets\\prefabs",+ "name": "prefabs","type": 1,"fileSize": 0,"lastModified": 1769503002,"isDirectory": true},{- "guid": "bbbdbf23-cecf-5053-0ebe-f3daf5b9e103",- "path": "assets\\prefabs\\Explosion.prefab",- "name": "Explosion.prefab",- "type": 7,+ "guid": "e1d87090-38ce-2d60-5bdd-1f928fdaf88a",+ "path": "assets\\scenes\\Level1.scene",+ "name": "Level1.scene",+ "type": 6,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},{- "guid": "ab8960b7-4b05-8029-7577-571c44b9c394",- "path": "F:\\microes\\assets\\fonts",- "name": "fonts",- "type": 1,+ "guid": "53cf7de5-ae26-2632-e022-e9108f6bbc2c",+ "path": "F:\\microes\\assets\\audio\\sfx_coin.wav",+ "name": "sfx_coin.wav",+ "type": 3,"fileSize": 0,- "lastModified": 1769653161,- "isDirectory": true+ "lastModified": 1769503002,+ "isDirectory": false},{- "guid": "0f5a7d56-b021-7cfe-9ffd-b6deba57b565",- "path": "assets\\textures\\ui_panel.png",- "name": "ui_panel.png",- "type": 2,+ "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": "abf642da-9512-d0bd-e306-e1bce616320c",- "path": "F:\\microes\\assets\\scenes\\Level2.scene",- "name": "Level2.scene",- "type": 6,+ "guid": "22bdfe10-0ff6-620f-56ec-26a8142aec33",+ "path": "assets\\textures\\skybox.png",+ "name": "skybox.png",+ "type": 2,"fileSize": 0,"lastModified": 1769503001,"isDirectory": false},{- "guid": "7fe2a865-bb30-1847-62e3-d289b5616a3a",- "path": "F:\\microes\\assets\\scenes\\BossRoom.scene",- "name": "BossRoom.scene",- "type": 6,+ "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": "6e88b347-db2d-b526-87c6-301569094b15",- "path": "F:\\microes\\assets\\audio\\sfx_explosion.wav",- "name": "sfx_explosion.wav",- "type": 3,+ "guid": "08964537-6809-2c47-8997-7bbf1c75029f",+ "path": "assets\\scripts",+ "name": "scripts",+ "type": 1,"fileSize": 0,"lastModified": 1769503002,- "isDirectory": false+ "isDirectory": true},{- "guid": "c6113f63-03d0-811d-550a-8f26f331233d",- "path": "assets\\textures\\tileset.png",- "name": "tileset.png",+ "guid": "8af759e0-a053-8e8c-1e34-48843f734d2f",+ "path": "assets\\textures\\enemy.png",+ "name": "enemy.png","type": 2,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},{- "guid": "b55ead52-b974-950b-26a3-a227e2ac41e9",- "path": "assets\\audio\\sfx_coin.wav",- "name": "sfx_coin.wav",+ "guid": "2402078f-7772-c860-8bce-dfdb1fc37788",+ "path": "F:\\microes\\assets\\audio\\bgm_main.mp3",+ "name": "bgm_main.mp3","type": 3,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},{- "guid": "90db01ce-eadb-5131-35ee-a55e9f60bb4d",- "path": "assets\\shaders\\water.glsl",- "name": "water.glsl",- "type": 5,+ "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,+ "guid": "e19fb621-dd86-3c0c-6b10-142a848c6a14",+ "path": "assets\\audio\\sfx_jump.wav",+ "name": "sfx_jump.wav",+ "type": 3,"fileSize": 0,- "lastModified": 1769503001,+ "lastModified": 1769503002,"isDirectory": false},{- "guid": "04f5ced8-9d11-fa20-d612-06f12e563341",- "path": "assets\\prefabs\\Coin.prefab",- "name": "Coin.prefab",- "type": 7,+ "guid": "a638dc81-b60d-567f-6820-13f4e9998407",+ "path": "assets\\.esengine\\assets.db",+ "name": "assets.db",+ "type": 0,+ "fileSize": 2186,+ "lastModified": 1769502460,+ "isDirectory": false+ },+ {+ "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": "8283ad01-d8a2-48ae-c4e7-c1f8f0de7955",- "path": "F:\\microes\\assets\\scripts\\UIManager.js",- "name": "UIManager.js",- "type": 4,+ "guid": "9d4aa6d5-4f32-3634-e6fa-2c79467a2a9c",+ "path": "F:\\microes\\assets\\shaders",+ "name": "shaders",+ "type": 1,"fileSize": 0,"lastModified": 1769503002,+ "isDirectory": true+ },+ {+ "guid": "6f4b1d08-8b77-b7eb-629d-c2ea4efba441",+ "path": "F:\\microes\\assets\\prefabs\\Coin.prefab",+ "name": "Coin.prefab",+ "type": 7,+ "fileSize": 0,+ "lastModified": 1769503001,"isDirectory": false},{@@ -722,111 +614,219 @@"isDirectory": false},{- "guid": "0b354ef8-0528-35e8-b628-bed14b4960db",- "path": "F:\\microes\\assets\\audio\\bgm_battle.mp3",- "name": "bgm_battle.mp3",- "type": 3,+ "guid": "3750f28c-b12f-4245-2036-9c552be15aea",+ "path": "F:\\microes\\assets\\fonts\\lucide.ttf",+ "name": "lucide.ttf",+ "type": 8,+ "fileSize": 793848,+ "lastModified": 1769501795,+ "isDirectory": false+ },+ {+ "guid": "6837963f-192a-0bcb-80e2-1cb45a8e35e7",+ "path": "assets\\scripts\\PlayerController.js",+ "name": "PlayerController.js",+ "type": 4,"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",+ "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": "458ea613-0ce1-0325-3f9c-9f6937eafacf",+ "path": "assets\\prefabs\\Player.prefab",+ "name": "Player.prefab",+ "type": 7,"fileSize": 0,"lastModified": 1769503001,"isDirectory": false},{- "guid": "c6908b3b-7d16-8e81-5c2d-c65c46fee0d4",- "path": "assets\\audio\\bgm_battle.mp3",- "name": "bgm_battle.mp3",- "type": 3,+ "guid": "182aa6a4-c774-8473-5238-49e1d28f1c5d",+ "path": "assets\\prefabs\\Enemy.prefab",+ "name": "Enemy.prefab",+ "type": 7,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},{- "guid": "6f4b1d08-8b77-b7eb-629d-c2ea4efba441",- "path": "F:\\microes\\assets\\prefabs\\Coin.prefab",- "name": "Coin.prefab",+ "guid": "d0e72f1c-981f-5995-dade-848b8b18813e",+ "path": "assets\\textures\\background.png",+ "name": "background.png",+ "type": 2,+ "fileSize": 0,+ "lastModified": 1769503002,+ "isDirectory": false+ },+ {+ "guid": "83d5664f-9f0b-4687-73b2-b854c5e6d5cf",+ "path": "assets\\fonts",+ "name": "fonts",+ "type": 1,+ "fileSize": 0,+ "lastModified": 1769501795,+ "isDirectory": true+ },+ {+ "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": "602e5d05-e6b5-3cbe-a3a4-857b4290f255",+ "path": "assets\\scripts\\CameraFollow.js",+ "name": "CameraFollow.js",+ "type": 4,+ "fileSize": 0,+ "lastModified": 1769503002,+ "isDirectory": false+ },+ {+ "guid": "d3d9a556-8861-fbc2-504a-151ef73f41de",+ "path": "F:\\microes\\assets\\textures\\player.png",+ "name": "player.png",+ "type": 2,+ "fileSize": 0,+ "lastModified": 1769503002,+ "isDirectory": false+ },+ {+ "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": "f29a2ee0-016a-f018-436a-9c11731f251a",+ "path": "F:\\microes\\assets\\scripts\\Inventory.js",+ "name": "Inventory.js",+ "type": 4,+ "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": "0dd456da-eb9c-cdac-c429-b918b2f78b00",+ "path": "F:\\microes\\assets\\shaders\\particle.glsl",+ "name": "particle.glsl",+ "type": 5,"fileSize": 0,"lastModified": 1769503001,"isDirectory": false},{- "guid": "9d4aa6d5-4f32-3634-e6fa-2c79467a2a9c",- "path": "F:\\microes\\assets\\shaders",- "name": "shaders",+ "guid": "86ed9e0d-442c-a047-9b51-09011c881685",+ "path": "assets\\audio",+ "name": "audio","type": 1,"fileSize": 0,"lastModified": 1769503001,"isDirectory": true},{- "guid": "a6dd418b-dd75-0249-f26e-bb1b4cc294c8",- "path": "F:\\microes\\assets\\shaders\\postprocess.glsl",- "name": "postprocess.glsl",+ "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": "4b48ff38-aeb0-7a1b-38ec-03ad938736e9",+ "path": "F:\\microes\\assets\\shaders\\sprite.glsl",+ "name": "sprite.glsl","type": 5,"fileSize": 0,"lastModified": 1769503002,"isDirectory": false},{- "guid": "835ed25e-a75f-3a42-0953-d9af26b1cc87",- "path": "F:\\microes\\assets\\test.txt",- "name": "test.txt",- "type": 0,- "fileSize": 5,- "lastModified": 1769488063,+ "guid": "e704f3d4-170b-fecb-d4f9-4534e5056d78",+ "path": "assets\\shaders\\particle.glsl",+ "name": "particle.glsl",+ "type": 5,+ "fileSize": 0,+ "lastModified": 1769503001,"isDirectory": false},{- "guid": "83dd6048-d8fa-b62a-47d1-6f17771c459f",- "path": "F:\\microes\\assets\\scripts",- "name": "scripts",+ "guid": "78390dfc-f548-9908-8279-6b3064ea26b3",+ "path": "F:\\microes\\assets\\textures",+ "name": "textures","type": 1,"fileSize": 0,- "lastModified": 1769503002,+ "lastModified": 1769503001,"isDirectory": true},{- "guid": "30c0a678-ec31-5c3c-f60c-2b982d208861",- "path": "F:\\microes\\assets\\textures\\background.png",- "name": "background.png",- "type": 2,+ "guid": "32dd883f-81c7-59a9-8229-5920e8152da1",+ "path": "assets\\prefabs",+ "name": "prefabs",+ "type": 1,+ "fileSize": 0,+ "lastModified": 1769503001,+ "isDirectory": true+ },+ {+ "guid": "a424334b-4399-6ab1-440c-7da10d865e15",+ "path": "assets\\scripts\\UIManager.js",+ "name": "UIManager.js",+ "type": 4,"fileSize": 0,"lastModified": 1769503001,"isDirectory": false},{- "guid": "f928d327-1c23-3d66-2009-d4d3daea8e31",- "path": "F:\\microes\\assets\\textures\\skybox.png",- "name": "skybox.png",+ "guid": "0e48ebc1-25c8-2588-29aa-fb40564e2355",+ "path": "assets\\scenes\\MainMenu.scene",+ "name": "MainMenu.scene",+ "type": 6,+ "fileSize": 0,+ "lastModified": 1769503002,+ "isDirectory": false+ },+ {+ "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": "7d86b8df-60d3-330a-ae99-ae597a929a9b",+ "path": "assets\\textures\\player.png",+ "name": "player.png","type": 2,"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,+ "guid": "ca417dff-fe94-4361-ec9b-16504f048514",+ "path": "F:\\microes\\assets\\prefabs\\Bullet.prefab",+ "name": "Bullet.prefab",+ "type": 7,+ "fileSize": 0,+ "lastModified": 1769503001,"isDirectory": false}]diff --git a/src/esengine/ecs/components/Canvas.hpp b/src/esengine/ecs/components/Canvas.hppnew file mode 100644index 000000000..82b433065--- /dev/null+++ b/src/esengine/ecs/components/Canvas.hpp@@ -0,0 +1,134 @@+/**+ * @file Canvas.hpp+ * @brief Canvas component for 2D game resolution management+ * @details Provides Canvas component for defining design resolution,+ * pixels-per-unit, and screen scaling behavior.+ *+ * @author ESEngine Team+ * @date 2026+ *+ * @copyright Copyright (c) 2026 ESEngine Team+ * Licensed under the MIT License.+ */+#pragma once++// =============================================================================+// Includes+// =============================================================================++#include "../../core/Types.hpp"+#include "../../core/Reflection.hpp"+#include "../../math/Math.hpp"++namespace esengine::ecs {++// =============================================================================+// Scale Mode+// =============================================================================++/**+ * @brief Canvas scaling mode for different screen resolutions+ */+enum class CanvasScaleMode : u8 {+ FixedWidth, ///< Keep design width, adjust height+ FixedHeight, ///< Keep design height, adjust width+ Expand, ///< Expand to fill screen (may show more content)+ Shrink, ///< Shrink to fit screen (may show less content)+ Match ///< Match width/height by a blend factor+};++// =============================================================================+// Canvas Component+// =============================================================================++/**+ * @brief Canvas component for 2D game resolution management+ *+ * @details Defines the design resolution and scaling behavior for 2D games.+ * The Canvas works with the Camera component to ensure consistent+ * rendering across different screen resolutions.+ *+ * @code+ * Entity canvas = registry.create();+ * auto& c = registry.emplace<Canvas>(canvas);+ * c.designResolution = {1920, 1080};+ * c.pixelsPerUnit = 100.0f; // 100 pixels = 1 world unit+ * c.scaleMode = CanvasScaleMode::FixedHeight;+ * @endcode+ *+ * Workflow:+ * 1. Artist creates assets at design resolution (e.g., 1920x1080)+ * 2. A 100x200 pixel sprite becomes 1x2 world units (at PPU=100)+ * 3. Camera orthoSize is calculated from design resolution and PPU+ * 4. At runtime, scaling adjusts for actual screen resolution+ */+ES_COMPONENT()+struct Canvas {+ /** @brief Design resolution in pixels */+ ES_PROPERTY()+ glm::uvec2 designResolution{1920, 1080};++ /** @brief Pixels per world unit (e.g., 100 means 100px = 1 unit) */+ ES_PROPERTY()+ f32 pixelsPerUnit{100.0f};++ /** @brief Scaling mode for different screen resolutions */+ ES_PROPERTY()+ CanvasScaleMode scaleMode{CanvasScaleMode::FixedHeight};++ /** @brief Match factor for Match scale mode (0 = width, 1 = height) */+ ES_PROPERTY()+ f32 matchWidthOrHeight{0.5f};++ /** @brief Background color for letterbox/pillarbox areas */+ ES_PROPERTY()+ glm::vec4 backgroundColor{0.0f, 0.0f, 0.0f, 1.0f};++ Canvas() = default;++ /**+ * @brief Calculate orthographic camera size for this canvas+ * @return Half-height in world units for orthographic projection+ */+ f32 getOrthoSize() const {+ return (designResolution.y * 0.5f) / pixelsPerUnit;+ }++ /**+ * @brief Calculate design aspect ratio+ * @return Width / Height ratio+ */+ f32 getDesignAspectRatio() const {+ return static_cast<f32>(designResolution.x) / static_cast<f32>(designResolution.y);+ }++ /**+ * @brief Calculate world size of the design resolution+ * @return Size in world units+ */+ glm::vec2 getWorldSize() const {+ return glm::vec2(designResolution) / pixelsPerUnit;+ }++ /**+ * @brief Convert pixel position to world position+ * @param pixelPos Position in pixels (origin at bottom-left)+ * @return Position in world units (centered origin)+ */+ glm::vec2 pixelToWorld(const glm::vec2& pixelPos) const {+ glm::vec2 worldSize = getWorldSize();+ return (pixelPos / pixelsPerUnit) - (worldSize * 0.5f);+ }++ /**+ * @brief Convert world position to pixel position+ * @param worldPos Position in world units+ * @return Position in pixels (origin at bottom-left)+ */+ glm::vec2 worldToPixel(const glm::vec2& worldPos) const {+ glm::vec2 worldSize = getWorldSize();+ return (worldPos + worldSize * 0.5f) * pixelsPerUnit;+ }+};++} // namespace esengine::ecsdiff --git a/src/esengine/editor/EditorApplication.cpp b/src/esengine/editor/EditorApplication.cppindex 2693825a7..fb32a49fa 100644--- a/src/esengine/editor/EditorApplication.cpp+++ b/src/esengine/editor/EditorApplication.cpp@@ -25,6 +25,7 @@#include "../ecs/components/Hierarchy.hpp"#include "../ecs/components/Camera.hpp"#include "../ecs/components/Sprite.hpp"+#include "../ecs/components/Canvas.hpp"#include "core/EditorEvents.hpp"#include "panels/HierarchyPanel.hpp"#include "panels/InspectorPanel.hpp"@@ -438,13 +439,22 @@ void EditorApplication::createDemoScene() {registry_.emplace<ecs::Name>(root, "Scene Root");registry_.emplace<ecs::LocalTransform>(root);+ Entity canvasEntity = registry_.create();+ registry_.emplace<ecs::Name>(canvasEntity, "Canvas");+ auto& canvas = registry_.emplace<ecs::Canvas>(canvasEntity);+ canvas.designResolution = glm::uvec2(1920, 1080);+ canvas.pixelsPerUnit = 100.0f;+ canvas.scaleMode = ecs::CanvasScaleMode::FixedHeight;+ canvas.backgroundColor = glm::vec4(0.1f, 0.1f, 0.15f, 1.0f);+Entity camera = registry_.create();registry_.emplace<ecs::Name>(camera, "Main Camera");- registry_.emplace<ecs::LocalTransform>(camera, glm::vec3(0.0f, 5.0f, 10.0f));+ registry_.emplace<ecs::LocalTransform>(camera, glm::vec3(0.0f, 0.0f, 10.0f));auto& cam = registry_.emplace<ecs::Camera>(camera);cam.isActive = true;cam.priority = 0;- cam.fov = 60.0f;+ cam.projectionType = ecs::ProjectionType::Orthographic;+ cam.orthoSize = canvas.getOrthoSize();Entity light = registry_.create();registry_.emplace<ecs::Name>(light, "Directional Light");@@ -452,7 +462,7 @@ void EditorApplication::createDemoScene() {Entity player = registry_.create();registry_.emplace<ecs::Name>(player, "Player");- registry_.emplace<ecs::LocalTransform>(player, glm::vec3(0.0f, 1.0f, 0.0f));+ registry_.emplace<ecs::LocalTransform>(player, glm::vec3(0.0f, -3.0f, 0.0f));auto& playerSprite = registry_.emplace<ecs::Sprite>(player);playerSprite.color = glm::vec4(0.2f, 0.6f, 1.0f, 1.0f);playerSprite.size = glm::vec2(1.0f, 2.0f);@@ -476,14 +486,14 @@ void EditorApplication::createDemoScene() {Entity obstacle1 = registry_.create();registry_.emplace<ecs::Name>(obstacle1, "Obstacle 1");- registry_.emplace<ecs::LocalTransform>(obstacle1, glm::vec3(5.0f, 1.0f, 0.0f));+ registry_.emplace<ecs::LocalTransform>(obstacle1, glm::vec3(5.0f, 0.0f, 0.0f));auto& obs1Sprite = registry_.emplace<ecs::Sprite>(obstacle1);obs1Sprite.color = glm::vec4(1.0f, 0.3f, 0.3f, 1.0f);obs1Sprite.size = glm::vec2(2.0f, 2.0f);Entity obstacle2 = registry_.create();registry_.emplace<ecs::Name>(obstacle2, "Obstacle 2");- registry_.emplace<ecs::LocalTransform>(obstacle2, glm::vec3(-5.0f, 1.0f, 3.0f));+ registry_.emplace<ecs::LocalTransform>(obstacle2, glm::vec3(-5.0f, 2.0f, 0.0f));auto& obs2Sprite = registry_.emplace<ecs::Sprite>(obstacle2);obs2Sprite.color = glm::vec4(0.3f, 1.0f, 0.3f, 1.0f);obs2Sprite.size = glm::vec2(1.5f, 1.5f);diff --git a/src/esengine/editor/panels/GameViewPanel.cpp b/src/esengine/editor/panels/GameViewPanel.cppindex c3addd23f..cbedf17c4 100644--- a/src/esengine/editor/panels/GameViewPanel.cpp+++ b/src/esengine/editor/panels/GameViewPanel.cpp@@ -16,6 +16,7 @@#include "../../ui/UIContext.hpp"#include "../../ecs/components/Transform.hpp"#include "../../ecs/components/Camera.hpp"+#include "../../ecs/components/Canvas.hpp"#include "../../ecs/components/Sprite.hpp"#include "../../math/Math.hpp"@@ -101,7 +102,14 @@ void GameViewPanel::renderGameToTexture() {framebuffer_->bind();RenderCommand::setViewport(0, 0, viewportWidth_, viewportHeight_);- RenderCommand::setClearColor(glm::vec4(0.1f, 0.1f, 0.1f, 1.0f));++ Entity canvasEntity = findCanvas();+ ecs::Canvas* canvas = canvasEntity != INVALID_ENTITY+ ? registry_.tryGet<ecs::Canvas>(canvasEntity)+ : nullptr;++ glm::vec4 clearColor = canvas ? canvas->backgroundColor : glm::vec4(0.1f, 0.1f, 0.1f, 1.0f);+ RenderCommand::setClearColor(clearColor);RenderCommand::clear();Entity cameraEntity = findActiveCamera();@@ -115,12 +123,11 @@ void GameViewPanel::renderGameToTexture() {glm::mat4_cast(transform->rotation));- f32 aspectRatio = camera->aspectRatio > 0.0f- ? camera->aspectRatio- : static_cast<f32>(viewportWidth_) / static_cast<f32>(viewportHeight_);+ f32 viewportAspect = static_cast<f32>(viewportWidth_) / static_cast<f32>(viewportHeight_);glm::mat4 proj;if (camera->projectionType == ecs::ProjectionType::Perspective) {+ f32 aspectRatio = camera->aspectRatio > 0.0f ? camera->aspectRatio : viewportAspect;proj = glm::perspective(glm::radians(camera->fov),aspectRatio,@@ -129,7 +136,45 @@ void GameViewPanel::renderGameToTexture() {);} else {f32 orthoHeight = camera->orthoSize;- f32 orthoWidth = orthoHeight * aspectRatio;+ f32 orthoWidth = orthoHeight * viewportAspect;++ if (canvas) {+ orthoHeight = canvas->getOrthoSize();+ f32 designAspect = canvas->getDesignAspectRatio();++ switch (canvas->scaleMode) {+ case ecs::CanvasScaleMode::FixedHeight:+ orthoWidth = orthoHeight * viewportAspect;+ break;+ case ecs::CanvasScaleMode::FixedWidth:+ orthoWidth = canvas->getWorldSize().x * 0.5f;+ orthoHeight = orthoWidth / viewportAspect;+ break;+ case ecs::CanvasScaleMode::Expand:+ if (viewportAspect > designAspect) {+ orthoWidth = orthoHeight * viewportAspect;+ } else {+ orthoHeight = orthoWidth / viewportAspect;+ }+ break;+ case ecs::CanvasScaleMode::Shrink:+ if (viewportAspect < designAspect) {+ orthoWidth = orthoHeight * viewportAspect;+ } else {+ orthoHeight = orthoWidth / viewportAspect;+ }+ break;+ case ecs::CanvasScaleMode::Match: {+ f32 logWidth = glm::log2(viewportAspect / designAspect);+ f32 blend = canvas->matchWidthOrHeight;+ f32 scaleFactor = glm::pow(2.0f, logWidth * (1.0f - blend));+ orthoWidth = orthoHeight * designAspect * scaleFactor;+ orthoHeight = orthoWidth / viewportAspect;+ break;+ }+ }+ }+proj = glm::ortho(-orthoWidth, orthoWidth,-orthoHeight, orthoHeight,@@ -219,4 +264,12 @@ Entity GameViewPanel::findActiveCamera() {return bestCamera;}+Entity GameViewPanel::findCanvas() {+ auto view = registry_.view<ecs::Canvas>();+ for (auto entity : view) {+ return entity;+ }+ return INVALID_ENTITY;+}+} // namespace esengine::editordiff --git a/src/esengine/editor/panels/GameViewPanel.hpp b/src/esengine/editor/panels/GameViewPanel.hppindex c67f4535c..a9e95b4f8 100644--- a/src/esengine/editor/panels/GameViewPanel.hpp+++ b/src/esengine/editor/panels/GameViewPanel.hpp@@ -46,6 +46,7 @@ private:void renderSceneContent(const glm::mat4& viewProj);void updateFramebufferSize();Entity findActiveCamera();+ Entity findCanvas();ecs::Registry& registry_;resource::ResourceManager& resourceManager_;diff --git a/src/esengine/editor/panels/SceneViewPanel.cpp b/src/esengine/editor/panels/SceneViewPanel.cppindex 9d3a996ec..28fb3af64 100644--- a/src/esengine/editor/panels/SceneViewPanel.cpp+++ b/src/esengine/editor/panels/SceneViewPanel.cpp@@ -16,6 +16,7 @@#include "../../ui/UIContext.hpp"#include "../../ecs/components/Transform.hpp"#include "../../ecs/components/Sprite.hpp"+#include "../../ecs/components/Canvas.hpp"#include "../../core/Log.hpp"#include <glad/glad.h>#include <vector>@@ -235,6 +236,7 @@ void SceneViewPanel::renderSceneContent() {initGrid2DData();}renderGrid2D(viewProj);+ renderCanvasGizmo(viewProj);} else {if (!gridInitialized_) {initGridData();@@ -768,4 +770,72 @@ i32 SceneViewPanel::hitTestAxisGizmo2D(f32 x, f32 y) {return -1;}+Entity SceneViewPanel::findCanvas() {+ auto view = registry_.view<ecs::Canvas>();+ for (auto entity : view) {+ return entity;+ }+ return INVALID_ENTITY;+}++void SceneViewPanel::initCanvasGizmoData() {+ std::vector<f32> vertices;++ // Simple rectangle (4 corners, 8 vertices for lines)+ // We'll draw as GL_LINES so we need pairs+ // Bottom: (-1,-1) to (1,-1)+ // Right: (1,-1) to (1,1)+ // Top: (1,1) to (-1,1)+ // Left: (-1,1) to (-1,-1)+ f32 rect[] = {+ -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f,+ 1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 0.0f,+ 1.0f, 1.0f, 0.0f, -1.0f, 1.0f, 0.0f,+ -1.0f, 1.0f, 0.0f, -1.0f, -1.0f, 0.0f+ };++ for (f32 v : rect) {+ vertices.push_back(v);+ }++ canvasGizmoVAO_ = VertexArray::create();++ auto vbo = VertexBuffer::createRaw(vertices.data(), static_cast<u32>(vertices.size() * sizeof(f32)));+ vbo->setLayout({+ { ShaderDataType::Float3, "a_position" }+ });++ canvasGizmoVAO_->addVertexBuffer(Shared<VertexBuffer>(std::move(vbo)));++ canvasGizmoInitialized_ = true;+}++void SceneViewPanel::renderCanvasGizmo(const glm::mat4& viewProj) {+ Entity canvasEntity = findCanvas();+ if (canvasEntity == INVALID_ENTITY) return;++ auto* canvas = registry_.tryGet<ecs::Canvas>(canvasEntity);+ if (!canvas) return;++ if (!canvasGizmoInitialized_) {+ initCanvasGizmoData();+ }++ if (!canvasGizmoVAO_ || !gridShader_) return;++ glm::vec2 worldSize = canvas->getWorldSize();+ f32 halfWidth = worldSize.x * 0.5f;+ f32 halfHeight = worldSize.y * 0.5f;++ glm::mat4 model = glm::scale(glm::mat4(1.0f), glm::vec3(halfWidth, halfHeight, 1.0f));+ glm::mat4 mvp = viewProj * model;++ gridShader_->bind();+ gridShader_->setUniform("u_viewProj", mvp);+ gridShader_->setUniform("u_color", glm::vec4(0.4f, 0.8f, 1.0f, 0.8f));++ canvasGizmoVAO_->bind();+ glDrawArrays(GL_LINES, 0, 8);+}+} // namespace esengine::editordiff --git a/src/esengine/editor/panels/SceneViewPanel.hpp b/src/esengine/editor/panels/SceneViewPanel.hppindex 06c976995..9e1afacac 100644--- a/src/esengine/editor/panels/SceneViewPanel.hpp+++ b/src/esengine/editor/panels/SceneViewPanel.hpp@@ -106,7 +106,9 @@ private:void renderGrid(const glm::mat4& viewProj);void renderGrid2D(const glm::mat4& viewProj);void renderSprites(const glm::mat4& viewProj);+ void renderCanvasGizmo(const glm::mat4& viewProj);void initGrid2DData();+ void initCanvasGizmoData();void renderAxisGizmo();void renderAxisGizmo2D();void updateFramebufferSize();@@ -115,6 +117,7 @@ private:void initAxisGizmo2DData();i32 hitTestAxisGizmo(f32 x, f32 y);i32 hitTestAxisGizmo2D(f32 x, f32 y);+ Entity findCanvas();ecs::Registry& registry_;EntitySelection& selection_;@@ -149,6 +152,9 @@ private:Unique<VertexArray> axis2DVAO_;u32 axis2DVertexCount_ = 0;bool axis2DInitialized_ = false;++ Unique<VertexArray> canvasGizmoVAO_;+ bool canvasGizmoInitialized_ = false;};} // namespace esengine::editor