Fixed typings #6
24
lib/index.d.ts
vendored
24
lib/index.d.ts
vendored
@ -2,6 +2,11 @@ export as namespace asdf;
|
|||||||
|
|
||||||
type Coordinates = {x: number, y: number};
|
type Coordinates = {x: number, y: number};
|
||||||
|
|
||||||
|
class Renderable {
|
||||||
|
visible?: boolean,
|
||||||
|
dead?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TileSpriteXML class
|
* TileSpriteXML class
|
||||||
*/
|
*/
|
||||||
@ -158,7 +163,7 @@ interface TextStyleOptions {
|
|||||||
/**
|
/**
|
||||||
* Text class
|
* Text class
|
||||||
*/
|
*/
|
||||||
export class Text {
|
export class Text extends Renderable {
|
||||||
|
|
||||||
pos: Coordinates;
|
pos: Coordinates;
|
||||||
text: string;
|
text: string;
|
||||||
@ -219,15 +224,13 @@ export class SpriteSheetXML {
|
|||||||
/**
|
/**
|
||||||
* Sprite class
|
* Sprite class
|
||||||
*/
|
*/
|
||||||
export class Sprite {
|
export class Sprite extends Renderable {
|
||||||
texture: Texture;
|
texture: Texture;
|
||||||
pos: Coordinates;
|
pos: Coordinates;
|
||||||
anchor: Coordinates;
|
anchor: Coordinates;
|
||||||
scale: Coordinates;
|
scale: Coordinates;
|
||||||
pivot: Coordinates;
|
pivot: Coordinates;
|
||||||
visible: boolean;
|
|
||||||
rotation: number;
|
rotation: number;
|
||||||
dead: boolean;
|
|
||||||
|
|
||||||
update?: (dt?: number, t?: number) => void;
|
update?: (dt?: number, t?: number) => void;
|
||||||
|
|
||||||
@ -246,7 +249,8 @@ export class Game {
|
|||||||
h: number;
|
h: number;
|
||||||
renderer: CanvasRenderer;
|
renderer: CanvasRenderer;
|
||||||
scene: Container<unknown>;
|
scene: Container<unknown>;
|
||||||
|
paused: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the games parameters
|
* Set the games parameters
|
||||||
* @param w Width of canvas
|
* @param w Width of canvas
|
||||||
@ -260,14 +264,14 @@ export class Game {
|
|||||||
* Start game loop
|
* Start game loop
|
||||||
* @param gameUpdate Function to run next to scene updates such as debug logging, etc.
|
* @param gameUpdate Function to run next to scene updates such as debug logging, etc.
|
||||||
*/
|
*/
|
||||||
run(gameUpdate: (dt?: number, t?: number) => void): void;
|
run(gameUpdate?: (dt?: number, t?: number) => void): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container class
|
* Container class
|
||||||
*/
|
*/
|
||||||
export class Container<T> {
|
export class Container<T> {
|
||||||
pos: {x: number, y: number};
|
pos: Coordinates;
|
||||||
children: T[];
|
children: T[];
|
||||||
|
|
||||||
constructor();
|
constructor();
|
||||||
@ -409,7 +413,7 @@ export class KeyControls {
|
|||||||
* @param value Value to set to key
|
* @param value Value to set to key
|
||||||
* @return Value of key
|
* @return Value of key
|
||||||
*/
|
*/
|
||||||
key(key: number, value: boolean): boolean;
|
key(key: number, value?: boolean): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets default value (false) to all keys
|
* Resets default value (false) to all keys
|
||||||
@ -574,8 +578,8 @@ export class Camera extends Container<unknown> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface SoundOptions {
|
interface SoundOptions {
|
||||||
loop: boolean,
|
loop?: boolean,
|
||||||
volume: number
|
volume?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Sound {
|
export class Sound {
|
||||||
|
Loading…
Reference in New Issue
Block a user