Initial Commit

This commit is contained in:
ExilProductions
2026-01-14 17:52:35 +01:00
parent 2d3b97c5db
commit cf066ef305
28 changed files with 1922 additions and 0 deletions

48
shared/types.ts Normal file
View File

@@ -0,0 +1,48 @@
export interface User {
id: string;
username: string;
color: string;
}
export interface Pixel {
x: number;
y: number;
color: string;
}
export interface Cursor {
userId: string;
username: string;
x: number;
y: number;
color: string;
}
export interface CanvasUpdate {
pixels: Pixel[];
}
export interface LoginRequest {
username: string;
password: string;
}
export interface RegisterRequest {
username: string;
password: string;
}
export interface AuthResponse {
token: string;
user: User;
}
export interface SocketEvents {
'join-canvas': (token: string) => void;
'cursor-move': (cursor: Cursor) => void;
'paint-pixels': (pixels: Pixel[]) => void;
'canvas-update': (update: CanvasUpdate) => void;
'cursor-update': (cursors: Cursor[]) => void;
'canvas-state': (pixels: Pixel[]) => void;
'error': (message: string) => void;
}