From bb82ada497cec850e37db30afdda89f31d3ef206 Mon Sep 17 00:00:00 2001 From: drewsilcock Date: Tue, 20 Feb 2018 12:35:57 +0000 Subject: [PATCH 1/2] Add Typings directory. Add Typings JSON file, definition file and README describing how to install using typings. --- typings/README.md | 10 +++ typings/phaser-kinetic-scrolling-plugin.d.ts | 80 ++++++++++++++++++++ typings/typings.json | 6 ++ 3 files changed, 96 insertions(+) create mode 100644 typings/README.md create mode 100644 typings/phaser-kinetic-scrolling-plugin.d.ts create mode 100644 typings/typings.json diff --git a/typings/README.md b/typings/README.md new file mode 100644 index 0000000..d106d07 --- /dev/null +++ b/typings/README.md @@ -0,0 +1,10 @@ +# Phaser Kinetic Scrolling Plugin Typings + +To install using Typings: + +``` +$ npm install -g typings # If you haven't got it already +$ typings install --save --global github:jdnichollsc/Phaser-Kinetic-Scrolling-Plugin/typings # You should really specify a commit version i.e. github:jdnichollsc/Phaser-Kinetic-Scrolling-Plugin/typings#GIT_COMMIT_HASH_HERE +``` + +Note that Typings is officially depracated - a more modern approach would be to create a PR onto https://github.com/DefinitelyTyped/DefinitelyTyped so that you can use the now standard `npm install @types/phaser-kinectic-scrolling-plugin` command. diff --git a/typings/phaser-kinetic-scrolling-plugin.d.ts b/typings/phaser-kinetic-scrolling-plugin.d.ts new file mode 100644 index 0000000..d496a86 --- /dev/null +++ b/typings/phaser-kinetic-scrolling-plugin.d.ts @@ -0,0 +1,80 @@ +declare module Phaser { + module Plugin { + /** + * Settings to change behaviour of Kinetic Scrolling plugin. + */ + interface KineticScrollingSettings { + /** + * Enable or disable the kinematic motion. + */ + kineticMovement?: boolean; + + /** + * The rate of deceleration for the scrolling. + */ + timeConstantScroll?: number; + + /** + * Enable or disable the horizontal scrolling. + */ + horizontalScroll?: boolean; + + /** + * Enable or disable the vertical scrolling. + */ + verticalScroll?: boolean; + + /** + * Enable or disable the horizontal scrolling with the mouse wheel. + */ + horizontalWheel?: boolean; + + /** + * Enable or disable the vertical scrolling with the mouse wheel. + */ + verticalWheel?: boolean; + + /** + * Delta increment of the mouse wheel. + */ + deltaWheel?: number; + } + + /** + * Kinetic Scrolling is a Phaser plugin that allows vertical and horizontal scrolling with kinetic motion. + * It works with the Phaser.Camera + */ + export class KineticScrolling extends Phaser.Plugin { + /** + * @param game The Game object is the instance of the game, where the magic happens. + * @param parent The object that owns this plugin, usually Phaser.PluginManager. + */ + constructor(game: Phaser.Game, parent: Phaser.PluginManager); + + /** + * Start the Plugin. + */ + public start(): void; + + /** + * Stop the Plugin. + */ + public stop(): void; + + /** + * Change Default Settings of the plugin + * @param options Object that contain properties to change the behavior of the plugin. + */ + public configure(options: KineticScrollingSettings): void; + } + } + + interface Game { + /** + * Instance of the plugin that handles kinetic scrolling with mouse, dragging or mouse wheel. + */ + kineticScrolling: Plugin.KineticScrolling; + } +} + +declare module "phaser-kinetic-scrolling-plugin" { } diff --git a/typings/typings.json b/typings/typings.json new file mode 100644 index 0000000..de3b7d3 --- /dev/null +++ b/typings/typings.json @@ -0,0 +1,6 @@ +{ + "name": "Phaser-Kinetic-Scrolling-Plugin", + "main": "phaser-kinetic-scrolling-plugin.d.ts", + "files": [], + "global": true +} From cb403e96b917429636012f10702bacb01df50c6c Mon Sep 17 00:00:00 2001 From: drewsilcock Date: Wed, 21 Feb 2018 09:39:05 +0000 Subject: [PATCH 2/2] Rename typings dir to typescript. Typings itself uses a directory called `typings`, so calling that folder should really be called something else to avoid confusion. --- {typings => typescript}/README.md | 2 +- {typings => typescript}/phaser-kinetic-scrolling-plugin.d.ts | 0 {typings => typescript}/typings.json | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename {typings => typescript}/README.md (73%) rename {typings => typescript}/phaser-kinetic-scrolling-plugin.d.ts (100%) rename {typings => typescript}/typings.json (100%) diff --git a/typings/README.md b/typescript/README.md similarity index 73% rename from typings/README.md rename to typescript/README.md index d106d07..e14bf88 100644 --- a/typings/README.md +++ b/typescript/README.md @@ -4,7 +4,7 @@ To install using Typings: ``` $ npm install -g typings # If you haven't got it already -$ typings install --save --global github:jdnichollsc/Phaser-Kinetic-Scrolling-Plugin/typings # You should really specify a commit version i.e. github:jdnichollsc/Phaser-Kinetic-Scrolling-Plugin/typings#GIT_COMMIT_HASH_HERE +$ typings install --save --global github:jdnichollsc/Phaser-Kinetic-Scrolling-Plugin/typescript # You should really specify a commit version i.e. github:jdnichollsc/Phaser-Kinetic-Scrolling-Plugin/typescript#GIT_COMMIT_HASH_HERE ``` Note that Typings is officially depracated - a more modern approach would be to create a PR onto https://github.com/DefinitelyTyped/DefinitelyTyped so that you can use the now standard `npm install @types/phaser-kinectic-scrolling-plugin` command. diff --git a/typings/phaser-kinetic-scrolling-plugin.d.ts b/typescript/phaser-kinetic-scrolling-plugin.d.ts similarity index 100% rename from typings/phaser-kinetic-scrolling-plugin.d.ts rename to typescript/phaser-kinetic-scrolling-plugin.d.ts diff --git a/typings/typings.json b/typescript/typings.json similarity index 100% rename from typings/typings.json rename to typescript/typings.json