-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
57 lines (49 loc) · 1.73 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// some "nominal"/"abstract" types, accomplished by putting
// in some nonce private methods that don't really exist, which are
// named after the class.
export class UniformLoc { private _UniformLoc(): void }
export class ProgramId { private _ProgramId(): void }
export class FramebufferId { private _FramebufferId(): void }
export class TextureId { private _TextureId(): void }
// Main classes
export class NativeLayer {
constructor(width: number, height: number);
configShaders(program: ProgramId): void;
pollEvent(): string | null;
drawTriangles(): void;
clear(): void;
swapWindow(): void;
finish(): void;
}
export function glUniform1i(uniform: UniformLoc, value: number): void;
export function glUniform1f(uniform: UniformLoc, value: number): void;
export function glUniform2f(uniform: UniformLoc, value: number, value2: number): void;
export function glActiveTexture(textureUnit: number): void;
export function glUniform4fv(uniform: UniformLoc, values: number[]): void;
export function glTexImage2d(width: number, height: number, values: Uint8Array): void;
export function initSound(): void;
export function playSound(): void; // debugging for now
export class Texture {
constructor();
loadFile(filename: string): void;
textureId(): TextureId;
bind(textureUnit: number): void;
makeBlank(width: number, height: number): void;
}
export class Sample {
constructor(buffer: Int16Array);
play();
}
export class Program {
constructor(vertexShader: string, fragmentShader: string);
getUniformLocation(name: string): UniformLoc;
programId(): ProgramId;
use(): void;
}
export class Framebuffer {
constructor();
framebufferId(): FramebufferId;
bind(): void;
unbind(): void;
setOutputTexture(textureId: TextureId): void;
}