Skip to content

Commit

Permalink
Compile dists
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranayub committed May 26, 2016
1 parent 0ac399b commit 51c2f82
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 76 deletions.
Binary file modified dist/Excalibur.0.6.0.nupkg
Binary file not shown.
58 changes: 44 additions & 14 deletions dist/Excalibur.d.ts
Expand Up @@ -5246,6 +5246,7 @@ declare module ex.Internal {
/**
* Play an empty sound to unlock Safari WebAudio context. Call this function
* right after a user interaction event. Typically used by [[PauseAfterLoader]]
* @source https://paulbakaus.com/tutorials/html5/web-audio-on-ios/
*/
static unlock(): void;
static isUnlocked(): boolean;
Expand Down Expand Up @@ -5351,39 +5352,68 @@ declare module ex {
* **Note:** Because Loader is not part of a Scene, you must
* call `update` and `draw` manually on "child" objects.
*
* ## Custom trigger
* ## Implementing a Trigger
*
* The `PauseAfterLoader` by default uses the [[PlayTrigger]]
* which wraps an HTML `<a>` element to act as a trigger. You can pass in your
* own [[IPauseAfterLoaderTrigger]] implementation to act as a trigger, whenever the user
* taps the element the game will start.
* The `PauseAfterLoader` requires an element to act as the trigger button
* to start the game.
*
* ```ts
* var loader = new ex.PauseAfterLoader([...], 'tap-to-play');
* For example, let's create an `<a>` tag to be our trigger and call it `tap-to-play`.
*
* ```html
* <div id="wrapper">
* <canvas id="game"></canvas>
* <a id="tap-to-play" href='javascript:void(0);'>Tap to Play</a>
* </div>
* ```
*
* And then in your HTML file:
* We've put it inside a wrapper to position it properly over the game canvas.
*
* Now let's add some CSS to style it (insert into `<head>`):
*
* ```html
* <canvas id='game'></canvas>
* <a id='tap-to-play' href='#'>Tap to Play</a>
* <style>
* #wrapper {
* position: relative;
* width: 500px;
* height: 500px;
* }
* #tap-to-play {
* display: none;
* font-size: 24px;
* font-family: sans-serif;
* text-align: center;
* border: 3px solid white;
* position: absolute;
* color: white;
* width: 200px;
* height: 50px;
* line-height: 50px;
* text-decoration: none;
* left: 147px;
* top: 80%;
* }
* </style>
* ```
*
* You will have to style the trigger button as you see fit. Reference `sandbox/tests/loader/pauseafter.html` for
* an example CSS style.
* Now we can create a `PauseAfterLoader` with a reference to our trigger button:
*
* ```ts
* var loader = new ex.PauseAfterLoader('tap-to-play', [...]);
* ```
*
* ## Use PauseAfterLoader for iOS
*
* The primary use case for pausing before starting the game is to
* pass Apple's requirement of user interaction.
* pass Apple's requirement of user interaction. The Web Audio context
* in Safari is disabled by default until user interaction.
*
* Therefore, you can use this snippet to only use PauseAfterLoader when
* iOS is detected (see [this thread](http://stackoverflow.com/questions/9038625/detect-if-device-is-ios)
* for more techniques).
*
* ```ts
* var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !(<any>window).MSStream;
* var loader: ex.Loader = iOS ? new ex.PauseAfterLoader() : new ex.Loader();
* var loader: ex.Loader = iOS ? new ex.PauseAfterLoader('tap-to-play') : new ex.Loader();
*
* loader.addResource(...);
* ```
Expand Down
63 changes: 47 additions & 16 deletions dist/Excalibur.js
Expand Up @@ -9981,6 +9981,7 @@ var ex;
/**
* Play an empty sound to unlock Safari WebAudio context. Call this function
* right after a user interaction event. Typically used by [[PauseAfterLoader]]
* @source https://paulbakaus.com/tutorials/html5/web-audio-on-ios/
*/
WebAudio.unlock = function () {
if (this._unlocked || !audioContext) {
Expand All @@ -9999,7 +10000,8 @@ var ex;
}
// by checking the play state after some time, we know if we're really unlocked
setTimeout(function () {
if ((source.playbackState === source.PLAYING_STATE || source.playbackState === source.FINISHED_STATE)) {
if (source.playbackState === source.PLAYING_STATE ||
source.playbackState === source.FINISHED_STATE) {
this._unlocked = true;
}
}, 0);
Expand Down Expand Up @@ -10216,39 +10218,68 @@ var ex;
* **Note:** Because Loader is not part of a Scene, you must
* call `update` and `draw` manually on "child" objects.
*
* ## Custom trigger
* ## Implementing a Trigger
*
* The `PauseAfterLoader` by default uses the [[PlayTrigger]]
* which wraps an HTML `<a>` element to act as a trigger. You can pass in your
* own [[IPauseAfterLoaderTrigger]] implementation to act as a trigger, whenever the user
* taps the element the game will start.
* The `PauseAfterLoader` requires an element to act as the trigger button
* to start the game.
*
* ```ts
* var loader = new ex.PauseAfterLoader([...], 'tap-to-play');
* For example, let's create an `<a>` tag to be our trigger and call it `tap-to-play`.
*
* ```html
* <div id="wrapper">
* <canvas id="game"></canvas>
* <a id="tap-to-play" href='javascript:void(0);'>Tap to Play</a>
* </div>
* ```
*
* And then in your HTML file:
* We've put it inside a wrapper to position it properly over the game canvas.
*
* Now let's add some CSS to style it (insert into `<head>`):
*
* ```html
* <canvas id='game'></canvas>
* <a id='tap-to-play' href='#'>Tap to Play</a>
* <style>
* #wrapper {
* position: relative;
* width: 500px;
* height: 500px;
* }
* #tap-to-play {
* display: none;
* font-size: 24px;
* font-family: sans-serif;
* text-align: center;
* border: 3px solid white;
* position: absolute;
* color: white;
* width: 200px;
* height: 50px;
* line-height: 50px;
* text-decoration: none;
* left: 147px;
* top: 80%;
* }
* </style>
* ```
*
* You will have to style the trigger button as you see fit. Reference `sandbox/tests/loader/pauseafter.html` for
* an example CSS style.
* Now we can create a `PauseAfterLoader` with a reference to our trigger button:
*
* ```ts
* var loader = new ex.PauseAfterLoader('tap-to-play', [...]);
* ```
*
* ## Use PauseAfterLoader for iOS
*
* The primary use case for pausing before starting the game is to
* pass Apple's requirement of user interaction.
* pass Apple's requirement of user interaction. The Web Audio context
* in Safari is disabled by default until user interaction.
*
* Therefore, you can use this snippet to only use PauseAfterLoader when
* iOS is detected (see [this thread](http://stackoverflow.com/questions/9038625/detect-if-device-is-ios)
* for more techniques).
*
* ```ts
* var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !(<any>window).MSStream;
* var loader: ex.Loader = iOS ? new ex.PauseAfterLoader() : new ex.Loader();
* var loader: ex.Loader = iOS ? new ex.PauseAfterLoader('tap-to-play') : new ex.Loader();
*
* loader.addResource(...);
* ```
Expand All @@ -10266,7 +10297,7 @@ var ex;
ex.Internal.WebAudio.unlock();
// continue to play game
_this._waitPromise.resolve(_this._loadedValue);
// remove shadow DOM element
// hide DOM element
_this._playTrigger.style.display = 'none';
return false;
};
Expand Down
58 changes: 44 additions & 14 deletions dist/excalibur-0.6.0.d.ts
Expand Up @@ -5246,6 +5246,7 @@ declare module ex.Internal {
/**
* Play an empty sound to unlock Safari WebAudio context. Call this function
* right after a user interaction event. Typically used by [[PauseAfterLoader]]
* @source https://paulbakaus.com/tutorials/html5/web-audio-on-ios/
*/
static unlock(): void;
static isUnlocked(): boolean;
Expand Down Expand Up @@ -5351,39 +5352,68 @@ declare module ex {
* **Note:** Because Loader is not part of a Scene, you must
* call `update` and `draw` manually on "child" objects.
*
* ## Custom trigger
* ## Implementing a Trigger
*
* The `PauseAfterLoader` by default uses the [[PlayTrigger]]
* which wraps an HTML `<a>` element to act as a trigger. You can pass in your
* own [[IPauseAfterLoaderTrigger]] implementation to act as a trigger, whenever the user
* taps the element the game will start.
* The `PauseAfterLoader` requires an element to act as the trigger button
* to start the game.
*
* ```ts
* var loader = new ex.PauseAfterLoader([...], 'tap-to-play');
* For example, let's create an `<a>` tag to be our trigger and call it `tap-to-play`.
*
* ```html
* <div id="wrapper">
* <canvas id="game"></canvas>
* <a id="tap-to-play" href='javascript:void(0);'>Tap to Play</a>
* </div>
* ```
*
* And then in your HTML file:
* We've put it inside a wrapper to position it properly over the game canvas.
*
* Now let's add some CSS to style it (insert into `<head>`):
*
* ```html
* <canvas id='game'></canvas>
* <a id='tap-to-play' href='#'>Tap to Play</a>
* <style>
* #wrapper {
* position: relative;
* width: 500px;
* height: 500px;
* }
* #tap-to-play {
* display: none;
* font-size: 24px;
* font-family: sans-serif;
* text-align: center;
* border: 3px solid white;
* position: absolute;
* color: white;
* width: 200px;
* height: 50px;
* line-height: 50px;
* text-decoration: none;
* left: 147px;
* top: 80%;
* }
* </style>
* ```
*
* You will have to style the trigger button as you see fit. Reference `sandbox/tests/loader/pauseafter.html` for
* an example CSS style.
* Now we can create a `PauseAfterLoader` with a reference to our trigger button:
*
* ```ts
* var loader = new ex.PauseAfterLoader('tap-to-play', [...]);
* ```
*
* ## Use PauseAfterLoader for iOS
*
* The primary use case for pausing before starting the game is to
* pass Apple's requirement of user interaction.
* pass Apple's requirement of user interaction. The Web Audio context
* in Safari is disabled by default until user interaction.
*
* Therefore, you can use this snippet to only use PauseAfterLoader when
* iOS is detected (see [this thread](http://stackoverflow.com/questions/9038625/detect-if-device-is-ios)
* for more techniques).
*
* ```ts
* var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !(<any>window).MSStream;
* var loader: ex.Loader = iOS ? new ex.PauseAfterLoader() : new ex.Loader();
* var loader: ex.Loader = iOS ? new ex.PauseAfterLoader('tap-to-play') : new ex.Loader();
*
* loader.addResource(...);
* ```
Expand Down

0 comments on commit 51c2f82

Please sign in to comment.