Initial commit: Game Maker phase 1

Canvas-only 2D game editor/runtime built on PixiJS v8 + Vite + TypeScript.

- core: asset model (Scene/Camera/Sprite), scene objects with sparse
  overrides, property schema + resolve, command stack (undo/redo),
  serialization and project store interface (16 unit tests)
- ui: custom in-canvas widget toolkit (panels, fields, color picker,
  list/scroll, popup) with a hidden <input> keyboard bridge
- editor: asset/hierarchy panels, schema-driven inspector, toolbar
- viewport: box rendering, camera frame, selection gizmo, drag/zoom/pan
- runtime: world/entity instantiation for play mode, input, camera follow
- api: PHP JSON project store with revision counter (409 on conflict)
- tools: CDP-based e2e smoke test

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Fable 5.1 committed 2026-09-07 10:07:06 +02:00
commit 5a46124454
65 files changed
+7193

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
import type { Project } from '../model/Project';
import { type LoadedProject, type ProjectStore, type ProjectSummary, StaleRevisionError } from './ProjectStore';
import { deserializeProject, serializeProject } from './serialize';
/**
* Talks to the PHP backend in `api/index.php`. Routing goes through the `r` query
* parameter (`?r=projects/{id}`) because the site's nginx config rejects PATH_INFO.
*/
export class HttpProjectStore implements ProjectStore {
constructor(private readonly endpoint: string) {}
async list(): Promise<ProjectSummary[]> {
return this.request<ProjectSummary[]>('GET', 'projects');
}
async load(id: string): Promise<LoadedProject> {
const body = await this.request<{ revision: number; project: unknown }>('GET', `projects/${encodeURIComponent(id)}`);
return { project: deserializeProject(body.project, id), revision: body.revision };
}
async save(project: Project, revision: number): Promise<number> {
const body = await this.request<{ revision: number }>('PUT', `projects/${encodeURIComponent(project.id)}`, {
revision,
project: serializeProject(project),
});
return body.revision;
}
async create(name: string): Promise<LoadedProject> {
const body = await this.request<{ revision: number; project: unknown }>('POST', 'projects', { name });
const project = deserializeProject(body.project);
return { project, revision: body.revision };
}
async delete(id: string): Promise<void> {
await this.request<void>('DELETE', `projects/${encodeURIComponent(id)}`);
}
private async request<T>(method: string, route: string, payload?: unknown): Promise<T> {
const url = `${this.endpoint}?r=${encodeURIComponent(route)}`;
const response = await fetch(url, {
method,
headers: payload !== undefined ? { 'Content-Type': 'application/json' } : {},
body: payload !== undefined ? JSON.stringify(payload) : undefined,
});
if (response.status === 204) return undefined as T;
const text = await response.text();
let data: unknown = null;
try {
data = text ? JSON.parse(text) : null;
} catch {
throw new Error(`API ${method} ${route}: invalid JSON (${response.status})`);
}
if (response.status === 409) {
const rev = (data as { revision?: number } | null)?.revision ?? -1;
throw new StaleRevisionError(rev);
}
if (!response.ok) {
const message = (data as { error?: string } | null)?.error ?? response.statusText;
throw new Error(`API ${method} ${route}: ${message} (${response.status})`);
}
return data as T;
}
}