Skip to content

Commit

Permalink
Updated comments and docs for deprecated methods / properties. (#5616)
Browse files Browse the repository at this point in the history
  • Loading branch information
themoonrat authored and bigtimebuddy committed Apr 27, 2019
1 parent 69e6cee commit 33193d8
Show file tree
Hide file tree
Showing 19 changed files with 107 additions and 100 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -123,7 +123,7 @@ const app = new PIXI.Application();
document.body.appendChild(app.view);

// load the texture we need
PIXI.Loader.shared.add('bunny', 'bunny.png').load((loader, resources) => {
app.loader.add('bunny', 'bunny.png').load((loader, resources) => {
// This creates a texture from a 'bunny.png' image
const bunny = new PIXI.Sprite(resources.bunny.texture);

Expand Down
2 changes: 1 addition & 1 deletion bundles/pixi.js-legacy/README.md
Expand Up @@ -38,7 +38,7 @@ const app = new PIXI.Application();
document.body.appendChild(app.view);

// load the texture we need
PIXI.loader.add('bunny', 'bunny.png').load((loader, resources) => {
app.loader.add('bunny', 'bunny.png').load((loader, resources) => {

// This creates a texture from a 'bunny.png' image.
const bunny = new PIXI.Sprite(resources.bunny.texture);
Expand Down
137 changes: 72 additions & 65 deletions bundles/pixi.js/src/useDeprecated.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/app/src/Application.js
Expand Up @@ -48,7 +48,7 @@ export default class Application
* @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance"
* for devices with dual graphics card. **(WebGL only)**.
* @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker.
* @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loaders.shared, `false` to create new Loader.
* @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader.
* @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to.
*/
constructor(options)
Expand Down
8 changes: 4 additions & 4 deletions packages/canvas/canvas-mesh/src/CanvasMeshRenderer.js
Expand Up @@ -70,7 +70,7 @@ export default class CanvasMeshRenderer
* Draws the object in Triangle Mesh mode
*
* @private
* @param {PIXI.RawMesh} mesh - the Mesh to render
* @param {PIXI.Mesh} mesh - the Mesh to render
*/
_renderTriangleMesh(mesh)
{
Expand All @@ -90,7 +90,7 @@ export default class CanvasMeshRenderer
* Draws the object in triangle mode using canvas
*
* @private
* @param {PIXI.RawMesh} mesh - the current mesh
* @param {PIXI.Mesh} mesh - the current mesh
*/
_renderTriangles(mesh)
{
Expand All @@ -113,7 +113,7 @@ export default class CanvasMeshRenderer
* Draws one of the triangles that from the Mesh
*
* @private
* @param {PIXI.RawMesh} mesh - the current mesh
* @param {PIXI.Mesh} mesh - the current mesh
* @param {number} index0 - the index of the first vertex
* @param {number} index1 - the index of the second vertex
* @param {number} index2 - the index of the third vertex
Expand Down Expand Up @@ -231,7 +231,7 @@ export default class CanvasMeshRenderer
* Renders a flat Mesh
*
* @private
* @param {PIXI.RawMesh} mesh - The Mesh to render
* @param {PIXI.Mesh} mesh - The Mesh to render
*/
renderMeshFlat(mesh)
{
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/renderTexture/BaseRenderTexture.js
Expand Up @@ -14,7 +14,7 @@ import Framebuffer from '../framebuffer/Framebuffer';
* let renderer = PIXI.autoDetectRenderer();
* let baseRenderTexture = new PIXI.BaseRenderTexture(800, 600);
* let renderTexture = new PIXI.RenderTexture(baseRenderTexture);
* let sprite = PIXI.Sprite.fromImage("spinObj_01.png");
* let sprite = PIXI.Sprite.from("spinObj_01.png");
*
* sprite.position.x = 800/2;
* sprite.position.y = 600/2;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/textures/Texture.js
Expand Up @@ -374,7 +374,7 @@ export default class Texture extends EventEmitter
name = imageUrl;
}

// lets also add the frame to pixi's global cache for fromFrame and fromImage functions
// lets also add the frame to pixi's global cache for 'fromLoader' function
BaseTexture.addToCache(texture.baseTexture, name);
Texture.addToCache(texture, name);

Expand Down
2 changes: 1 addition & 1 deletion packages/mesh-extras/package.json
Expand Up @@ -4,7 +4,7 @@
"main": "lib/mesh-extras.js",
"module": "lib/mesh-extras.es.js",
"bundle": "dist/mesh-extras.js",
"description": "Custom Mesh display objects, like Rope and Plane",
"description": "Custom Mesh display objects, like Rope and SimplePlane",
"author": "Mat Groves",
"contributors": [
"Matt Karl <matt@mattkarl.com>"
Expand Down
6 changes: 3 additions & 3 deletions packages/mesh-extras/src/SimplePlane.js
Expand Up @@ -3,13 +3,13 @@ import { Mesh, MeshMaterial } from '@pixi/mesh';
import PlaneGeometry from './geometry/PlaneGeometry';

/**
* The Plane allows you to draw a texture across several points and then manipulate these points
* The SimplePlane allows you to draw a texture across several points and then manipulate these points
*
*```js
* for (let i = 0; i < 20; i++) {
* points.push(new PIXI.Point(i * 50, 0));
* };
* let Plane = new PIXI.Plane(PIXI.Texture.from("snake.png"), points);
* let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from("snake.png"), points);
* ```
*
* @class
Expand All @@ -20,7 +20,7 @@ import PlaneGeometry from './geometry/PlaneGeometry';
export default class SimplePlane extends Mesh
{
/**
* @param {PIXI.Texture} texture - The texture to use on the Plane.
* @param {PIXI.Texture} texture - The texture to use on the SimplePlane.
* @param {number} verticesX - The number of vertices in the x-axis
* @param {number} verticesY - The number of vertices in the y-axis
*/
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/mesh-extras/test/index.js
@@ -1 +1 @@
require('./Plane');
require('./SimplePlane');
4 changes: 2 additions & 2 deletions packages/prepare/src/BasePrepare.js
Expand Up @@ -9,7 +9,7 @@ import CountLimiter from './CountLimiter';
* The prepare manager provides functionality to upload content to the GPU.
*
* BasePrepare handles basic queuing functionality and is extended by
* {@link PIXI.prepare.WebGLPrepare} and {@link PIXI.prepare.CanvasPrepare}
* {@link PIXI.prepare.Prepare} and {@link PIXI.prepare.CanvasPrepare}
* to provide preparation capabilities specific to their respective renderers.
*
* @example
Expand Down Expand Up @@ -49,7 +49,7 @@ export default class BasePrepare
this.renderer = renderer;

/**
* The only real difference between CanvasPrepare and WebGLPrepare is what they pass
* The only real difference between CanvasPrepare and Prepare is what they pass
* to upload hooks. That different parameter is stored here.
* @type {PIXI.prepare.CanvasPrepare|PIXI.Renderer}
* @protected
Expand Down
4 changes: 2 additions & 2 deletions packages/settings/src/settings.js
Expand Up @@ -89,7 +89,7 @@ export default {
* @property {number} resolution=1
* @property {boolean} antialias=false
* @property {boolean} forceFXAA=false
* @property {boolean} autoResize=false
* @property {boolean} autoDensity=false
* @property {boolean} transparent=false
* @property {number} backgroundColor=0x000000
* @property {boolean} clearBeforeRender=true
Expand All @@ -102,7 +102,7 @@ export default {
view: null,
antialias: false,
forceFXAA: false,
autoResize: false,
autoDensity: false,
transparent: false,
backgroundColor: 0x000000,
clearBeforeRender: true,
Expand Down
16 changes: 8 additions & 8 deletions packages/sprite-animated/src/AnimatedSprite.js
Expand Up @@ -22,10 +22,10 @@ import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';
* containing the animation definitions:
*
* ```js
* PIXI.loader.add("assets/spritesheet.json").load(setup);
* PIXI.Loader.shared.add("assets/spritesheet.json").load(setup);
*
* function setup() {
* let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet;
* let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet;
* animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]);
* ...
* }
Expand Down Expand Up @@ -99,14 +99,14 @@ export default class AnimatedSprite extends Sprite
this.updateAnchor = false;

/**
* Function to call when a AnimatedSprite finishes playing.
* Function to call when an AnimatedSprite finishes playing.
*
* @member {Function}
*/
this.onComplete = null;

/**
* Function to call when a AnimatedSprite changes which texture is being rendered.
* Function to call when an AnimatedSprite changes which texture is being rendered.
*
* @member {Function}
*/
Expand Down Expand Up @@ -331,10 +331,10 @@ export default class AnimatedSprite extends Sprite
}

/**
* A short hand way of creating a movieclip from an array of frame ids.
* A short hand way of creating an AnimatedSprite from an array of frame ids.
*
* @static
* @param {string[]} frames - The array of frames ids the movieclip will use as its texture frames.
* @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames.
* @return {AnimatedSprite} The new animated sprite with the specified frames.
*/
static fromFrames(frames)
Expand All @@ -350,10 +350,10 @@ export default class AnimatedSprite extends Sprite
}

/**
* A short hand way of creating a movieclip from an array of image ids.
* A short hand way of creating an AnimatedSprite from an array of image ids.
*
* @static
* @param {string[]} images - The array of image urls the movieclip will use as its texture frames.
* @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames.
* @return {AnimatedSprite} The new animate sprite with the specified images as frames.
*/
static fromImages(images)
Expand Down
4 changes: 2 additions & 2 deletions packages/sprite/src/Sprite.js
Expand Up @@ -21,10 +21,10 @@ const indices = new Uint16Array([0, 1, 2, 0, 2, 3]);
* as swapping base textures when rendering to the screen is inefficient.
*
* ```js
* PIXI.loader.add("assets/spritesheet.json").load(setup);
* PIXI.Loader.shared.add("assets/spritesheet.json").load(setup);
*
* function setup() {
* let sheet = PIXI.loader.resources["assets/spritesheet.json"].spritesheet;
* let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet;
* let sprite = new PIXI.Sprite(sheet.textures["image.png"]);
* ...
* }
Expand Down
6 changes: 3 additions & 3 deletions packages/spritesheet/src/Spritesheet.js
Expand Up @@ -9,10 +9,10 @@ import { getResolutionOfUrl } from '@pixi/utils';
* To access a sprite sheet from your code pass its JSON data file to Pixi's loader:
*
* ```js
* PIXI.loader.add("images/spritesheet.json").load(setup);
* PIXI.Loader.shared.add("images/spritesheet.json").load(setup);
*
* function setup() {
* let sheet = PIXI.loader.resources["images/spritesheet.json"].spritesheet;
* let sheet = PIXI.Loader.shared.resources["images/spritesheet.json"].spritesheet;
* ...
* }
* ```
Expand Down Expand Up @@ -244,7 +244,7 @@ export default class Spritesheet
data.anchor
);

// lets also add the frame to pixi's global cache for fromFrame and fromImage functions
// lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions
Texture.addToCache(this.textures[i], i);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/spritesheet/test/SpritesheetLoader.js
Expand Up @@ -95,7 +95,7 @@ describe('PIXI.SpritesheetLoader', function ()
const loader = new Loader();

// provide a mock pre-loader that creates an empty base texture for compressed texture assets
// this is necessary because the spritesheetParser expects a baseTexture on the resource
// this is necessary because the SpriteSheetLoader expects a baseTexture on the resource
loader.pre((resource, next) =>
{
if (resource.extension === 'crn')
Expand Down
2 changes: 1 addition & 1 deletion packages/ticker/src/Ticker.js
Expand Up @@ -501,7 +501,7 @@ export default class Ticker
/**
* Manages the minimum amount of milliseconds allowed to
* elapse between invoking {@link PIXI.Ticker#update}.
* This will effect the measured value of {@link PIXI.ticker.Ticker#FPS}.
* This will effect the measured value of {@link PIXI.Ticker#FPS}.
* When setting this property it is clamped to a value between
* `1` and `TARGET_FPMS * 1000`.
*
Expand Down
4 changes: 2 additions & 2 deletions tools/integration-tests/test/display/Bounds.js
Expand Up @@ -4,7 +4,7 @@ const { Sprite } = require('@pixi/sprite');
const { Rectangle } = require('@pixi/math');
const { Graphics } = require('@pixi/graphics');
const { Text } = require('@pixi/text');
// const { Plane } = require('@pixi/mesh');
// const { SimplePlane } = require('@pixi/mesh-extras');

describe('getBounds', function ()
{
Expand Down Expand Up @@ -199,7 +199,7 @@ describe('getBounds', function ()
const texture = RenderTexture.create(10, 10);
const plane = new Plane(texture);
const plane = new SimplePlane(texture);
parent.addChild(plane);
Expand Down

0 comments on commit 33193d8

Please sign in to comment.