-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from drewsilcock/add-typings
Add Typings directory.
- Loading branch information
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "Phaser-Kinetic-Scrolling-Plugin", | ||
"main": "phaser-kinetic-scrolling-plugin.d.ts", | ||
"files": [], | ||
"global": true | ||
} |