Patched some typings mistakes

This commit is contained in:
corner 2020-05-18 18:28:19 +02:00
parent c2d9a0a846
commit 03fa6c32b0

22
lib/index.d.ts vendored
View File

@ -2,6 +2,11 @@ export as namespace asdf;
type Coordinates = {x: number, y: number};
class Renderable {
visible?: boolean,
dead?: boolean
}
/**
* TileSpriteXML class
*/
@ -158,7 +163,7 @@ interface TextStyleOptions {
/**
* Text class
*/
export class Text {
export class Text extends Renderable {
pos: Coordinates;
text: string;
@ -219,15 +224,13 @@ export class SpriteSheetXML {
/**
* Sprite class
*/
export class Sprite {
export class Sprite extends Renderable {
texture: Texture;
pos: Coordinates;
anchor: Coordinates;
scale: Coordinates;
pivot: Coordinates;
visible: boolean;
rotation: number;
dead: boolean;
update?: (dt?: number, t?: number) => void;
@ -246,6 +249,7 @@ export class Game {
h: number;
renderer: CanvasRenderer;
scene: Container<unknown>;
paused: boolean;
/**
* Set the games parameters
@ -260,14 +264,14 @@ export class Game {
* Start game loop
* @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
*/
export class Container<T> {
pos: {x: number, y: number};
pos: Coordinates;
children: T[];
constructor();
@ -409,7 +413,7 @@ export class KeyControls {
* @param value Value to set to key
* @return Value of key
*/
key(key: number, value: boolean): boolean;
key(key: number, value?: boolean): boolean;
/**
* Resets default value (false) to all keys
@ -574,8 +578,8 @@ export class Camera extends Container<unknown> {
}
interface SoundOptions {
loop: boolean,
volume: number
loop?: boolean,
volume?: number
}
export class Sound {