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: redesign launcher with sidebar layout and example browser

esenginea62a5e363545
diff --git a/build-tools/tasks/examples.js b/build-tools/tasks/examples.js
index 3f7a7b1cd..901e455e8 100644
--- a/build-tools/tasks/examples.js
+++ b/build-tools/tasks/examples.js
@@ -3,16 +3,28 @@
* @brief Pack example projects into zip files for editor
*/
-import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'fs';
+import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync, copyFileSync } from 'fs';
import path from 'path';
import { deflateRawSync } from 'zlib';
import * as logger from '../utils/logger.js';
-const EXAMPLES = [
- { name: 'space-shooter', dir: 'examples/space-shooter' },
-];
-
+const EXAMPLES_DIR = 'examples';
const OUTPUT_DIR = 'desktop/public/examples';
+const THUMBNAILS_DIR = 'thumbnails';
+const THUMBNAIL_FILENAME = 'thumbnail.png';
+
+function discoverExamples(rootDir) {
+ const examplesPath = path.join(rootDir, EXAMPLES_DIR);
+ if (!existsSync(examplesPath)) return [];
+
+ return readdirSync(examplesPath)
+ .filter(entry => {
+ const fullPath = path.join(examplesPath, entry);
+ return statSync(fullPath).isDirectory() &&
+ existsSync(path.join(fullPath, 'project.esproject'));
+ })
+ .map(name => ({ name, dir: path.join(EXAMPLES_DIR, name) }));
+}
const EXCLUDE_PATTERNS = [
'.DS_Store',
@@ -122,25 +134,38 @@ function createZip(srcDir, outputPath) {
export async function zipExamples(rootDir) {
logger.step('Packing example projects...');
+ const examples = discoverExamples(rootDir);
+ if (examples.length === 0) {
+ logger.warn('No example projects found');
+ return;
+ }
+
const outDir = path.join(rootDir, OUTPUT_DIR);
if (!existsSync(outDir)) {
mkdirSync(outDir, { recursive: true });
}
- for (const example of EXAMPLES) {
+ const thumbDir = path.join(outDir, THUMBNAILS_DIR);
+ if (!existsSync(thumbDir)) {
+ mkdirSync(thumbDir, { recursive: true });
+ }
+
+ for (const example of examples) {
const srcDir = path.join(rootDir, example.dir);
const zipPath = path.join(outDir, `${example.name}.zip`);
- if (!existsSync(srcDir)) {
- logger.warn(`Example not found: ${srcDir}`);
- continue;
- }
-
try {
createZip(srcDir, zipPath);
logger.success(`${example.name}.zip`);
} catch (err) {
logger.error(`Failed to zip ${example.name}: ${err.message}`);
}
+
+ const thumbSrc = path.join(srcDir, THUMBNAIL_FILENAME);
+ if (existsSync(thumbSrc)) {
+ const thumbDest = path.join(thumbDir, `${example.name}.png`);
+ copyFileSync(thumbSrc, thumbDest);
+ logger.success(`${example.name} thumbnail`);
+ }
}
}
diff --git a/editor/src/launcher/CreateFromExampleDialog.ts b/editor/src/launcher/CreateFromExampleDialog.ts
new file mode 100644
index 000000000..479116ecd
--- /dev/null
+++ b/editor/src/launcher/CreateFromExampleDialog.ts
@@ -0,0 +1,166 @@
+/**
+ * @file CreateFromExampleDialog.ts
+ * @brief Simplified dialog for creating a project from an example (name + location only)
+ */
+
+import type { ExampleProjectInfo } from '../types/ProjectTypes';
+import { createFromExample, selectProjectLocation } from './ProjectService';
+
+// =============================================================================
+// Types
+// =============================================================================
+
+export interface CreateFromExampleDialogOptions {
+ example: ExampleProjectInfo;
+ onClose: () => void;
+ onProjectCreated: (projectPath: string) => void;
+}
+
+// =============================================================================
+// CreateFromExampleDialog
+// =============================================================================
+
+export class CreateFromExampleDialog {
+ private overlay_: HTMLElement;
+ private options_: CreateFromExampleDialogOptions;
+ private projectLocation_ = '';
+
+ constructor(options: CreateFromExampleDialogOptions) {
+ this.options_ = options;
+
+ this.overlay_ = document.createElement('div');
+ this.overlay_.className = 'es-dialog-overlay';
+ document.body.appendChild(this.overlay_);
+
+ this.render();
+ this.setupEvents();
+ }
+
+ dispose(): void {
+ this.overlay_.remove();
+ }
+
+ private render(): void {
+ const { example } = this.options_;
+ const defaultName = example.name.replace(/\s+/g, '');
+
+ this.overlay_.innerHTML = `
+ <div class="es-dialog">
+ <div class="es-dialog-header">
+ <span class="es-dialog-title">Create from Example</span>
+ <button class="es-dialog-close" data-action="close">&times;</button>
+ </div>
+ <div class="es-dialog-body">
+ <div class="es-dialog-field">
+ <label class="es-dialog-label">Example</label>
+ <div class="es-dialog-example-info">
+ <span class="es-dialog-example-name">${this.escapeHtml(example.name)}</span>
+ <span class="es-dialog-example-desc">${this.escapeHtml(example.description)}</span>
+ </div>
+ </div>
+ <div class="es-dialog-field">
+ <label class="es-dialog-label">Project Name</label>
+ <input type="text" class="es-dialog-input" id="example-project-name"
+ placeholder="My Game" value="${defaultName}">
+ </div>
+ <div class="es-dialog-field">
+ <label class="es-dialog-label">Location</label>
+ <div class="es-dialog-path-row">
+ <input type="text" class="es-dialog-input es-dialog-path"
+ id="example-project-location" placeholder="Select a folder..." readonly>
+ <button class="es-dialog-browse" data-action="browse">...</button>
+ </div>
+ </div>
+ </div>
+ <div class="es-dialog-footer">
+ <button class="es-dialog-btn" data-action="cancel">Cancel</button>
+ <button class="es-dialog-btn es-dialog-btn-primary" data-action="create">Create Project</button>
+ </div>
+ </div>
+ `;
+ }
+
+ private setupEvents(): void {
+ this.overlay_.addEventListener('click', (e) => {
+ const target = e.target as HTMLElement;
+ const action = target.dataset.action ?? target.closest('[data-action]')?.getAttribute('data-action');
+
+ if (action === 'close' || action === 'cancel') {
+ this.options_.onClose();
+ } else if (action === 'browse') {
+ this.handleBrowse();
+ } else if (action === 'create') {
+ this.handleCreate();
+ }
+ });
+
+ const keyHandler = (e: KeyboardEvent) => {
+ if (e.key === 'Escape') {
+ this.options_.onClose();
+ document.removeEventListener('keydown', keyHandler);
+ }
+ };
+ document.addEventListener('keydown', keyHandler);
+ }
+
+ private async handleBrowse(): Promise<void> {
+ const path = await selectProjectLocation();
+ if (path) {
+ this.projectLocation_ = path;
+ const locationInput = this.overlay_.querySelector('#example-project-location') as HTMLInputElement;
+ if (locationInput) {
+ locationInput.value = path;
+ }
+ }
+ }
+
+ private async handleCreate(): Promise<void> {
+ const nameInput = this.overlay_.querySelector('#example-project-name') as HTMLInputElement;
+ const name = nameInput?.value.trim();
+
+ if (!name) {
+ alert('Please enter a project name');
+ nameInput?.focus();
+ return;
+ }
+
+ if (!this.projectLocation_) {
+ alert('Please select a project location');
+ return;
+ }
+
+ if (!/^[a-zA-Z0-9_-]+$/.test(name)) {
+ alert('Project name can only contain letters, numbers, underscores, and hyphens');
+ nameInput?.focus();
+ return;
+ }
+
+ const createBtn = this.overlay_.querySelector('[data-action="create"]') as HTMLButtonElement;
+ if (createBtn) {
+ createBtn.disabled = true;
+ createBtn.textContent = 'Creating...';
+ }
+
+ const result = await createFromExample({
+ name,
+ location: this.projectLocation_,
+ example: this.options_.example,
+ });
+
+ if (result.success && result.data) {
+ this.options_.onProjectCreated(result.data);
+ } else {
+ alert(result.error ?? 'Failed to create project');
+ if (createBtn) {
+ createBtn.disabled = false;
+ createBtn.textContent = 'Create Project';
+ }
+ }
+ }
+
+ private escapeHtml(text: string): string {
+ const div = document.createElement('div');
+ div.textContent = text;
+ return div.innerHTML;
+ }
+}
diff --git a/editor/src/launcher/ExampleBrowser.ts b/editor/src/launcher/ExampleBrowser.ts
new file mode 100644
index 000000000..ba7a132a0
--- /dev/null
+++ b/editor/src/launcher/ExampleBrowser.ts
@@ -0,0 +1,216 @@
+/**
+ * @file ExampleBrowser.ts
+ * @brief Searchable, filterable example card grid for the Learn view
+ */
+
+import type { ExampleProjectInfo, ExampleCategory } from '../types/ProjectTypes';
+import { EXAMPLE_PROJECTS, EXAMPLE_CATEGORY_LABELS } from '../types/ProjectTypes';
+import { CreateFromExampleDialog } from './CreateFromExampleDialog';
+import { icons } from '../utils/icons';
+
+// =============================================================================
+// Types
+// =============================================================================
+
+export interface ExampleBrowserOptions {
+ onProjectOpen: (projectPath: string) => void;
+}
+
+// =============================================================================
+// ExampleBrowser
+// =============================================================================
+
+export class ExampleBrowser {
+ private container_: HTMLElement;
+ private options_: ExampleBrowserOptions;
+ private searchQuery_ = '';
+ private selectedCategory_: ExampleCategory | 'all' = 'all';
+ private dialog_: CreateFromExampleDialog | null = null;
+
+ constructor(container: HTMLElement, options: ExampleBrowserOptions) {
+ this.container_ = container;
+ this.options_ = options;
+ this.render();
+ }
+
+ dispose(): void {
+ this.dialog_?.dispose();
+ this.dialog_ = null;
+ this.container_.innerHTML = '';
+ }
+
+ private render(): void {
+ const categories = this.getAvailableCategories();
+
+ this.container_.innerHTML = `
+ <div class="es-example-browser">
+ <div class="es-example-toolbar">
+ <div class="es-example-search">
+ <span class="es-example-search-icon">${icons.search(14)}</span>
+ <input type="text" class="es-example-search-input"
+ placeholder="Search examples..." value="${this.escapeAttr(this.searchQuery_)}">
+ </div>
+ <select class="es-example-filter">
+ <option value="all" ${this.selectedCategory_ === 'all' ? 'selected' : ''}>All Categories</option>
+ ${categories.map(cat =>
+ `<option value="${cat}" ${this.selectedCategory_ === cat ? 'selected' : ''}>${EXAMPLE_CATEGORY_LABELS[cat]}</option>`
+ ).join('')}
+ </select>
+ </div>
+ <div class="es-example-list"></div>
+ </div>
+ `;
+
+ this.renderCards();
+ this.setupEvents();
+ }
+
+ private renderCards(): void {
+ const listEl = this.container_.querySelector('.es-example-list');
+ if (!listEl) return;
+
+ const filtered = this.getFilteredExamples();
+
+ if (filtered.length === 0) {
+ listEl.innerHTML = `<div class="es-example-empty">No examples match your search</div>`;
+ return;
+ }
+
+ if (this.searchQuery_) {
+ listEl.innerHTML = `
+ <div class="es-example-grid">
+ ${filtered.map(ex => this.renderCard(ex)).join('')}
+ </div>
+ `;
+ } else {
+ const grouped = this.groupByCategory(filtered);
+ listEl.innerHTML = Object.entries(grouped)
+ .map(([cat, examples]) => `
+ <div class="es-example-category-title">${EXAMPLE_CATEGORY_LABELS[cat as ExampleCategory]}</div>
+ <div class="es-example-grid">
+ ${examples.map(ex => this.renderCard(ex)).join('')}
+ </div>
+ `).join('');
+ }
+
+ listEl.querySelectorAll('.es-example-card').forEach(card => {
+ card.addEventListener('click', () => {
+ const id = (card as HTMLElement).dataset.exampleId;
+ const example = EXAMPLE_PROJECTS.find(ex => ex.id === id);
+ if (example) {
+ this.openCreateDialog(example);
+ }
+ });
+ });
+
+ listEl.querySelectorAll('.es-example-card-img').forEach(img => {
+ (img as HTMLImageElement).addEventListener('error', () => {
+ (img as HTMLElement).style.display = 'none';
+ const fallback = (img as HTMLElement).nextElementSibling as HTMLElement;
+ if (fallback) {
+ fallback.style.display = '';
+ }
+ });
+ });
+ }
+
+ private renderCard(example: ExampleProjectInfo): string {
+ return `
+ <div class="es-example-card" data-example-id="${example.id}">
+ <div class="es-example-card-thumb">
+ <img class="es-example-card-img" src="/${example.thumbnail}" alt="${this.escapeAttr(example.name)}">
+ <div class="es-example-card-thumb-fallback" style="display:none">${icons.image(48)}</div>
+ </div>
+ <div class="es-example-card-body">
+ <div class="es-example-card-title">${this.escapeHtml(example.name)}</div>
+ <div class="es-example-card-desc">${this.escapeHtml(example.description)}</div>
+ <div class="es-example-card-meta">
+ <span class="es-example-card-tag es-example-card-category">${EXAMPLE_CATEGORY_LABELS[example.category]}</span>
+ <span class="es-example-card-tag es-example-card-difficulty">${example.difficulty}</span>
+ </div>
+ </div>
+ </div>
+ `;
+ }
+
+ private setupEvents(): void {
+ const searchInput = this.container_.querySelector('.es-example-search-input') as HTMLInputElement;
+ const filterSelect = this.container_.querySelector('.es-example-filter') as HTMLSelectElement;
+
+ searchInput?.addEventListener('input', () => {
+ this.searchQuery_ = searchInput.value.trim();
+ this.renderCards();
+ });
+
+ filterSelect?.addEventListener('change', () => {
+ this.selectedCategory_ = filterSelect.value as ExampleCategory | 'all';
+ this.renderCards();
+ });
+ }
+
+ private getFilteredExamples(): ExampleProjectInfo[] {
+ let results = EXAMPLE_PROJECTS;
+
+ if (this.selectedCategory_ !== 'all') {
+ results = results.filter(ex => ex.category === this.selectedCategory_);
+ }
+
+ if (this.searchQuery_) {
+ const q = this.searchQuery_.toLowerCase();
+ results = results.filter(ex =>
+ ex.name.toLowerCase().includes(q) ||
+ ex.description.toLowerCase().includes(q) ||
+ ex.tags.some(tag => tag.toLowerCase().includes(q)) ||
+ ex.category.toLowerCase().includes(q)
+ );
+ }
+
+ return results;
+ }
+
+ private getAvailableCategories(): ExampleCategory[] {
+ const cats = new Set<ExampleCategory>();
+ for (const ex of EXAMPLE_PROJECTS) {
+ cats.add(ex.category);
+ }
+ return Array.from(cats);
+ }
+
+ private groupByCategory(examples: ExampleProjectInfo[]): Record<string, ExampleProjectInfo[]> {
+ const groups: Record<string, ExampleProjectInfo[]> = {};
+ for (const ex of examples) {
+ if (!groups[ex.category]) {
+ groups[ex.category] = [];
+ }
+ groups[ex.category].push(ex);
+ }
+ return groups;
+ }
+
+ private openCreateDialog(example: ExampleProjectInfo): void {
+ if (this.dialog_) return;
+
+ this.dialog_ = new CreateFromExampleDialog({
+ example,
+ onClose: () => {
+ this.dialog_?.dispose();
+ this.dialog_ = null;
+ },
+ onProjectCreated: (projectPath) => {
+ this.dialog_?.dispose();
+ this.dialog_ = null;
+ this.options_.onProjectOpen(projectPath);
+ },
+ });
+ }
+
+ private escapeHtml(text: string): string {
+ const div = document.createElement('div');
+ div.textContent = text;
+ return div.innerHTML;
+ }
+
+ private escapeAttr(text: string): string {
+ return text.replace(/&/g, '&amp;').replace(/"/g, '&quot;');
+ }
+}
diff --git a/editor/src/launcher/NewProjectDialog.ts b/editor/src/launcher/NewProjectDialog.ts
index 6b8b98209..dd5a0d68c 100644
--- a/editor/src/launcher/NewProjectDialog.ts
+++ b/editor/src/launcher/NewProjectDialog.ts
@@ -1,11 +1,11 @@
/**
* @file NewProjectDialog.ts
- * @brief New project creation dialog with Templates and Examples tabs
+ * @brief New project creation dialog with template selection
*/
-import type { ProjectTemplate, ExampleProjectInfo } from '../types/ProjectTypes';
-import { PROJECT_TEMPLATES, EXAMPLE_PROJECTS } from '../types/ProjectTypes';
-import { createProject, createFromExample, selectProjectLocation } from './ProjectService';
+import type { ProjectTemplate } from '../types/ProjectTypes';
+import { PROJECT_TEMPLATES } from '../types/ProjectTypes';
+import { createProject, selectProjectLocation } from './ProjectService';
// =============================================================================
// Types
@@ -16,8 +16,6 @@ export interface NewProjectDialogOptions {
onProjectCreated: (projectPath: string) => void;
}
-type DialogTab = 'templates' | 'examples';
-
// =============================================================================
// NewProjectDialog
// =============================================================================
@@ -26,9 +24,7 @@ export class NewProjectDialog {
private overlay_: HTMLElement;
private options_: NewProjectDialogOptions;
private selectedTemplate_: ProjectTemplate = 'empty';
- private selectedExample_: ExampleProjectInfo | null = EXAMPLE_PROJECTS[0] ?? null;
- private activeTab_: DialogTab = 'templates';
- private projectLocation_: string = '';
+ private projectLocation_ = '';
constructor(options: NewProjectDialogOptions) {
this.options_ = options;
@@ -50,15 +46,9 @@ export class NewProjectDialog {
<div class="es-dialog">
<div class="es-dialog-header">
<span class="es-dialog-title">New Project</span>
- <button class="es-dialog-close" data-action="close">×</button>
+ <button class="es-dialog-close" data-action="close">&times;</button>
</div>
<div class="es-dialog-body">
- <div class="es-dialog-tabs">
- <button class="es-dialog-tab ${this.activeTab_ === 'templates' ? 'active' : ''}"
- data-tab="templates">Templates</button>
- <button class="es-dialog-tab ${this.activeTab_ === 'examples' ? 'active' : ''}"
- data-tab="examples">Examples</button>
- </div>
<div class="es-dialog-field">
<label class="es-dialog-label">Project Name</label>
<input type="text" class="es-dialog-input" id="project-name"
@@ -72,7 +62,7 @@ export class NewProjectDialog {
<button class="es-dialog-browse" data-action="browse">...</button>
</div>
</div>
- ${this.renderTabContent()}
+ ${this.renderTemplates()}
</div>
<div class="es-dialog-footer">
<button class="es-dialog-btn" data-action="cancel">Cancel</button>
@@ -82,14 +72,7 @@ export class NewProjectDialog {
`;
}
- private renderTabContent(): string {
- if (this.activeTab_ === 'templates') {
- return this.renderTemplatesTab();
- }
- return this.renderExamplesTab();
- }
-
- private renderTemplatesTab(): string {
+ private renderTemplates(): string {
const items = PROJECT_TEMPLATES.map(
(t) => `
<label class="es-dialog-template ${t.id === this.selectedTemplate_ ? 'selected' : ''} ${!t.enabled ? 'disabled' : ''}">
@@ -110,34 +93,10 @@ export class NewProjectDialog {
`;
}
- private renderExamplesTab(): string {
- if (EXAMPLE_PROJECTS.length === 0) {
- return `<div class="es-dialog-field"><span class="es-dialog-empty">No examples available</span></div>`;
- }
-
- const items = EXAMPLE_PROJECTS.map(
- (ex) => `
- <label class="es-dialog-template ${this.selectedExample_?.id === ex.id ? 'selected' : ''}">
- <input type="radio" name="example" value="${ex.id}" ${this.selectedExample_?.id === ex.id ? 'checked' : ''}>
- <span class="es-dialog-template-name">${ex.name}</span>
- <span class="es-dialog-template-desc">${ex.description}</span>
- </label>
- `
- ).join('');
-
- return `
- <div class="es-dialog-field">
- <label class="es-dialog-label">Example</label>
- <div class="es-dialog-templates">${items}</div>
- </div>
- `;
- }
-
private setupEvents(): void {
this.overlay_.addEventListener('click', (e) => {
const target = e.target as HTMLElement;
const action = target.dataset.action ?? target.closest('[data-action]')?.getAttribute('data-action');
- const tab = target.dataset.tab;
if (action === 'close' || action === 'cancel') {
this.options_.onClose();
@@ -145,8 +104,6 @@ export class NewProjectDialog {
this.handleBrowse();
} else if (action === 'create') {
this.handleCreate();
- } else if (tab) {
- this.switchTab(tab as DialogTab);
}
});
@@ -155,9 +112,6 @@ export class NewProjectDialog {
if (target.name === 'template') {
this.selectedTemplate_ = target.value as ProjectTemplate;
this.updateSelection();
- } else if (target.name === 'example') {
- this.selectedExample_ = EXAMPLE_PROJECTS.find(ex => ex.id === target.value) ?? null;
- this.updateSelection();
}
});
@@ -170,22 +124,6 @@ export class NewProjectDialog {
document.addEventListener('keydown', keyHandler);
}
- private switchTab(tab: DialogTab): void {
- this.activeTab_ = tab;
-
- const locationInput = this.overlay_.querySelector('#project-location') as HTMLInputElement;
- const nameInput = this.overlay_.querySelector('#project-name') as HTMLInputElement;
- const savedLocation = locationInput?.value ?? '';
- const savedName = nameInput?.value ?? 'MyGame';
-
- this.render();
-
- const newNameInput = this.overlay_.querySelector('#project-name') as HTMLInputElement;
- const newLocationInput = this.overlay_.querySelector('#project-location') as HTMLInputElement;
- if (newNameInput) newNameInput.value = savedName;
- if (newLocationInput && savedLocation) newLocationInput.value = savedLocation;
- }
-
private updateSelection(): void {
this.overlay_.querySelectorAll('.es-dialog-template').forEach((el) => {
const input = el.querySelector('input') as HTMLInputElement;
@@ -231,20 +169,11 @@ export class NewProjectDialog {
createBtn.textContent = 'Creating...';
}
- let result;
- if (this.activeTab_ === 'examples' && this.selectedExample_) {
- result = await createFromExample({
- name,
- location: this.projectLocation_,
- example: this.selectedExample_,
- });
- } else {
- result = await createProject({
- name,
- location: this.projectLocation_,
- template: this.selectedTemplate_,
- });
- }
+ const result = await createProject({
+ name,
+ location: this.projectLocation_,
+ template: this.selectedTemplate_,
+ });
if (result.success && result.data) {
this.options_.onProjectCreated(result.data);
diff --git a/editor/src/launcher/ProjectLauncher.ts b/editor/src/launcher/ProjectLauncher.ts
index 5dcf7b654..900ab4b51 100644
--- a/editor/src/launcher/ProjectLauncher.ts
+++ b/editor/src/launcher/ProjectLauncher.ts
@@ -1,6 +1,6 @@
/**
* @file ProjectLauncher.ts
- * @brief Project launcher/welcome screen component
+ * @brief Project launcher/welcome screen with sidebar navigation
*/
import type { RecentProject } from '../types/ProjectTypes';
@@ -12,6 +12,7 @@ import {
openProjectDialog,
} from './ProjectService';
import { NewProjectDialog } from './NewProjectDialog';
+import { ExampleBrowser } from './ExampleBrowser';
import { icons } from '../utils/icons';
// =============================================================================
@@ -22,6 +23,8 @@ export interface ProjectLauncherOptions {
onProjectOpen: (projectPath: string) => void;
}
+type LauncherView = 'projects' | 'learn';
+
// =============================================================================
// ProjectLauncher
// =============================================================================
@@ -30,6 +33,8 @@ export class ProjectLauncher {
private container_: HTMLElement;
private options_: ProjectLauncherOptions;
private newProjectDialog_: NewProjectDialog | null = null;
+ private activeView_: LauncherView = 'projects';
+ private exampleBrowser_: ExampleBrowser | null = null;
constructor(container: HTMLElement, options: ProjectLauncherOptions) {
this.container_ = container;
@@ -41,49 +46,92 @@ export class ProjectLauncher {
dispose(): void {
this.newProjectDialog_?.dispose();
this.newProjectDialog_ = null;
+ this.exampleBrowser_?.dispose();
+ this.exampleBrowser_ = null;
this.container_.innerHTML = '';
}
private render(): void {
this.container_.className = 'es-launcher';
this.container_.innerHTML = `
- <div class="es-launcher-content">
- <div class="es-launcher-header">
- <div class="es-launcher-logo">
- <div class="es-launcher-logo-icon">${icons.logo()}</div>
- <div class="es-launcher-logo-text">
- <span class="es-launcher-title">ESEngine</span>
- <span class="es-launcher-subtitle">Editor</span>
- </div>
- </div>
+ <div class="es-launcher-topbar" data-tauri-drag-region>
+ <div class="es-launcher-topbar-left">
+ <div class="es-launcher-logo-icon">${icons.logo(28)}</div>
+ <span class="es-launcher-topbar-title">ESEngine Editor</span>
</div>
+ <span class="es-launcher-topbar-version">v${ENGINE_VERSION}</span>
+ </div>
+ <div class="es-launcher-body">
+ <div class="es-launcher-sidebar">
+ <button class="es-launcher-nav-item ${this.activeView_ === 'projects' ? 'active' : ''}" data-view="projects">
+ <span class="es-launcher-nav-icon">${icons.folder(16)}</span>
+ <span>Projects</span>
+ </button>
+ <button class="es-launcher-nav-item ${this.activeView_ === 'learn' ? 'active' : ''}" data-view="learn">
+ <span class="es-launcher-nav-icon">${icons.bookOpen(16)}</span>
+ <span>Learn</span>
+ </button>
+ </div>
+ <div class="es-launcher-content"></div>
+ </div>
+ `;
+
+ this.renderActiveView();
+ this.setupEvents();
+ }
+
+ private renderActiveView(): void {
+ const content = this.container_.querySelector('.es-launcher-content');
+ if (!content) return;
+ this.exampleBrowser_?.dispose();
+ this.exampleBrowser_ = null;
+
+ if (this.activeView_ === 'projects') {
+ this.renderProjectsView(content as HTMLElement);
+ } else {
+ this.renderLearnView(content as HTMLElement);
+ }
+ }
+
+ private renderProjectsView(container: HTMLElement): void {
+ container.innerHTML = `
+ <div class="es-launcher-projects">
+ <div class="es-launcher-welcome">
+ <div class="es-launcher-welcome-icon">${icons.logo(48)}</div>
+ <div class="es-launcher-welcome-text">
+ <h2 class="es-launcher-welcome-title">Welcome to ESEngine</h2>
+ <p class="es-launcher-welcome-desc">Create a new project or open an existing one to get started.</p>
+ </div>
+ </div>
<div class="es-launcher-actions">
- <button class="es-launcher-btn es-launcher-btn-primary" data-action="new">
- <span class="es-launcher-btn-icon">${icons.plus()}</span>
- <span>New Project</span>
+ <button class="es-launcher-action-card" data-action="new">
+ <span class="es-launcher-action-icon es-launcher-action-icon--primary">${icons.plus(20)}</span>
+ <span class="es-launcher-action-label">New Project</span>
+ <span class="es-launcher-action-desc">Start from a blank template</span>
</button>
- <button class="es-launcher-btn" data-action="open">
- <span class="es-launcher-btn-icon">${icons.folderOpen()}</span>
- <span>Open Project</span>
+ <button class="es-launcher-action-card" data-action="open">
+ <span class="es-launcher-action-icon">${icons.folderOpen(20)}</span>
+ <span class="es-launcher-action-label">Open Project</span>
+ <span class="es-launcher-action-desc">Open an existing .esproject</span>
</button>
</div>
-
<div class="es-launcher-recent">
<div class="es-launcher-recent-header">
<span>Recent Projects</span>
</div>
<div class="es-launcher-recent-list"></div>
</div>
-
- <div class="es-launcher-footer">
- <span>v${ENGINE_VERSION}</span>
- </div>
</div>
`;
this.renderRecentProjects();
- this.setupEvents();
+ }
+
+ private renderLearnView(container: HTMLElement): void {
+ this.exampleBrowser_ = new ExampleBrowser(container, {
+ onProjectOpen: (path) => this.options_.onProjectOpen(path),
+ });
}
private renderRecentProjects(): void {
@@ -95,7 +143,9 @@ export class ProjectLauncher {
if (projects.length === 0) {
listContainer.innerHTML = `
<div class="es-launcher-recent-empty">
- No recent projects
+ <div class="es-launcher-recent-empty-icon">${icons.folder(24)}</div>
+ <span>No recent projects</span>
+ <span class="es-launcher-recent-empty-hint">Projects you open will appear here</span>
</div>
`;
return;
@@ -105,7 +155,6 @@ export class ProjectLauncher {
.map((project, index) => this.renderRecentProjectItem(project, index))
.join('');
- // Bind click events for recent project items
listContainer.querySelectorAll('.es-launcher-recent-item').forEach((item, index) => {
item.addEventListener('click', () => this.handleOpenRecentProject(projects[index]));
});
@@ -130,7 +179,7 @@ export class ProjectLauncher {
<div class="es-launcher-recent-path">${this.escapeHtml(shortPath)}</div>
</div>
<div class="es-launcher-recent-time">${timeAgo}</div>
- <button class="es-launcher-recent-remove" title="Remove from list">×</button>
+ <button class="es-launcher-recent-remove" title="Remove from list">&times;</button>
</div>
`;
}
@@ -140,6 +189,15 @@ export class ProjectLauncher {
e.preventDefault();
});
+ this.container_.querySelectorAll('.es-launcher-nav-item').forEach(btn => {
+ btn.addEventListener('click', () => {
+ const view = (btn as HTMLElement).dataset.view as LauncherView;
+ if (view && view !== this.activeView_) {
+ this.switchView(view);
+ }
+ });
+ });
+
const newBtn = this.container_.querySelector('[data-action="new"]');
const openBtn = this.container_.querySelector('[data-action="open"]');
@@ -147,6 +205,24 @@ export class ProjectLauncher {
openBtn?.addEventListener('click', () => this.handleOpenProject());
}
+ private switchView(view: LauncherView): void {
+ this.activeView_ = view;
+
+ this.container_.querySelectorAll('.es-launcher-nav-item').forEach(btn => {
+ btn.classList.toggle('active', (btn as HTMLElement).dataset.view === view);
+ });
+
+ this.renderActiveView();
+
+ const content = this.container_.querySelector('.es-launcher-content');
+ if (content && this.activeView_ === 'projects') {
+ const newBtn = content.querySelector('[data-action="new"]');
+ const openBtn = content.querySelector('[data-action="open"]');
+ newBtn?.addEventListener('click', () => this.handleNewProject());
+ openBtn?.addEventListener('click', () => this.handleOpenProject());
+ }
+ }
+
private handleNewProject(): void {
if (this.newProjectDialog_) return;
diff --git a/editor/src/styles/dialogs.css b/editor/src/styles/dialogs.css
index 9c8a2e266..47a552828 100644
--- a/editor/src/styles/dialogs.css
+++ b/editor/src/styles/dialogs.css
@@ -1,115 +1,263 @@
/* =============================================================================
- * Project Launcher
+ * Project Launcher — Sidebar Layout
* ============================================================================= */
.es-launcher {
width: 100%;
height: 100%;
background: var(--es-bg-primary);
+ display: flex;
+ flex-direction: column;
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+ font-size: 13px;
+ color: var(--es-text-primary);
+}
+
+/* Top bar */
+.es-launcher-topbar {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 0 16px;
+ height: 40px;
+ background: var(--es-bg-secondary);
+ border-bottom: 1px solid var(--es-border);
+ flex-shrink: 0;
+ -webkit-app-region: drag;
+}
+
+.es-launcher-topbar-left {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+
+.es-launcher-logo-icon {
display: flex;
align-items: center;
justify-content: center;
+ flex-shrink: 0;
}
-.es-launcher-content {
- width: 100%;
- max-width: 600px;
- padding: 40px;
+.es-launcher-logo-icon svg {
+ border-radius: 4px;
}
-.es-launcher-header {
- text-align: center;
- margin-bottom: 40px;
+.es-launcher-topbar-title {
+ font-size: 13px;
+ font-weight: 500;
+ color: var(--es-text-primary);
}
-.es-launcher-logo {
- display: inline-flex;
+.es-launcher-topbar-version {
+ font-size: 11px;
+ color: var(--es-text-secondary);
+}
+
+/* Body = sidebar + content */
+.es-launcher-body {
+ display: flex;
+ flex: 1;
+ min-height: 0;
+}
+
+/* Sidebar */
+.es-launcher-sidebar {
+ width: 200px;
+ min-width: 200px;
+ background: var(--es-bg-secondary);
+ border-right: 1px solid var(--es-border);
+ padding: 8px 0;
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+}
+
+.es-launcher-nav-item {
+ display: flex;
align-items: center;
- gap: 16px;
+ gap: 10px;
+ width: 100%;
+ padding: 10px 16px;
+ background: transparent;
+ border: none;
+ border-left: 3px solid transparent;
+ color: var(--es-text-secondary);
+ font-size: 13px;
+ font-family: inherit;
+ text-align: left;
+ cursor: pointer;
+ transition: all 0.15s;
}
-.es-launcher-logo-icon {
- width: 64px;
- height: 64px;
+.es-launcher-nav-item:hover {
+ color: var(--es-text-primary);
+ background: var(--es-bg-hover);
+}
+
+.es-launcher-nav-item.active {
+ color: var(--es-text-primary);
+ background: var(--es-bg-tertiary);
+ border-left-color: var(--es-accent-gold);
+}
+
+.es-launcher-nav-icon {
display: flex;
align-items: center;
justify-content: center;
+ width: 16px;
+ height: 16px;
+ flex-shrink: 0;
}
-.es-launcher-logo-icon svg {
- width: 64px;
- height: 64px;
- border-radius: 12px;
+.es-launcher-nav-icon svg {
+ width: 16px;
+ height: 16px;
+}
+
+/* Content area */
+.es-launcher-content {
+ flex: 1;
+ min-width: 0;
+ overflow-y: auto;
+ background: var(--es-bg-primary);
+}
+
+/* Custom dark scrollbar for launcher panels */
+.es-launcher-content::-webkit-scrollbar,
+.es-launcher-recent-list::-webkit-scrollbar,
+.es-example-list::-webkit-scrollbar {
+ width: 6px;
+}
+
+.es-launcher-content::-webkit-scrollbar-track,
+.es-launcher-recent-list::-webkit-scrollbar-track,
+.es-example-list::-webkit-scrollbar-track {
+ background: transparent;
+}
+
+.es-launcher-content::-webkit-scrollbar-thumb,
+.es-launcher-recent-list::-webkit-scrollbar-thumb,
+.es-example-list::-webkit-scrollbar-thumb {
+ background: rgba(255, 255, 255, 0.1);
+ border-radius: 3px;
+}
+
+.es-launcher-content::-webkit-scrollbar-thumb:hover,
+.es-launcher-recent-list::-webkit-scrollbar-thumb:hover,
+.es-example-list::-webkit-scrollbar-thumb:hover {
+ background: rgba(255, 255, 255, 0.2);
+}
+
+/* =============================================================================
+ * Projects View
+ * ============================================================================= */
+
+.es-launcher-projects {
+ max-width: 640px;
+ margin: 0 auto;
+ padding: 40px 40px 32px;
}
-.es-launcher-logo-text {
+/* Welcome hero */
+.es-launcher-welcome {
display: flex;
- flex-direction: column;
- align-items: flex-start;
+ align-items: center;
+ gap: 20px;
+ margin-bottom: 32px;
}
-.es-launcher-title {
- font-size: 28px;
+.es-launcher-welcome-icon {
+ flex-shrink: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.es-launcher-welcome-icon svg {
+ border-radius: 8px;
+}
+
+.es-launcher-welcome-text {
+ min-width: 0;
+}
+
+.es-launcher-welcome-title {
+ margin: 0 0 4px;
+ font-size: 20px;
font-weight: 600;
color: var(--es-text-primary);
}
-.es-launcher-subtitle {
- font-size: 16px;
+.es-launcher-welcome-desc {
+ margin: 0;
+ font-size: 13px;
color: var(--es-text-secondary);
+ line-height: 1.4;
}
+/* Action cards (New / Open) */
.es-launcher-actions {
- display: flex;
+ display: grid;
+ grid-template-columns: 1fr 1fr;
gap: 12px;
- margin-bottom: 32px;
+ margin-bottom: 28px;
}
-.es-launcher-btn {
- flex: 1;
+.es-launcher-action-card {
display: flex;
- align-items: center;
- justify-content: center;
- gap: 8px;
- padding: 16px 24px;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 4px;
+ padding: 16px;
background: var(--es-bg-secondary);
border: 1px solid var(--es-border);
color: var(--es-text-primary);
- font-size: 14px;
+ font-family: inherit;
+ text-align: left;
cursor: pointer;
transition: all 0.15s;
}
-.es-launcher-btn:hover {
+.es-launcher-action-card:hover {
background: var(--es-bg-hover);
border-color: var(--es-text-secondary);
}
-.es-launcher-btn-primary {
- background: var(--es-accent-gold);
- border-color: var(--es-accent-gold);
- color: #1e1e1e;
- font-weight: 500;
+.es-launcher-action-icon {
+ width: 36px;
+ height: 36px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 6px;
+ background: var(--es-bg-tertiary);
+ color: var(--es-text-secondary);
+ margin-bottom: 4px;
}
-.es-launcher-btn-primary:hover {
- background: #e5c07b;
- border-color: #e5c07b;
+.es-launcher-action-icon svg {
+ width: 20px;
+ height: 20px;
}
-.es-launcher-btn-icon {
- font-size: 18px;
- display: flex;
- align-items: center;
- justify-content: center;
+.es-launcher-action-icon--primary {
+ background: rgba(209, 154, 102, 0.15);
+ color: var(--es-accent-gold);
}
-.es-launcher-btn-icon svg {
- width: 18px;
- height: 18px;
- stroke: currentColor;
+.es-launcher-action-label {
+ font-size: 14px;
+ font-weight: 500;
+ color: var(--es-text-primary);
}
+.es-launcher-action-desc {
+ font-size: 12px;
+ color: var(--es-text-secondary);
+}
+
+/* Recent projects */
.es-launcher-recent {
background: var(--es-bg-secondary);
border: 1px solid var(--es-border);
@@ -119,13 +267,14 @@
padding: 12px 16px;
border-bottom: 1px solid var(--es-border);
color: var(--es-text-secondary);
- font-size: 12px;
+ font-size: 11px;
+ font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.es-launcher-recent-list {
- max-height: 300px;
+ max-height: 360px;
overflow-y: auto;
}
@@ -133,15 +282,42 @@
padding: 40px 20px;
text-align: center;
color: var(--es-text-secondary);
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 6px;
+}
+
+.es-launcher-recent-empty-icon {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ opacity: 0.3;
+ margin-bottom: 4px;
+}
+
+.es-launcher-recent-empty-icon svg {
+ width: 24px;
+ height: 24px;
+}
+
+.es-launcher-recent-empty-hint {
+ font-size: 11px;
+ opacity: 0.6;
}
.es-launcher-recent-item {
display: flex;
align-items: center;
gap: 12px;
- padding: 12px 16px;
+ padding: 10px 16px;
cursor: pointer;
transition: background 0.15s;
+ border-bottom: 1px solid var(--es-border);
+}
+
+.es-launcher-recent-item:last-child {
+ border-bottom: none;
}
.es-launcher-recent-item:hover {
@@ -149,17 +325,19 @@
}
.es-launcher-recent-icon {
- width: 20px;
- height: 20px;
+ width: 32px;
+ height: 32px;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
+ background: var(--es-bg-tertiary);
+ border-radius: 4px;
}
.es-launcher-recent-icon svg {
- width: 20px;
- height: 20px;
+ width: 16px;
+ height: 16px;
stroke: var(--es-text-secondary);
}
@@ -170,7 +348,8 @@
.es-launcher-recent-name {
color: var(--es-text-primary);
- font-size: 14px;
+ font-size: 13px;
+ font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -178,15 +357,16 @@
.es-launcher-recent-path {
color: var(--es-text-secondary);
- font-size: 12px;
+ font-size: 11px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ margin-top: 1px;
}
.es-launcher-recent-time {
color: var(--es-text-secondary);
- font-size: 12px;
+ font-size: 11px;
flex-shrink: 0;
}
@@ -200,6 +380,9 @@
cursor: pointer;
opacity: 0;
transition: opacity 0.15s;
+ display: flex;
+ align-items: center;
+ justify-content: center;
}
.es-launcher-recent-item:hover .es-launcher-recent-remove {
@@ -210,11 +393,250 @@
color: var(--es-danger);
}
-.es-launcher-footer {
- margin-top: 24px;
+/* =============================================================================
+ * Learn View — Example Browser
+ * ============================================================================= */
+
+.es-example-browser {
+ padding: 24px 32px;
+ height: 100%;
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
+}
+
+/* Toolbar: search + filter */
+.es-example-toolbar {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-bottom: 24px;
+ flex-shrink: 0;
+}
+
+.es-example-search {
+ flex: 1;
+ position: relative;
+}
+
+.es-example-search-input {
+ width: 100%;
+ padding: 8px 12px 8px 32px;
+ background: var(--es-bg-secondary);
+ border: 1px solid var(--es-border);
+ color: var(--es-text-primary);
+ font-size: 13px;
+ font-family: inherit;
+ box-sizing: border-box;
+ transition: border-color 0.15s;
+}
+
+.es-example-search-input:focus {
+ outline: none;
+ border-color: var(--es-accent);
+}
+
+.es-example-search-input::placeholder {
+ color: var(--es-text-secondary);
+ opacity: 0.6;
+}
+
+.es-example-search-icon {
+ position: absolute;
+ left: 10px;
+ top: 50%;
+ transform: translateY(-50%);
+ display: flex;
+ align-items: center;
+ color: var(--es-text-secondary);
+ pointer-events: none;
+}
+
+.es-example-search-icon svg {
+ width: 14px;
+ height: 14px;
+}
+
+.es-example-filter {
+ padding: 8px 12px;
+ background: var(--es-bg-secondary);
+ border: 1px solid var(--es-border);
+ color: var(--es-text-primary);
+ font-size: 13px;
+ font-family: inherit;
+ cursor: pointer;
+ min-width: 160px;
+ transition: border-color 0.15s;
+}
+
+.es-example-filter:focus {
+ outline: none;
+ border-color: var(--es-accent);
+}
+
+.es-example-filter option {
+ background: var(--es-bg-secondary);
+ color: var(--es-text-primary);
+}
+
+/* Scrollable example list */
+.es-example-list {
+ flex: 1;
+ min-height: 0;
+ overflow-y: auto;
+ padding-bottom: 24px;
+}
+
+.es-example-category-title {
+ font-size: 11px;
+ font-weight: 600;
+ color: var(--es-text-secondary);
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ margin: 24px 0 12px;
+}
+
+.es-example-category-title:first-child {
+ margin-top: 0;
+}
+
+/* Card grid */
+.es-example-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
+ gap: 16px;
+}
+
+.es-example-card {
+ background: var(--es-bg-secondary);
+ border: 1px solid var(--es-border);
+ cursor: pointer;
+ transition: all 0.2s;
+ overflow: hidden;
+}
+
+.es-example-card:hover {
+ border-color: var(--es-accent-gold);
+ transform: translateY(-2px);
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
+}
+
+.es-example-card-thumb {
+ width: 100%;
+ aspect-ratio: 16 / 9;
+ background: var(--es-bg-tertiary);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ overflow: hidden;
+ border-bottom: 1px solid var(--es-border);
+}
+
+.es-example-card-img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ display: block;
+}
+
+.es-example-card-thumb-fallback {
+ width: 100%;
+ height: 100%;
+ color: var(--es-text-secondary);
+ opacity: 0.3;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.es-example-card-thumb-fallback svg {
+ width: 48px;
+ height: 48px;
+}
+
+.es-example-card-body {
+ padding: 12px;
+}
+
+.es-example-card-title {
+ font-size: 14px;
+ font-weight: 500;
+ color: var(--es-text-primary);
+ margin-bottom: 4px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.es-example-card-desc {
+ font-size: 12px;
+ color: var(--es-text-secondary);
+ line-height: 1.4;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ margin-bottom: 8px;
+ min-height: 34px;
+}
+
+.es-example-card-meta {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ flex-wrap: wrap;
+}
+
+.es-example-card-tag {
+ display: inline-block;
+ padding: 2px 8px;
+ font-size: 10px;
+ border-radius: 2px;
+ text-transform: capitalize;
+ font-weight: 500;
+ letter-spacing: 0.2px;
+}
+
+.es-example-card-category {
+ background: rgba(209, 154, 102, 0.15);
+ color: var(--es-accent-gold);
+}
+
+.es-example-card-difficulty {
+ background: var(--es-bg-tertiary);
+ color: var(--es-text-secondary);
+}
+
+.es-example-empty {
+ padding: 80px 20px;
text-align: center;
color: var(--es-text-secondary);
+ font-size: 13px;
+}
+
+/* =============================================================================
+ * Create from Example Dialog
+ * ============================================================================= */
+
+.es-dialog-example-info {
+ padding: 12px;
+ background: var(--es-bg-primary);
+ border: 1px solid var(--es-border);
+}
+
+.es-dialog-example-name {
+ display: block;
+ font-size: 14px;
+ font-weight: 500;
+ color: var(--es-text-primary);
+ margin-bottom: 4px;
+}
+
+.es-dialog-example-desc {
+ display: block;
font-size: 12px;
+ color: var(--es-text-secondary);
+ line-height: 1.4;
}
/* =============================================================================
diff --git a/editor/src/types/ProjectTypes.ts b/editor/src/types/ProjectTypes.ts
index 6e6a541e0..91544e2f7 100644
--- a/editor/src/types/ProjectTypes.ts
+++ b/editor/src/types/ProjectTypes.ts
@@ -90,19 +90,44 @@ export const PROJECT_TEMPLATES: ProjectTemplateInfo[] = [
// Example Projects
// =============================================================================
+export type ExampleCategory =
+ | 'getting-started' | 'rendering' | 'physics'
+ | 'ui' | 'animation' | 'audio' | 'input' | 'game';
+
+export type ExampleDifficulty = 'beginner' | 'intermediate' | 'advanced';
+
export interface ExampleProjectInfo {
id: string;
name: string;
description: string;
zipFile: string;
+ category: ExampleCategory;
+ difficulty: ExampleDifficulty;
+ thumbnail: string;
+ tags: string[];
}
+export const EXAMPLE_CATEGORY_LABELS: Record<ExampleCategory, string> = {
+ 'getting-started': 'Getting Started',
+ 'rendering': 'Rendering',
+ 'physics': 'Physics',
+ 'ui': 'UI',
+ 'animation': 'Animation',
+ 'audio': 'Audio',
+ 'input': 'Input',
+ 'game': 'Game',
+};
+
export const EXAMPLE_PROJECTS: ExampleProjectInfo[] = [
{
id: 'space-shooter',
name: 'Space Shooter',
description: 'A vertical scrolling shoot\'em up with enemies, bullets, explosions and HUD',
zipFile: 'examples/space-shooter.zip',
+ category: 'game',
+ difficulty: 'intermediate',
+ thumbnail: 'examples/thumbnails/space-shooter.png',
+ tags: ['shooter', 'sprites', 'input', 'hud', 'collision'],
},
];
diff --git a/editor/src/utils/icons.ts b/editor/src/utils/icons.ts
index d427d224e..3ecf65988 100644
--- a/editor/src/utils/icons.ts
+++ b/editor/src/utils/icons.ts
@@ -69,6 +69,7 @@ import {
SlidersHorizontal,
Gauge,
Globe,
+ BookOpen,
} from 'lucide';
// =============================================================================
@@ -194,6 +195,7 @@ export const icons = {
sliders: (size?: number) => renderIcon(SlidersHorizontal as IconNode, size),
gauge: (size?: number) => renderIcon(Gauge as IconNode, size),
globe: (size?: number) => renderIcon(Globe as IconNode, size),
+ bookOpen: (size?: number) => renderIcon(BookOpen as IconNode, size),
};
export type IconName = keyof typeof icons;
diff --git a/examples/space-shooter/thumbnail.png b/examples/space-shooter/thumbnail.png
new file mode 100644
index 000000000..081e07efc
Binary files /dev/null and b/examples/space-shooter/thumbnail.png differ