From 03fa6c32b01179f6216886d836623d5c81a6cbb8 Mon Sep 17 00:00:00 2001 From: Job Vonk Date: Mon, 18 May 2020 18:28:19 +0200 Subject: [PATCH 1/2] Patched some typings mistakes --- lib/index.d.ts | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 84f09bb..ab9629a 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -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,7 +249,8 @@ export class Game { h: number; renderer: CanvasRenderer; scene: Container; - + paused: boolean; + /** * Set the games parameters * @param w Width of canvas @@ -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 { - 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 { } interface SoundOptions { - loop: boolean, - volume: number + loop?: boolean, + volume?: number } export class Sound { -- 2.45.2 From 495856ee534d0eadbb95d260be3947e0ad3e0d3e Mon Sep 17 00:00:00 2001 From: Job Vonk Date: Mon, 25 May 2020 13:10:17 +0200 Subject: [PATCH 2/2] Fixed syntax errors --- lib/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index ab9629a..fc466ed 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -3,7 +3,7 @@ export as namespace asdf; type Coordinates = {x: number, y: number}; class Renderable { - visible?: boolean, + visible?: boolean; dead?: boolean } @@ -169,7 +169,7 @@ export class Text extends Renderable { text: string; visible: boolean; update?: (dt?: number, t?: number) => void; - style: TextStyleOptions' + style: TextStyleOptions; /** * Prints styled text on canvas -- 2.45.2