dev/prometeuc-improvements (#5)

Co-authored-by: Nilton Constantino <nilton.constantino@visma.com>
Reviewed-on: #5
This commit is contained in:
2026-03-24 13:40:19 +00:00
co-authored by Nilton Constantino
parent b134de99e7
commit 47c082adb1
76 changed files with 2820 additions and 756 deletions
+95
View File
@@ -0,0 +1,95 @@
export {}; // that is a module, should not include any other scope here
declare global {
namespace Prometeu {
type Color565 = number & { readonly __brand: "Color565" };
interface Button {
readonly down: boolean;
readonly pressed: boolean;
readonly released: boolean;
readonly holdFrames: number;
}
interface Pad {
readonly up: Button;
readonly down: Button;
readonly left: Button;
readonly right: Button;
readonly a: Button;
readonly b: Button;
readonly x: Button;
readonly y: Button;
readonly l: Button;
readonly r: Button;
readonly start: Button;
readonly select: Button;
}
interface Touch {
readonly x: number;
readonly y: number;
readonly button: Button;
}
interface Gfx {
fillRect(x: number, y: number, w: number, h: number, color: Color565): void;
drawLine(x1: number, y1: number, x2: number, y2: number, color: Color565): void;
drawCircle(x: number, y: number, r: number, color: Color565): void;
drawDisc(x: number, y: number, r: number, borderColor: Color565, fillColor: Color565): void;
drawSquare(x: number, y: number, w: number, h: number, borderColor: Color565, fillColor: Color565): void;
clear(color: Color565): void;
}
interface Color {
readonly black: Color565;
readonly white: Color565;
readonly red: Color565;
readonly green: Color565;
readonly blue: Color565;
readonly yellow: Color565;
readonly cyan: Color565;
readonly magenta: Color565;
readonly indigo: Color565;
readonly color_key: Color565;
readonly orange: Color565;
readonly gray: Color565;
readonly grey: Color565;
rgb(r: number, g: number, b: number): Color565;
}
interface System {
hasCart(): boolean;
}
interface Audio {
playSample(sampleId: number, voiceId: number, volume: number, pan: number, pitch: number): void;
}
interface Fs {
open(path: string): number;
read(handle: number): string | null;
write(handle: number, content: string): boolean;
close(handle: number): void;
listDir(path: string): string | null;
exists(path: string): boolean;
delete(path: string): boolean;
}
interface Log {
write(level: number, msg: string): void;
writeTag(level: number, tag: number, msg: string): void;
}
}
export const pad: Prometeu.Pad;
export const touch: Prometeu.Touch;
export const gfx: Prometeu.Gfx;
export const audio: Prometeu.Audio;
export const fs: Prometeu.Fs;
export const log: Prometeu.Log;
export const color: Prometeu.Color;
export const system: Prometeu.System;
}