Merge pull request #5022 from samme/docs/misc-5

Docs updates
This commit is contained in:
Chris Andrew 2020-04-02 01:15:10 +01:00 committed by GitHub
commit 8e265428ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 44 additions and 36 deletions

View file

@ -225,8 +225,8 @@ var Transform = {
/**
* The angle of this Game Object in radians.
*
* Phaser uses a right-hand clockwise rotation system, where 0 is right, 90 is down, 180/-180 is left
* and -90 is up.
* Phaser uses a right-hand clockwise rotation system, where 0 is right, PI/2 is down, +-PI is left
* and -PI/2 is up.
*
* If you prefer to work in degrees, see the `angle` property instead.
*

View file

@ -423,7 +423,7 @@ var Vector2 = new Class({
},
/**
* Right-hand normalize (make unit length) this Vector.
* Rotate this Vector to its perpendicular, in the positive direction.
*
* @method Phaser.Math.Vector2#normalizeRightHand
* @since 3.0.0
@ -560,7 +560,7 @@ var Vector2 = new Class({
/**
* A static zero Vector2 for use by reference.
*
*
* This constant is meant for comparison operations and should not be modified directly.
*
* @constant
@ -572,7 +572,7 @@ Vector2.ZERO = new Vector2();
/**
* A static right Vector2 for use by reference.
*
*
* This constant is meant for comparison operations and should not be modified directly.
*
* @constant
@ -584,7 +584,7 @@ Vector2.RIGHT = new Vector2(1, 0);
/**
* A static left Vector2 for use by reference.
*
*
* This constant is meant for comparison operations and should not be modified directly.
*
* @constant
@ -596,7 +596,7 @@ Vector2.LEFT = new Vector2(-1, 0);
/**
* A static up Vector2 for use by reference.
*
*
* This constant is meant for comparison operations and should not be modified directly.
*
* @constant
@ -608,7 +608,7 @@ Vector2.UP = new Vector2(0, -1);
/**
* A static down Vector2 for use by reference.
*
*
* This constant is meant for comparison operations and should not be modified directly.
*
* @constant
@ -620,7 +620,7 @@ Vector2.DOWN = new Vector2(0, 1);
/**
* A static one Vector2 for use by reference.
*
*
* This constant is meant for comparison operations and should not be modified directly.
*
* @constant

View file

@ -7,7 +7,7 @@
/**
* Linear easing (no variation).
*
* @function Phaser.Math.Easing.Linear.Linear
* @function Phaser.Math.Easing.Linear
* @since 3.0.0
*
* @param {number} v - The value to be tweened.

View file

@ -7,7 +7,7 @@
/**
* Stepped easing.
*
* @function Phaser.Math.Easing.Stepped.Stepped
* @function Phaser.Math.Easing.Stepped
* @since 3.0.0
*
* @param {number} v - The value to be tweened.

View file

@ -15,7 +15,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject');
* @classdesc
* An Arcade Physics Group object.
*
* All Game Objects created by this Group will automatically be given dynamic Arcade Physics bodies.
* All Game Objects created by or added to this Group will automatically be given dynamic Arcade Physics bodies, if they have no body.
*
* Its static counterpart is {@link Phaser.Physics.Arcade.StaticGroup}.
*

View file

@ -15,7 +15,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject');
* @classdesc
* An Arcade Physics Static Group object.
*
* All Game Objects created by this Group will automatically be given static Arcade Physics bodies.
* All Game Objects created by or added to this Group will automatically be given static Arcade Physics bodies, if they have no body.
*
* Its dynamic counterpart is {@link Phaser.Physics.Arcade.Group}.
*

View file

@ -14,12 +14,7 @@ var NOOP = require('../utils/NOOP');
/**
* @classdesc
* The sound manager is responsible for playing back audio via Web Audio API or HTML Audio tag as fallback.
* The audio file type and the encoding of those files are extremely important.
*
* Not all browsers can play all audio formats.
*
* There is a good guide to what's supported [here](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support).
* Base class for other Sound Manager classes.
*
* @class BaseSoundManager
* @extends Phaser.Events.EventEmitter
@ -28,6 +23,10 @@ var NOOP = require('../utils/NOOP');
* @since 3.0.0
*
* @param {Phaser.Game} game - Reference to the current game instance.
*
* @see Phaser.Sound.HTML5AudioSoundManager
* @see Phaser.Sound.NoAudioSoundManager
* @see Phaser.Sound.WebAudioSoundManager
*/
var BaseSoundManager = new Class({
@ -266,8 +265,9 @@ var BaseSoundManager = new Class({
},
/**
* Enables playing audio sprite sound on the fly without the need to keep a reference to it.
* Sound will auto destroy once its playback ends.
* Adds a new audio sprite sound to the sound manager and plays it.
* The sprite will be automatically removed (destroyed) once playback ends.
* This lets you play a new sound on the fly without the need to keep a reference to it.
*
* @method Phaser.Sound.BaseSoundManager#playAudioSprite
* @listens Phaser.Sound.Events#COMPLETE

View file

@ -12,16 +12,20 @@ var HTML5AudioSound = require('./HTML5AudioSound');
/**
* HTML5 Audio implementation of the Sound Manager.
*
* Note: To play multiple instances of the same HTML5 Audio sound, you need to provide an `instances` value when
*
* To play multiple instances of the same HTML5 Audio sound, you need to provide an `instances` value when
* loading the sound with the Loader:
*
*
* ```javascript
* this.load.audio('explosion', 'explosion.mp3', {
* instances: 2
* });
* ```
*
* Not all browsers can play all audio formats.
*
* There is a good guide to what's supported: [Cross-browser audio basics: Audio codec support](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support).
*
* @class HTML5AudioSoundManager
* @extends Phaser.Sound.BaseSoundManager
* @memberof Phaser.Sound

View file

@ -13,10 +13,10 @@ var NOOP = require('../../utils/NOOP');
/**
* @classdesc
* No audio implementation of the sound manager. It is used if audio has been
* No-audio implementation of the Sound Manager. It is used if audio has been
* disabled in the game config or the device doesn't support any audio.
*
* It represents a graceful degradation of sound manager logic that provides
* It represents a graceful degradation of Sound Manager logic that provides
* minimal functionality and prevents Phaser projects that use audio from
* breaking on devices that don't support any audio playback technologies.
*

View file

@ -13,7 +13,11 @@ var WebAudioSound = require('./WebAudioSound');
/**
* @classdesc
* Web Audio API implementation of the sound manager.
* Web Audio API implementation of the Sound Manager.
*
* Not all browsers can play all audio formats.
*
* There is a good guide to what's supported: [Cross-browser audio basics: Audio codec support](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support).
*
* @class WebAudioSoundManager
* @extends Phaser.Sound.BaseSoundManager
@ -117,7 +121,7 @@ var WebAudioSoundManager = new Class({
/**
* This method takes a new AudioContext reference and then sets
* this Sound Manager to use that context for all playback.
*
*
* As part of this call it also disconnects the master mute and volume
* nodes and then re-creates them on the new given context.
*
@ -180,16 +184,16 @@ var WebAudioSoundManager = new Class({
/**
* Decode audio data into a format ready for playback via Web Audio.
*
*
* The audio data can be a base64 encoded string, an audio media-type data uri, or an ArrayBuffer instance.
*
*
* The `audioKey` is the key that will be used to save the decoded audio to the audio cache.
*
*
* Instead of passing a single entry you can instead pass an array of `Phaser.Types.Sound.DecodeAudioConfig`
* objects as the first and only argument.
*
*
* Decoding is an async process, so be sure to listen for the events to know when decoding has completed.
*
*
* Once the audio has decoded it can be added to the Sound Manager or played via its key.
*
* @method Phaser.Sound.WebAudioSoundManager#decodeAudio
@ -231,7 +235,7 @@ var WebAudioSoundManager = new Class({
var success = function (key, audioBuffer)
{
cache.add(key, audioBuffer);
this.emit(Events.DECODED, key);
remaining--;
@ -241,7 +245,7 @@ var WebAudioSoundManager = new Class({
this.emit(Events.DECODED_ALL);
}
}.bind(this, key);
var failure = function (key, error)
{
// eslint-disable-next-line no-console
@ -283,7 +287,7 @@ var WebAudioSoundManager = new Class({
body.removeEventListener('touchend', unlockHandler);
body.removeEventListener('click', unlockHandler);
body.removeEventListener('keydown', unlockHandler);
_this.unlocked = true;
}, function ()
{