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.

feat: Add EditorToolbar and GameViewPanel for play mode support

esengine5d36acf55ff3
diff --git a/src/esengine/editor/CMakeLists.txt b/src/esengine/editor/CMakeLists.txt
index a05ce7e3e..241b2c587 100644
--- a/src/esengine/editor/CMakeLists.txt
+++ b/src/esengine/editor/CMakeLists.txt
@@ -38,11 +38,13 @@ set(EDITOR_SOURCES
panels/ProjectLauncherPanel.cpp
panels/NewProjectDialog.cpp
panels/OutputLogPanel.cpp
+ panels/GameViewPanel.cpp
# Editor widgets
widgets/StatusBar.cpp
widgets/DrawerPanel.cpp
widgets/EditorRootContainer.cpp
+ widgets/EditorToolbar.cpp
)
set(EDITOR_HEADERS
@@ -96,11 +98,13 @@ set(EDITOR_HEADERS
panels/ProjectLauncherPanel.hpp
panels/NewProjectDialog.hpp
panels/OutputLogPanel.hpp
+ panels/GameViewPanel.hpp
# Editor widgets
widgets/StatusBar.hpp
widgets/DrawerPanel.hpp
widgets/EditorRootContainer.hpp
+ widgets/EditorToolbar.hpp
)
# Create editor executable
diff --git a/src/esengine/editor/EditorApplication.cpp b/src/esengine/editor/EditorApplication.cpp
index e44c14aa2..7e969fbca 100644
--- a/src/esengine/editor/EditorApplication.cpp
+++ b/src/esengine/editor/EditorApplication.cpp
@@ -27,11 +27,13 @@
#include "panels/HierarchyPanel.hpp"
#include "panels/InspectorPanel.hpp"
#include "panels/SceneViewPanel.hpp"
+#include "panels/GameViewPanel.hpp"
#include "panels/AssetBrowserPanel.hpp"
#include "panels/ProjectLauncherPanel.hpp"
#include "panels/NewProjectDialog.hpp"
#include "panels/OutputLogPanel.hpp"
#include "widgets/EditorRootContainer.hpp"
+#include "widgets/EditorToolbar.hpp"
#include "../platform/FileDialog.hpp"
namespace esengine {
@@ -366,8 +368,16 @@ void EditorApplication::setupEditorLayout() {
ES_LOG_INFO("setupEditorLayout: Creating SceneViewPanel...");
auto sceneViewPanel = makeUnique<SceneViewPanel>(registry_, selection_);
sceneViewPanel->setMinSize(glm::vec2(400.0f, 300.0f));
+ auto sceneViewPanelId = sceneViewPanel->getPanelId();
dockArea_->addPanel(std::move(sceneViewPanel), ui::DockDropZone::Center);
+ ES_LOG_INFO("setupEditorLayout: Creating GameViewPanel...");
+ auto gameViewPanel = makeUnique<GameViewPanel>(registry_);
+ gameViewPanel->setMinSize(glm::vec2(400.0f, 300.0f));
+ gameViewPanel_ = gameViewPanel.get();
+ ui::DockNode* sceneViewNode = dockArea_->findNodeContainingPanel(sceneViewPanelId);
+ dockArea_->addPanel(std::move(gameViewPanel), ui::DockDropZone::Center, sceneViewNode);
+
ES_LOG_INFO("setupEditorLayout: Creating HierarchyPanel...");
auto hierarchyPanel = makeUnique<HierarchyPanel>(registry_, selection_);
hierarchyPanel->setMinSize(glm::vec2(280.0f, 200.0f));
@@ -394,6 +404,19 @@ void EditorApplication::setupEditorLayout() {
dockAssetBrowser();
});
+ auto* toolbar = editorRoot_->getToolbar();
+ eventConnections_.add(sink(toolbar->onPlay).connect([this]() {
+ ES_LOG_INFO("Play mode started");
+ }));
+
+ eventConnections_.add(sink(toolbar->onPause).connect([this]() {
+ ES_LOG_INFO("Play mode paused");
+ }));
+
+ eventConnections_.add(sink(toolbar->onStop).connect([this]() {
+ ES_LOG_INFO("Play mode stopped");
+ }));
+
uiContext_->setRoot(std::move(editorRoot));
ES_LOG_INFO("Editor layout initialized with StatusBar and Drawer system");
@@ -530,6 +553,7 @@ void EditorApplication::showLauncher() {
dockArea_ = nullptr;
editorRoot_ = nullptr;
+ gameViewPanel_ = nullptr;
dockedAssetBrowser_ = nullptr;
setupLauncherLayout();
diff --git a/src/esengine/editor/EditorApplication.hpp b/src/esengine/editor/EditorApplication.hpp
index ef7463226..887815e0b 100644
--- a/src/esengine/editor/EditorApplication.hpp
+++ b/src/esengine/editor/EditorApplication.hpp
@@ -36,6 +36,7 @@ class ProjectLauncherPanel;
class NewProjectDialog;
class EditorRootContainer;
class AssetBrowserPanel;
+class GameViewPanel;
// =============================================================================
// Editor Mode
@@ -276,6 +277,7 @@ private:
Unique<ui::UIContext> uiContext_; ///< UI system context
ui::DockArea* dockArea_ = nullptr; ///< Main docking area (owned by UIContext)
EditorRootContainer* editorRoot_ = nullptr; ///< Editor root container
+ GameViewPanel* gameViewPanel_ = nullptr; ///< Game view panel
AssetBrowserPanel* dockedAssetBrowser_ = nullptr; ///< Docked asset browser (if any)
ProjectLauncherPanel* launcherPanel_ = nullptr; ///< Launcher panel (owned by UIContext)
NewProjectDialog* newProjectDialog_ = nullptr; ///< New project dialog
diff --git a/src/esengine/editor/panels/GameViewPanel.cpp b/src/esengine/editor/panels/GameViewPanel.cpp
new file mode 100644
index 000000000..68d2b3525
--- /dev/null
+++ b/src/esengine/editor/panels/GameViewPanel.cpp
@@ -0,0 +1,189 @@
+/**
+ * @file GameViewPanel.cpp
+ * @brief Game view panel implementation
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+
+#include "GameViewPanel.hpp"
+#include "../../renderer/RenderCommand.hpp"
+#include "../../ui/rendering/UIBatchRenderer.hpp"
+#include "../../ecs/components/Transform.hpp"
+#include "../../ecs/components/Camera.hpp"
+#include "../../math/Math.hpp"
+
+#include <glad/glad.h>
+
+#ifndef GL_VIEWPORT
+#define GL_VIEWPORT 0x0BA2
+#endif
+
+namespace esengine::editor {
+
+// =============================================================================
+// Constructor
+// =============================================================================
+
+GameViewPanel::GameViewPanel(ecs::Registry& registry)
+ : DockPanel(ui::WidgetId("game_view_panel"), "Game"),
+ registry_(registry) {
+
+ FramebufferSpec spec;
+ spec.width = viewportWidth_;
+ spec.height = viewportHeight_;
+ spec.depthStencil = true;
+ framebuffer_ = Framebuffer::create(spec);
+
+ setMinSize(glm::vec2(200.0f, 200.0f));
+}
+
+// =============================================================================
+// Configuration
+// =============================================================================
+
+void GameViewPanel::setViewportSize(u32 width, u32 height) {
+ if (width == viewportWidth_ && height == viewportHeight_) {
+ return;
+ }
+
+ viewportWidth_ = width;
+ viewportHeight_ = height;
+ framebufferNeedsResize_ = true;
+}
+
+// =============================================================================
+// Rendering
+// =============================================================================
+
+void GameViewPanel::render(ui::UIBatchRenderer& renderer) {
+ const ui::Rect& bounds = getBounds();
+
+ u32 newWidth = static_cast<u32>(bounds.width);
+ u32 newHeight = static_cast<u32>(bounds.height);
+
+ if (newWidth != viewportWidth_ || newHeight != viewportHeight_) {
+ setViewportSize(newWidth, newHeight);
+ }
+
+ if (framebufferNeedsResize_) {
+ updateFramebufferSize();
+ }
+
+ if (framebuffer_) {
+ renderGameToTexture();
+
+ renderer.drawTexturedRect(
+ bounds,
+ framebuffer_->getColorAttachment(),
+ glm::vec4(1.0f),
+ glm::vec2(0.0f, 0.0f),
+ glm::vec2(1.0f, 1.0f)
+ );
+ }
+}
+
+void GameViewPanel::renderGameToTexture() {
+ if (!framebuffer_) {
+ return;
+ }
+
+ GLint savedViewport[4];
+ glGetIntegerv(GL_VIEWPORT, savedViewport);
+
+ framebuffer_->bind();
+
+ RenderCommand::setViewport(0, 0, viewportWidth_, viewportHeight_);
+ RenderCommand::setClearColor(glm::vec4(0.1f, 0.1f, 0.1f, 1.0f));
+ RenderCommand::clear();
+
+ Entity cameraEntity = findActiveCamera();
+ if (cameraEntity != INVALID_ENTITY) {
+ auto* transform = registry_.tryGet<ecs::LocalTransform>(cameraEntity);
+ auto* camera = registry_.tryGet<ecs::Camera>(cameraEntity);
+
+ if (transform && camera) {
+ glm::mat4 view = glm::inverse(
+ glm::translate(glm::mat4(1.0f), transform->position) *
+ glm::mat4_cast(transform->rotation)
+ );
+
+ f32 aspectRatio = camera->aspectRatio > 0.0f
+ ? camera->aspectRatio
+ : static_cast<f32>(viewportWidth_) / static_cast<f32>(viewportHeight_);
+
+ glm::mat4 proj;
+ if (camera->projectionType == ecs::ProjectionType::Perspective) {
+ proj = glm::perspective(
+ glm::radians(camera->fov),
+ aspectRatio,
+ camera->nearPlane,
+ camera->farPlane
+ );
+ } else {
+ f32 orthoHeight = camera->orthoSize;
+ f32 orthoWidth = orthoHeight * aspectRatio;
+ proj = glm::ortho(
+ -orthoWidth, orthoWidth,
+ -orthoHeight, orthoHeight,
+ camera->nearPlane, camera->farPlane
+ );
+ }
+
+ glm::mat4 viewProj = proj * view;
+ renderSceneContent(viewProj);
+ }
+ }
+
+ framebuffer_->unbind();
+
+ glViewport(savedViewport[0], savedViewport[1], savedViewport[2], savedViewport[3]);
+}
+
+void GameViewPanel::renderSceneContent(const glm::mat4& viewProj) {
+ auto transformView = registry_.view<ecs::LocalTransform>();
+ for (auto entity : transformView) {
+ const auto& transform = transformView.get(entity);
+
+ glm::mat4 model = glm::mat4(1.0f);
+ model = glm::translate(model, transform.position);
+ model *= glm::mat4_cast(transform.rotation);
+ model = glm::scale(model, transform.scale);
+
+ glm::mat4 mvp = viewProj * model;
+ (void)mvp;
+ }
+}
+
+void GameViewPanel::updateFramebufferSize() {
+ if (viewportWidth_ == 0 || viewportHeight_ == 0) {
+ return;
+ }
+
+ if (framebuffer_) {
+ framebuffer_->resize(viewportWidth_, viewportHeight_);
+ framebufferNeedsResize_ = false;
+ }
+}
+
+Entity GameViewPanel::findActiveCamera() {
+ auto view = registry_.view<ecs::Camera>();
+
+ Entity bestCamera = INVALID_ENTITY;
+ i32 bestPriority = std::numeric_limits<i32>::min();
+
+ for (auto entity : view) {
+ const auto& camera = view.get(entity);
+ if (camera.isActive && camera.priority > bestPriority) {
+ bestCamera = entity;
+ bestPriority = camera.priority;
+ }
+ }
+
+ return bestCamera;
+}
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/panels/GameViewPanel.hpp b/src/esengine/editor/panels/GameViewPanel.hpp
new file mode 100644
index 000000000..6e109b17d
--- /dev/null
+++ b/src/esengine/editor/panels/GameViewPanel.hpp
@@ -0,0 +1,57 @@
+/**
+ * @file GameViewPanel.hpp
+ * @brief Game viewport panel showing the game camera view
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+#pragma once
+
+// =============================================================================
+// Includes
+// =============================================================================
+
+#include "../../ui/docking/DockPanel.hpp"
+#include "../../renderer/Framebuffer.hpp"
+#include "../../ecs/Registry.hpp"
+
+namespace esengine::editor {
+
+// =============================================================================
+// GameViewPanel Class
+// =============================================================================
+
+/**
+ * @brief Game viewport panel showing the active game camera view
+ *
+ * @details Unlike SceneViewPanel which uses an EditorCamera for free navigation,
+ * GameViewPanel renders from the perspective of the active game camera
+ * (an entity with Camera component where isActive=true).
+ */
+class GameViewPanel : public ui::DockPanel {
+public:
+ explicit GameViewPanel(ecs::Registry& registry);
+ ~GameViewPanel() override = default;
+
+ void setViewportSize(u32 width, u32 height);
+
+ void render(ui::UIBatchRenderer& renderer) override;
+
+private:
+ void renderGameToTexture();
+ void renderSceneContent(const glm::mat4& viewProj);
+ void updateFramebufferSize();
+ Entity findActiveCamera();
+
+ ecs::Registry& registry_;
+ Unique<Framebuffer> framebuffer_;
+
+ u32 viewportWidth_ = 1280;
+ u32 viewportHeight_ = 720;
+ bool framebufferNeedsResize_ = false;
+};
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/widgets/EditorRootContainer.cpp b/src/esengine/editor/widgets/EditorRootContainer.cpp
index c6fc0a928..156c4cd29 100644
--- a/src/esengine/editor/widgets/EditorRootContainer.cpp
+++ b/src/esengine/editor/widgets/EditorRootContainer.cpp
@@ -22,6 +22,10 @@ namespace esengine::editor {
// =============================================================================
EditorRootContainer::EditorRootContainer(const ui::WidgetId& id) : Widget(id) {
+ auto toolbar = makeUnique<EditorToolbar>(ui::WidgetId(id.path + ".toolbar"));
+ toolbar_ = toolbar.get();
+ addChild(std::move(toolbar));
+
auto statusBar = makeUnique<StatusBar>(ui::WidgetId(id.path + ".status_bar"));
statusBar_ = statusBar.get();
addChild(std::move(statusBar));
@@ -162,6 +166,15 @@ void EditorRootContainer::layout(const ui::Rect& bounds) {
void EditorRootContainer::updateLayout() {
const ui::Rect& bounds = getBounds();
+ ui::Rect toolbarBounds{
+ bounds.x,
+ bounds.y,
+ bounds.width,
+ EditorToolbar::HEIGHT
+ };
+ toolbar_->measure(toolbarBounds.width, toolbarBounds.height);
+ toolbar_->layout(toolbarBounds);
+
ui::Rect statusBarBounds{
bounds.x,
bounds.y + bounds.height - StatusBar::HEIGHT,
@@ -201,10 +214,10 @@ void EditorRootContainer::updateLayout() {
}
if (mainContent_) {
- f32 mainContentHeight = bounds.height - StatusBar::HEIGHT - drawerHeight;
+ f32 mainContentHeight = bounds.height - EditorToolbar::HEIGHT - StatusBar::HEIGHT - drawerHeight;
ui::Rect mainBounds{
bounds.x,
- bounds.y,
+ bounds.y + EditorToolbar::HEIGHT,
bounds.width,
mainContentHeight
};
@@ -217,7 +230,11 @@ void EditorRootContainer::updateLayout() {
// Rendering
// =============================================================================
-void EditorRootContainer::render(ui::UIBatchRenderer& renderer) {
+void EditorRootContainer::renderTree(ui::UIBatchRenderer& renderer) {
+ if (!isVisible()) return;
+
+ toolbar_->renderTree(renderer);
+
if (mainContent_) {
mainContent_->renderTree(renderer);
}
@@ -238,6 +255,10 @@ ui::Widget* EditorRootContainer::hitTest(f32 x, f32 y) {
return nullptr;
}
+ if (auto* hit = toolbar_->hitTest(x, y)) {
+ return hit;
+ }
+
if (auto* hit = statusBar_->hitTest(x, y)) {
return hit;
}
diff --git a/src/esengine/editor/widgets/EditorRootContainer.hpp b/src/esengine/editor/widgets/EditorRootContainer.hpp
index ba162c328..ce9de30bb 100644
--- a/src/esengine/editor/widgets/EditorRootContainer.hpp
+++ b/src/esengine/editor/widgets/EditorRootContainer.hpp
@@ -16,6 +16,7 @@
#include "../../ui/widgets/Widget.hpp"
#include "../../events/Signal.hpp"
+#include "EditorToolbar.hpp"
#include "StatusBar.hpp"
#include "DrawerPanel.hpp"
@@ -45,18 +46,20 @@ public:
void toggleOutputDrawer();
bool isOutputDrawerOpen() const;
+ EditorToolbar* getToolbar() const { return toolbar_; }
StatusBar* getStatusBar() const { return statusBar_; }
DrawerPanel* getAssetsDrawer() const { return assetsDrawer_; }
DrawerPanel* getOutputDrawer() const { return outputDrawer_; }
glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
void layout(const ui::Rect& bounds) override;
- void render(ui::UIBatchRenderer& renderer) override;
+ void renderTree(ui::UIBatchRenderer& renderer) override;
Widget* hitTest(f32 x, f32 y) override;
private:
void updateLayout();
+ EditorToolbar* toolbar_ = nullptr;
Widget* mainContent_ = nullptr;
StatusBar* statusBar_ = nullptr;
DrawerPanel* assetsDrawer_ = nullptr;
diff --git a/src/esengine/editor/widgets/EditorToolbar.cpp b/src/esengine/editor/widgets/EditorToolbar.cpp
new file mode 100644
index 000000000..41498aa8f
--- /dev/null
+++ b/src/esengine/editor/widgets/EditorToolbar.cpp
@@ -0,0 +1,169 @@
+/**
+ * @file EditorToolbar.cpp
+ * @brief Editor toolbar implementation
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+
+#include "EditorToolbar.hpp"
+#include "../../ui/UIContext.hpp"
+#include "../../ui/rendering/UIBatchRenderer.hpp"
+#include "../../ui/icons/Icons.hpp"
+
+#if ES_FEATURE_SDF_FONT
+#include "../../ui/font/MSDFFont.hpp"
+#endif
+
+namespace esengine::editor {
+
+namespace icons = ui::icons;
+
+// =============================================================================
+// Constructor
+// =============================================================================
+
+EditorToolbar::EditorToolbar(const ui::WidgetId& id) : Widget(id) {}
+
+// =============================================================================
+// State Control
+// =============================================================================
+
+void EditorToolbar::play() {
+ if (state_ != PlayState::Playing) {
+ state_ = PlayState::Playing;
+ onPlay.publish();
+ }
+}
+
+void EditorToolbar::pause() {
+ if (state_ == PlayState::Playing) {
+ state_ = PlayState::Paused;
+ onPause.publish();
+ }
+}
+
+void EditorToolbar::stop() {
+ if (state_ != PlayState::Stopped) {
+ state_ = PlayState::Stopped;
+ onStop.publish();
+ }
+}
+
+// =============================================================================
+// Layout
+// =============================================================================
+
+glm::vec2 EditorToolbar::measure(f32 availableWidth, f32 availableHeight) {
+ (void)availableHeight;
+ return {availableWidth, HEIGHT};
+}
+
+// =============================================================================
+// Rendering
+// =============================================================================
+
+void EditorToolbar::render(ui::UIBatchRenderer& renderer) {
+ ui::UIContext* ctx = getContext();
+ if (!ctx) return;
+
+ const ui::Rect& bounds = getBounds();
+ updateButtonBounds();
+
+ constexpr glm::vec4 bgColor{0.145f, 0.145f, 0.149f, 1.0f};
+ constexpr glm::vec4 borderColor{0.235f, 0.235f, 0.235f, 1.0f};
+ constexpr glm::vec4 buttonBg{0.235f, 0.235f, 0.235f, 1.0f};
+ constexpr glm::vec4 buttonHover{0.3f, 0.3f, 0.3f, 1.0f};
+ constexpr glm::vec4 playingBg{0.231f, 0.510f, 0.965f, 1.0f};
+ constexpr glm::vec4 pausedBg{0.988f, 0.722f, 0.067f, 1.0f};
+ constexpr glm::vec4 textColor{0.878f, 0.878f, 0.878f, 1.0f};
+
+ renderer.drawRect(bounds, bgColor);
+
+ ui::Rect bottomBorder{bounds.x, bounds.y + bounds.height - 1.0f, bounds.width, 1.0f};
+ renderer.drawRect(bottomBorder, borderColor);
+
+#if ES_FEATURE_SDF_FONT
+ ui::MSDFFont* iconFont = ctx->getIconMSDFFont();
+ if (!iconFont) return;
+
+ auto drawButton = [&](const ButtonState& btn, const std::string& icon, bool active, const glm::vec4& activeBg) {
+ glm::vec4 bg = active ? activeBg : (btn.hovered ? buttonHover : buttonBg);
+ renderer.drawRoundedRect(btn.bounds, bg, ui::CornerRadii::all(4.0f));
+ renderer.drawTextInBounds(icon, btn.bounds, *iconFont, 16.0f, textColor,
+ ui::HAlign::Center, ui::VAlign::Center);
+ };
+
+ bool playing = state_ == PlayState::Playing;
+ bool paused = state_ == PlayState::Paused;
+
+ drawButton(playButton_, icons::Play, playing, playingBg);
+ drawButton(pauseButton_, icons::Pause, paused, pausedBg);
+ drawButton(stopButton_, icons::Square, false, buttonBg);
+#endif
+}
+
+// =============================================================================
+// Event Handling
+// =============================================================================
+
+bool EditorToolbar::onMouseDown(const ui::MouseButtonEvent& event) {
+ if (event.button != ui::MouseButton::Left) return false;
+
+ if (playButton_.bounds.contains(event.x, event.y)) {
+ if (state_ == PlayState::Paused) {
+ play();
+ } else if (state_ == PlayState::Stopped) {
+ play();
+ }
+ return true;
+ }
+
+ if (pauseButton_.bounds.contains(event.x, event.y)) {
+ if (state_ == PlayState::Playing) {
+ pause();
+ } else if (state_ == PlayState::Paused) {
+ play();
+ }
+ return true;
+ }
+
+ if (stopButton_.bounds.contains(event.x, event.y)) {
+ stop();
+ return true;
+ }
+
+ return false;
+}
+
+bool EditorToolbar::onMouseMove(const ui::MouseMoveEvent& event) {
+ playButton_.hovered = playButton_.bounds.contains(event.x, event.y);
+ pauseButton_.hovered = pauseButton_.bounds.contains(event.x, event.y);
+ stopButton_.hovered = stopButton_.bounds.contains(event.x, event.y);
+ return false;
+}
+
+// =============================================================================
+// Private Methods
+// =============================================================================
+
+void EditorToolbar::updateButtonBounds() {
+ const ui::Rect& bounds = getBounds();
+
+ constexpr f32 buttonSize = 28.0f;
+ constexpr f32 buttonGap = 4.0f;
+ constexpr f32 groupWidth = buttonSize * 3 + buttonGap * 2;
+
+ f32 centerX = bounds.x + bounds.width * 0.5f;
+ f32 startX = centerX - groupWidth * 0.5f;
+ f32 centerY = bounds.y + (bounds.height - buttonSize) * 0.5f;
+
+ playButton_.bounds = ui::Rect{startX, centerY, buttonSize, buttonSize};
+ pauseButton_.bounds = ui::Rect{startX + buttonSize + buttonGap, centerY, buttonSize, buttonSize};
+ stopButton_.bounds = ui::Rect{startX + (buttonSize + buttonGap) * 2, centerY, buttonSize, buttonSize};
+}
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/widgets/EditorToolbar.hpp b/src/esengine/editor/widgets/EditorToolbar.hpp
new file mode 100644
index 000000000..66704927c
--- /dev/null
+++ b/src/esengine/editor/widgets/EditorToolbar.hpp
@@ -0,0 +1,75 @@
+/**
+ * @file EditorToolbar.hpp
+ * @brief Editor toolbar with play/pause/stop controls
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+#pragma once
+
+// =============================================================================
+// Includes
+// =============================================================================
+
+#include "../../ui/widgets/Widget.hpp"
+#include "../../events/Signal.hpp"
+
+namespace esengine::editor {
+
+// =============================================================================
+// PlayState Enum
+// =============================================================================
+
+enum class PlayState : u8 {
+ Stopped,
+ Playing,
+ Paused
+};
+
+// =============================================================================
+// EditorToolbar Class
+// =============================================================================
+
+class EditorToolbar : public ui::Widget {
+public:
+ static constexpr f32 HEIGHT = 40.0f;
+
+ explicit EditorToolbar(const ui::WidgetId& id);
+
+ PlayState getPlayState() const { return state_; }
+ bool isPlaying() const { return state_ == PlayState::Playing; }
+ bool isPaused() const { return state_ == PlayState::Paused; }
+ bool isStopped() const { return state_ == PlayState::Stopped; }
+
+ void play();
+ void pause();
+ void stop();
+
+ Signal<void()> onPlay;
+ Signal<void()> onPause;
+ Signal<void()> onStop;
+
+ glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
+ void render(ui::UIBatchRenderer& renderer) override;
+ bool onMouseDown(const ui::MouseButtonEvent& event) override;
+ bool onMouseMove(const ui::MouseMoveEvent& event) override;
+
+private:
+ void updateButtonBounds();
+
+ PlayState state_ = PlayState::Stopped;
+
+ struct ButtonState {
+ ui::Rect bounds;
+ bool hovered = false;
+ };
+
+ ButtonState playButton_;
+ ButtonState pauseButton_;
+ ButtonState stopButton_;
+};
+
+} // namespace esengine::editor