[oden] Writable Textures and re-work TS API

Now we return Texture objects to make things a little bit more
type-safe, at the cost of a small allocation (I hope!)
This commit is contained in:
John Doty 2023-07-08 17:54:48 -07:00
parent 12cc715873
commit 89045ccbcc
7 changed files with 287 additions and 24 deletions

View file

@ -1,7 +1,9 @@
// These are the functions exposed by the native graphics module.
//
export function cls(r: number, g: number, b: number);
export function print(msg: string);
export function spr(
x: number,
y: number,
@ -12,8 +14,20 @@ export function spr(
sw: number,
sh: number
);
export function create_texture(
buffer: ArrayBuffer,
label: string | undefined
): number;
export function use_texture(id: number);
export function create_writable_texture(
width: number,
height: number,
label: string | undefined
): number;
export function write_to_screen();
export function write_to_texture(id: number);