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.

style: Improve project launcher and dialog UI

esenginebb45ae5d5023
diff --git a/src/esengine/editor/panels/NewProjectDialog.cpp b/src/esengine/editor/panels/NewProjectDialog.cpp
index 50dff4ecd..afc705d29 100644
--- a/src/esengine/editor/panels/NewProjectDialog.cpp
+++ b/src/esengine/editor/panels/NewProjectDialog.cpp
@@ -39,37 +39,41 @@ NewProjectDialog::~NewProjectDialog() = default;
void NewProjectDialog::setupUI() {
auto dialogPanel = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".dialog"));
- dialogPanel->setBackgroundColor(glm::vec4(0.2f, 0.2f, 0.2f, 1.0f));
- dialogPanel->setCornerRadii(ui::CornerRadii::all(8.0f));
- dialogPanel->setWidth(ui::SizeValue::px(450.0f));
- dialogPanel->setHeight(ui::SizeValue::px(280.0f));
+ dialogPanel->setBackgroundColor(glm::vec4(0.18f, 0.18f, 0.20f, 1.0f));
+ dialogPanel->setCornerRadii(ui::CornerRadii::all(12.0f));
+ dialogPanel->setWidth(ui::SizeValue::px(480.0f));
+ dialogPanel->setHeight(ui::SizeValue::px(340.0f));
- auto layout = makeUnique<ui::StackLayout>(ui::StackDirection::Vertical, 16.0f);
+ auto layout = makeUnique<ui::StackLayout>(ui::StackDirection::Vertical, 12.0f);
dialogPanel->setLayout(std::move(layout));
- dialogPanel->setPadding(ui::Insets(24.0f, 24.0f, 24.0f, 24.0f));
+ dialogPanel->setPadding(ui::Insets(32.0f, 32.0f, 32.0f, 32.0f));
- auto titleLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + ".title"), "New Project");
- titleLabel->setFontSize(24.0f);
+ auto titleLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + ".title"), "Create New Project");
+ titleLabel->setFontSize(22.0f);
titleLabel->setColor(glm::vec4(1.0f));
titleLabel_ = titleLabel.get();
dialogPanel->addChild(std::move(titleLabel));
+ auto spacer1 = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".spacer1"));
+ spacer1->setHeight(ui::SizeValue::px(8.0f));
+ dialogPanel->addChild(std::move(spacer1));
+
auto nameLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + ".name_label"), "Project Name");
- nameLabel->setFontSize(14.0f);
- nameLabel->setColor(glm::vec4(0.8f, 0.8f, 0.8f, 1.0f));
+ nameLabel->setFontSize(13.0f);
+ nameLabel->setColor(glm::vec4(0.7f, 0.7f, 0.7f, 1.0f));
nameLabel_ = nameLabel.get();
dialogPanel->addChild(std::move(nameLabel));
auto nameField = makeUnique<ui::TextField>(ui::WidgetId(getId().path + ".name_field"));
nameField->setPlaceholder("MyGame");
nameField->setWidth(ui::SizeValue::percent(100.0f));
- nameField->setHeight(ui::SizeValue::px(36.0f));
+ nameField->setHeight(ui::SizeValue::px(38.0f));
nameField_ = nameField.get();
dialogPanel->addChild(std::move(nameField));
auto pathLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + ".path_label"), "Location");
- pathLabel->setFontSize(14.0f);
- pathLabel->setColor(glm::vec4(0.8f, 0.8f, 0.8f, 1.0f));
+ pathLabel->setFontSize(13.0f);
+ pathLabel->setColor(glm::vec4(0.7f, 0.7f, 0.7f, 1.0f));
pathLabel_ = pathLabel.get();
dialogPanel->addChild(std::move(pathLabel));
@@ -77,19 +81,19 @@ void NewProjectDialog::setupUI() {
auto pathRowLayout = makeUnique<ui::StackLayout>(ui::StackDirection::Horizontal, 8.0f);
pathRow->setLayout(std::move(pathRowLayout));
pathRow->setWidth(ui::SizeValue::percent(100.0f));
- pathRow->setHeight(ui::SizeValue::px(36.0f));
+ pathRow->setHeight(ui::SizeValue::px(38.0f));
auto pathField = makeUnique<ui::TextField>(ui::WidgetId(getId().path + ".path_field"));
pathField->setPlaceholder("Select folder...");
pathField->setWidth(ui::SizeValue::px(320.0f));
- pathField->setHeight(ui::SizeValue::px(36.0f));
+ pathField->setHeight(ui::SizeValue::px(38.0f));
pathField_ = pathField.get();
pathRow->addChild(std::move(pathField));
- auto browseButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + ".browse"), "Browse");
+ auto browseButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + ".browse"), "Browse...");
browseButton->setButtonStyle(ui::ButtonStyle::Secondary);
- browseButton->setWidth(ui::SizeValue::px(80.0f));
- browseButton->setHeight(ui::SizeValue::px(36.0f));
+ browseButton->setWidth(ui::SizeValue::px(90.0f));
+ browseButton->setHeight(ui::SizeValue::px(38.0f));
browseButton_ = browseButton.get();
connections_.push_back(
sink(browseButton_->onClick).connect([this]() { onBrowseClicked(); }));
@@ -97,27 +101,28 @@ void NewProjectDialog::setupUI() {
dialogPanel->addChild(std::move(pathRow));
- auto spacer = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".spacer"));
- spacer->setHeight(ui::SizeValue::px(16.0f));
- dialogPanel->addChild(std::move(spacer));
+ auto spacer2 = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".spacer2"));
+ spacer2->setHeight(ui::SizeValue::px(24.0f));
+ dialogPanel->addChild(std::move(spacer2));
auto buttonRow = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".buttons"));
auto buttonLayout = makeUnique<ui::StackLayout>(ui::StackDirection::Horizontal, 12.0f);
buttonRow->setLayout(std::move(buttonLayout));
+ buttonRow->setHeight(ui::SizeValue::px(42.0f));
auto cancelButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + ".cancel"), "Cancel");
cancelButton->setButtonStyle(ui::ButtonStyle::Secondary);
- cancelButton->setWidth(ui::SizeValue::px(100.0f));
- cancelButton->setHeight(ui::SizeValue::px(40.0f));
+ cancelButton->setWidth(ui::SizeValue::px(110.0f));
+ cancelButton->setHeight(ui::SizeValue::px(42.0f));
cancelButton_ = cancelButton.get();
connections_.push_back(
sink(cancelButton_->onClick).connect([this]() { onCancelClicked(); }));
buttonRow->addChild(std::move(cancelButton));
- auto createButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + ".create"), "Create");
+ auto createButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + ".create"), "Create Project");
createButton->setButtonStyle(ui::ButtonStyle::Primary);
- createButton->setWidth(ui::SizeValue::px(100.0f));
- createButton->setHeight(ui::SizeValue::px(40.0f));
+ createButton->setWidth(ui::SizeValue::px(130.0f));
+ createButton->setHeight(ui::SizeValue::px(42.0f));
createButton_ = createButton.get();
connections_.push_back(
sink(createButton_->onClick).connect([this]() { onCreateClicked(); }));
@@ -196,8 +201,8 @@ void NewProjectDialog::layout(const ui::Rect& bounds) {
Widget::layout(bounds);
if (dialogPanel_) {
- f32 dialogWidth = 450.0f;
- f32 dialogHeight = 280.0f;
+ f32 dialogWidth = 480.0f;
+ f32 dialogHeight = 340.0f;
f32 dialogX = bounds.x + (bounds.width - dialogWidth) / 2.0f;
f32 dialogY = bounds.y + (bounds.height - dialogHeight) / 2.0f;
dialogPanel_->layout(ui::Rect{dialogX, dialogY, dialogWidth, dialogHeight});
diff --git a/src/esengine/editor/panels/ProjectLauncherPanel.cpp b/src/esengine/editor/panels/ProjectLauncherPanel.cpp
index 1921de19c..43bfd6664 100644
--- a/src/esengine/editor/panels/ProjectLauncherPanel.cpp
+++ b/src/esengine/editor/panels/ProjectLauncherPanel.cpp
@@ -44,89 +44,106 @@ ProjectLauncherPanel::~ProjectLauncherPanel() = default;
// =============================================================================
void ProjectLauncherPanel::setupUI() {
- auto mainPanel = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".main"));
-
- auto layout = makeUnique<ui::StackLayout>(ui::StackDirection::Vertical, 16.0f);
- mainPanel->setLayout(std::move(layout));
- mainPanel->setPadding(ui::Insets(40.0f, 60.0f, 40.0f, 60.0f));
-
- auto titleLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + ".title"), "ESEngine");
- titleLabel->setFontSize(36.0f);
+ // Left panel - branding and actions
+ auto leftPanel = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".left"));
+ leftPanel->setBackgroundColor(glm::vec4(0.08f, 0.08f, 0.10f, 1.0f));
+ auto leftLayout = makeUnique<ui::StackLayout>(ui::StackDirection::Vertical, 8.0f);
+ leftPanel->setLayout(std::move(leftLayout));
+ leftPanel->setPadding(ui::Insets(60.0f, 50.0f, 40.0f, 50.0f));
+ leftPanel_ = leftPanel.get();
+
+ auto titleLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + ".title"), "ESENGINE");
+ titleLabel->setFontSize(42.0f);
titleLabel->setColor(glm::vec4(1.0f));
titleLabel_ = titleLabel.get();
- mainPanel->addChild(std::move(titleLabel));
+ leftPanel->addChild(std::move(titleLabel));
auto subtitleLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + ".subtitle"),
- "Game Engine");
- subtitleLabel->setFontSize(16.0f);
- subtitleLabel->setColor(glm::vec4(0.6f, 0.6f, 0.6f, 1.0f));
+ "Game Development Platform");
+ subtitleLabel->setFontSize(14.0f);
+ subtitleLabel->setColor(glm::vec4(0.5f, 0.5f, 0.5f, 1.0f));
subtitleLabel_ = subtitleLabel.get();
- mainPanel->addChild(std::move(subtitleLabel));
+ leftPanel->addChild(std::move(subtitleLabel));
auto spacer1 = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".spacer1"));
- spacer1->setHeight(ui::SizeValue::px(20.0f));
- mainPanel->addChild(std::move(spacer1));
-
- auto buttonContainer = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".buttons"));
- auto buttonLayout = makeUnique<ui::StackLayout>(ui::StackDirection::Horizontal, 16.0f);
- buttonContainer->setLayout(std::move(buttonLayout));
+ spacer1->setHeight(ui::SizeValue::px(60.0f));
+ leftPanel->addChild(std::move(spacer1));
auto newProjectButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + ".new"),
"New Project");
newProjectButton->setButtonStyle(ui::ButtonStyle::Primary);
- newProjectButton->setWidth(ui::SizeValue::px(140.0f));
- newProjectButton->setHeight(ui::SizeValue::px(40.0f));
+ newProjectButton->setWidth(ui::SizeValue::px(220.0f));
+ newProjectButton->setHeight(ui::SizeValue::px(48.0f));
+ newProjectButton->setFontSize(15.0f);
+ newProjectButton->setCornerRadii(ui::CornerRadii::all(6.0f));
newProjectButton_ = newProjectButton.get();
connections_.push_back(
sink(newProjectButton_->onClick).connect([this]() {
ES_LOG_INFO("ProjectLauncher: New project requested");
onCreateProjectRequested.publish();
}));
- buttonContainer->addChild(std::move(newProjectButton));
+ leftPanel->addChild(std::move(newProjectButton));
+
+ auto spacer2 = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".spacer2"));
+ spacer2->setHeight(ui::SizeValue::px(12.0f));
+ leftPanel->addChild(std::move(spacer2));
auto openProjectButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + ".open"),
"Open Project");
openProjectButton->setButtonStyle(ui::ButtonStyle::Secondary);
- openProjectButton->setWidth(ui::SizeValue::px(140.0f));
- openProjectButton->setHeight(ui::SizeValue::px(40.0f));
+ openProjectButton->setWidth(ui::SizeValue::px(220.0f));
+ openProjectButton->setHeight(ui::SizeValue::px(48.0f));
+ openProjectButton->setFontSize(15.0f);
+ openProjectButton->setCornerRadii(ui::CornerRadii::all(6.0f));
openProjectButton_ = openProjectButton.get();
connections_.push_back(
sink(openProjectButton_->onClick).connect([this]() {
ES_LOG_INFO("ProjectLauncher: Browse project requested");
onBrowseProjectRequested.publish();
}));
- buttonContainer->addChild(std::move(openProjectButton));
+ leftPanel->addChild(std::move(openProjectButton));
- mainPanel->addChild(std::move(buttonContainer));
+ auto versionLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + ".version"),
+ "Version 1.0.0");
+ versionLabel->setFontSize(11.0f);
+ versionLabel->setColor(glm::vec4(0.35f, 0.35f, 0.35f, 1.0f));
+ versionLabel_ = versionLabel.get();
+ leftPanel->addChild(std::move(versionLabel));
- auto spacer2 = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".spacer2"));
- spacer2->setHeight(ui::SizeValue::px(30.0f));
- mainPanel->addChild(std::move(spacer2));
+ addChild(std::move(leftPanel));
+
+ // Right panel - recent projects
+ auto rightPanel = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".right"));
+ rightPanel->setBackgroundColor(glm::vec4(0.11f, 0.11f, 0.13f, 1.0f));
+ auto rightLayout = makeUnique<ui::StackLayout>(ui::StackDirection::Vertical, 16.0f);
+ rightPanel->setLayout(std::move(rightLayout));
+ rightPanel->setPadding(ui::Insets(40.0f, 40.0f, 40.0f, 40.0f));
+ rightPanel_ = rightPanel.get();
auto recentLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + ".recent_label"),
"Recent Projects");
recentLabel->setFontSize(18.0f);
- recentLabel->setColor(glm::vec4(0.8f, 0.8f, 0.8f, 1.0f));
+ recentLabel->setColor(glm::vec4(0.9f, 0.9f, 0.9f, 1.0f));
recentLabel_ = recentLabel.get();
- mainPanel->addChild(std::move(recentLabel));
+ rightPanel->addChild(std::move(recentLabel));
auto recentScrollView = makeUnique<ui::ScrollView>(
ui::WidgetId(getId().path + ".recent_scroll"));
recentScrollView->setScrollDirection(ui::ScrollDirection::Vertical);
recentScrollView->setShowScrollbars(true);
- recentScrollView->setWidth(ui::SizeValue::px(400.0f));
- recentScrollView->setHeight(ui::SizeValue::px(300.0f));
+ recentScrollView->setWidth(ui::SizeValue::percent(100.0f));
+ recentScrollView->setHeight(ui::SizeValue::percent(100.0f));
recentScrollView_ = recentScrollView.get();
auto recentListPanel = makeUnique<ui::Panel>(ui::WidgetId(getId().path + ".recent_list"));
- auto listLayout = makeUnique<ui::StackLayout>(ui::StackDirection::Vertical, 4.0f);
+ auto listLayout = makeUnique<ui::StackLayout>(ui::StackDirection::Vertical, 8.0f);
recentListPanel->setLayout(std::move(listLayout));
recentListPanel_ = recentListPanel.get();
recentScrollView->setContent(std::move(recentListPanel));
- mainPanel->addChild(std::move(recentScrollView));
+ rightPanel->addChild(std::move(recentScrollView));
- addChild(std::move(mainPanel));
+ addChild(std::move(rightPanel));
}
// =============================================================================
@@ -161,11 +178,11 @@ void ProjectLauncherPanel::createRecentProjectItem(const RecentProject& project,
std::string projectPath = project.path;
auto itemButton = makeUnique<ui::Button>(ui::WidgetId(itemId), project.name);
- itemButton->setButtonStyle(ui::ButtonStyle::Text);
+ itemButton->setButtonStyle(ui::ButtonStyle::Secondary);
itemButton->setWidth(ui::SizeValue::percent(100.0f));
- itemButton->setHeight(ui::SizeValue::px(50.0f));
+ itemButton->setHeight(ui::SizeValue::px(56.0f));
itemButton->setFontSize(14.0f);
- itemButton->setCornerRadii(ui::CornerRadii::all(4.0f));
+ itemButton->setCornerRadii(ui::CornerRadii::all(6.0f));
connections_.push_back(
sink(itemButton->onClick).connect([this, projectPath]() {
@@ -187,15 +204,15 @@ glm::vec2 ProjectLauncherPanel::measure(f32 availableWidth, f32 availableHeight)
void ProjectLauncherPanel::layout(const ui::Rect& bounds) {
Widget::layout(bounds);
- if (getChildCount() > 0) {
- auto* mainPanel = getChild(0);
- if (mainPanel) {
- f32 panelWidth = std::min(bounds.width, 600.0f);
- f32 panelHeight = bounds.height;
- f32 panelX = bounds.x + (bounds.width - panelWidth) / 2.0f;
- f32 panelY = bounds.y;
- mainPanel->layout(ui::Rect{panelX, panelY, panelWidth, panelHeight});
- }
+ f32 leftWidth = std::max(320.0f, bounds.width * 0.35f);
+ f32 rightWidth = bounds.width - leftWidth;
+
+ if (leftPanel_) {
+ leftPanel_->layout(ui::Rect{bounds.x, bounds.y, leftWidth, bounds.height});
+ }
+
+ if (rightPanel_) {
+ rightPanel_->layout(ui::Rect{bounds.x + leftWidth, bounds.y, rightWidth, bounds.height});
}
}
diff --git a/src/esengine/editor/panels/ProjectLauncherPanel.hpp b/src/esengine/editor/panels/ProjectLauncherPanel.hpp
index 5feac8faf..8f8ee5b85 100644
--- a/src/esengine/editor/panels/ProjectLauncherPanel.hpp
+++ b/src/esengine/editor/panels/ProjectLauncherPanel.hpp
@@ -77,8 +77,11 @@ private:
ProjectManager& project_manager_;
Dispatcher& dispatcher_;
+ ui::Panel* leftPanel_ = nullptr;
+ ui::Panel* rightPanel_ = nullptr;
ui::Label* titleLabel_ = nullptr;
ui::Label* subtitleLabel_ = nullptr;
+ ui::Label* versionLabel_ = nullptr;
ui::Button* newProjectButton_ = nullptr;
ui::Button* openProjectButton_ = nullptr;
ui::Label* recentLabel_ = nullptr;