mirror of
https://github.com/photonstorm/phaser
synced 2024-09-20 06:21:54 +00:00
3.60.0 Beta 3 Defs
This commit is contained in:
parent
03345ea60c
commit
209e292214
1 changed files with 154 additions and 62 deletions
216
types/phaser.d.ts
vendored
216
types/phaser.d.ts
vendored
|
@ -40630,7 +40630,7 @@ declare namespace Phaser {
|
|||
* ```
|
||||
*
|
||||
* You can only display fonts that are currently loaded and available to the browser: therefore fonts must
|
||||
* be pre-loaded. Phaser does not do ths for you, so you will require the use of a 3rd party font loader,
|
||||
* be pre-loaded. Phaser does not do this for you, so you will require the use of a 3rd party font loader,
|
||||
* or have the fonts ready available in the CSS on the page in which your Phaser game resides.
|
||||
*
|
||||
* See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts
|
||||
|
@ -53652,11 +53652,22 @@ declare namespace Phaser {
|
|||
*/
|
||||
constructor(loader: Phaser.Loader.LoaderPlugin, key: string, entry: Phaser.Types.Loader.FileTypes.CompressedTextureFileEntry, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
|
||||
|
||||
/**
|
||||
* Called by each File when it finishes loading.
|
||||
* @param file The File that has completed processing.
|
||||
*/
|
||||
onFileComplete(file: Phaser.Loader.File): void;
|
||||
|
||||
/**
|
||||
* Adds this file to its target cache upon successful loading and processing.
|
||||
*/
|
||||
addToCache(): void;
|
||||
|
||||
/**
|
||||
* Adds all of the multi-file entties to their target caches upon successful loading and processing.
|
||||
*/
|
||||
addMultiToCache(): void;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55144,9 +55155,9 @@ declare namespace Phaser {
|
|||
* You can call this method from within your Scene's `preload`, along with any other files you wish to load:
|
||||
*
|
||||
* ```javascript
|
||||
* function preload ()
|
||||
* preload ()
|
||||
* {
|
||||
* this.load.texture('pic', {
|
||||
* this.load.texture('yourPic', {
|
||||
* ASTC: { type: 'PVR', textureURL: 'pic-astc-4x4.pvr' },
|
||||
* PVRTC: { type: 'PVR', textureURL: 'pic-pvrtc-4bpp-rgba.pvr' },
|
||||
* S3TC: { type: 'PVR', textureURL: 'pic-dxt5.pvr' },
|
||||
|
@ -55154,6 +55165,40 @@ declare namespace Phaser {
|
|||
* });
|
||||
* ```
|
||||
*
|
||||
* If you wish to load a texture atlas, provide the `atlasURL` property:
|
||||
*
|
||||
* ```javascript
|
||||
* preload ()
|
||||
* {
|
||||
* const path = 'assets/compressed';
|
||||
*
|
||||
* this.load.texture('yourAtlas', {
|
||||
* 'ASTC': { type: 'PVR', textureURL: `${path}/textures-astc-4x4.pvr`, atlasURL: `${path}/textures.json` },
|
||||
* 'PVRTC': { type: 'PVR', textureURL: `${path}/textures-pvrtc-4bpp-rgba.pvr`, atlasURL: `${path}/textures-pvrtc-4bpp-rgba.json` },
|
||||
* 'S3TC': { type: 'PVR', textureURL: `${path}/textures-dxt5.pvr`, atlasURL: `${path}/textures-dxt5.json` },
|
||||
* 'IMG': { textureURL: `${path}/textures.png`, atlasURL: `${path}/textures.json` }
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* If you wish to load a Multi Atlas, as exported from Texture Packer Pro, use the `multiAtlasURL` property instead:
|
||||
*
|
||||
* ```javascript
|
||||
* preload ()
|
||||
* {
|
||||
* const path = 'assets/compressed';
|
||||
*
|
||||
* this.load.texture('yourAtlas', {
|
||||
* 'ASTC': { type: 'PVR', atlasURL: `${path}/textures.json` },
|
||||
* 'PVRTC': { type: 'PVR', atlasURL: `${path}/textures-pvrtc-4bpp-rgba.json` },
|
||||
* 'S3TC': { type: 'PVR', atlasURL: `${path}/textures-dxt5.json` },
|
||||
* 'IMG': { atlasURL: `${path}/textures.json` }
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* When loading a Multi Atlas you do not need to specify the `textureURL` property as it will be read from the JSON file.
|
||||
*
|
||||
* The number of formats you provide to this function is up to you, but you should ensure you
|
||||
* cover the primary platforms where appropriate.
|
||||
*
|
||||
|
@ -60961,6 +61006,10 @@ declare namespace Phaser {
|
|||
* The pipeline class. This should be a constructable object, **not** an instance of a class.
|
||||
*/
|
||||
pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
|
||||
/**
|
||||
* Sets the `PipelineManager.frameInc` value to control the dimension increase in the Render Targets.
|
||||
*/
|
||||
frameInc?: number;
|
||||
};
|
||||
|
||||
type PluginObject = {
|
||||
|
@ -62012,14 +62061,14 @@ declare namespace Phaser {
|
|||
* `key` is required. {@link Phaser.GameObjects.Group#defaultKey} is not used.
|
||||
*/
|
||||
type GroupCreateConfig = {
|
||||
/**
|
||||
* The texture key of each new Game Object. Must be provided or not objects will be created.
|
||||
*/
|
||||
key: string | string[];
|
||||
/**
|
||||
* The class of each new Game Object.
|
||||
*/
|
||||
classType?: Function;
|
||||
/**
|
||||
* The texture key of each new Game Object.
|
||||
*/
|
||||
key?: string | string[];
|
||||
/**
|
||||
* The texture frame of each new Game Object.
|
||||
*/
|
||||
|
@ -63993,6 +64042,18 @@ declare namespace Phaser {
|
|||
* Optional URL of a texture atlas JSON data file. If not given, the texture will be loaded as a single image.
|
||||
*/
|
||||
atlasURL?: string;
|
||||
/**
|
||||
* Optional URL of a multi-texture atlas JSON data file as created by Texture Packer Pro.
|
||||
*/
|
||||
multiAtlasURL?: string;
|
||||
/**
|
||||
* Optional path to use when loading the textures defined in the multi atlas data.
|
||||
*/
|
||||
multiPath?: string;
|
||||
/**
|
||||
* Optional Base URL to use when loading the textures defined in the multi atlas data.
|
||||
*/
|
||||
multiBaseURL?: string;
|
||||
};
|
||||
|
||||
type CompressedTextureFileConfig = {
|
||||
|
@ -65242,6 +65303,10 @@ declare namespace Phaser {
|
|||
* An arbitrary string-based name to help identify this body.
|
||||
*/
|
||||
label?: string;
|
||||
/**
|
||||
* Set this Game Object to create and use a new Body based on the configuration object given.
|
||||
*/
|
||||
shape?: string | Phaser.Types.Physics.Matter.MatterSetBodyConfig;
|
||||
/**
|
||||
* An array of bodies that make up this body. The first body in the array must always be a self reference to the current body instance. All bodies in the `parts` array together form a single rigid compound body.
|
||||
*/
|
||||
|
@ -81031,6 +81096,29 @@ declare namespace Phaser {
|
|||
*/
|
||||
halfFrame2: Phaser.Renderer.WebGL.RenderTarget;
|
||||
|
||||
/**
|
||||
* An array of RenderTarget instances that belong to this pipeline.
|
||||
*/
|
||||
renderTargets: Phaser.Renderer.WebGL.RenderTarget[];
|
||||
|
||||
/**
|
||||
* The largest render target dimension before we just use a full-screen target.
|
||||
*/
|
||||
maxDimension: number;
|
||||
|
||||
/**
|
||||
* The amount in which each target frame will increase.
|
||||
*
|
||||
* Defaults to 64px but can be overridden in the config.
|
||||
*/
|
||||
frameInc: number;
|
||||
|
||||
/**
|
||||
* The Render Target index. Used internally by the methods
|
||||
* in this class. Do not modify directly.
|
||||
*/
|
||||
targetIndex: number;
|
||||
|
||||
/**
|
||||
* Internal boot handler, called by the WebGLRenderer durings its boot process.
|
||||
*
|
||||
|
@ -81354,6 +81442,26 @@ declare namespace Phaser {
|
|||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
* Gets a Render Target the right size to render the Sprite on.
|
||||
*
|
||||
* If the Sprite exceeds the size of the renderer, the Render Target will only ever be the maximum
|
||||
* size of the renderer.
|
||||
*/
|
||||
getRenderTarget(): Phaser.Renderer.WebGL.RenderTarget;
|
||||
|
||||
/**
|
||||
* Gets a matching Render Target, the same size as the one the Sprite was drawn to,
|
||||
* useful for double-buffer style effects such as blurs.
|
||||
*/
|
||||
getSwapRenderTarget(): Phaser.Renderer.WebGL.RenderTarget;
|
||||
|
||||
/**
|
||||
* Gets a matching Render Target, the same size as the one the Sprite was drawn to,
|
||||
* useful for double-buffer style effects such as blurs.
|
||||
*/
|
||||
getAltSwapRenderTarget(): Phaser.Renderer.WebGL.RenderTarget;
|
||||
|
||||
/**
|
||||
* Destroy the Pipeline Manager, cleaning up all related resources and references.
|
||||
*/
|
||||
|
@ -81813,10 +81921,9 @@ declare namespace Phaser {
|
|||
* `uProjectionMatrix` (mat4)
|
||||
* `uMainSampler` (sampler2D array)
|
||||
*
|
||||
* If you wish to create a custom pipeline extending from this one, you can use two string
|
||||
* declarations in your fragment shader source: `%count%` and `%forloop%`, where `count` is
|
||||
* used to set the number of `sampler2Ds` available, and `forloop` is a block of GLSL code
|
||||
* that will get the currently bound texture unit.
|
||||
* If you wish to create a custom pipeline extending from this one, you should use the string
|
||||
* declaration `%count%` in your fragment shader source, which is used to set the number of
|
||||
* `sampler2Ds` available to the `getSampler` function.
|
||||
*
|
||||
* This pipeline will automatically inject that code for you, should those values exist
|
||||
* in your shader source. If you wish to handle this yourself, you can also use the
|
||||
|
@ -82456,6 +82563,11 @@ declare namespace Phaser {
|
|||
*/
|
||||
quadVertexViewF32: Float32Array;
|
||||
|
||||
/**
|
||||
* The full-screen Render Target that the sprite is first drawn to.
|
||||
*/
|
||||
fsTarget: Phaser.Renderer.WebGL.RenderTarget;
|
||||
|
||||
/**
|
||||
* Handles the resizing of the quad vertex data.
|
||||
* @param width The new width of the quad.
|
||||
|
@ -82465,6 +82577,9 @@ declare namespace Phaser {
|
|||
|
||||
/**
|
||||
* Takes a Sprite Game Object, or any object that extends it, and renders it via this pipeline.
|
||||
*
|
||||
* this method is a proxy for the MultiPipeline method of the same name. The actual rendering
|
||||
* is redirected through to the `batchQuad` method in this pipeline.
|
||||
* @param gameObject The texture based Game Object to add to the batch.
|
||||
* @param camera The Camera to use for the rendering transform.
|
||||
* @param parentTransformMatrix The transform matrix of the parent container, if set.
|
||||
|
@ -82523,7 +82638,7 @@ declare namespace Phaser {
|
|||
* 1----2
|
||||
* ```
|
||||
*
|
||||
* Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3
|
||||
* Where x0 / y0 = 0, x1 / y1 = 1, x2 / y2 = 2 and x3 / y3 = 3
|
||||
* @param gameObject The Game Object, if any, drawing this quad.
|
||||
* @param x0 The top-left x position.
|
||||
* @param y0 The top-left y position.
|
||||
|
@ -82547,7 +82662,7 @@ declare namespace Phaser {
|
|||
batchQuad(gameObject: Phaser.GameObjects.GameObject | null, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, u0: number, v0: number, u1: number, v1: number, tintTL: number, tintTR: number, tintBL: number, tintBR: number, tintEffect: number | boolean, texture?: WebGLTexture): boolean;
|
||||
|
||||
/**
|
||||
* This callback is invoked when you call the `drawSprite` method.
|
||||
* This callback is invoked when a sprite is drawn by this pipeline.
|
||||
*
|
||||
* It will fire after the shader has been set, but before the sprite has been drawn,
|
||||
* so use it to set any additional uniforms you may need.
|
||||
|
@ -82558,42 +82673,6 @@ declare namespace Phaser {
|
|||
*/
|
||||
onDrawSprite(gameObject: Phaser.GameObjects.Sprite, target: Phaser.Renderer.WebGL.RenderTarget): void;
|
||||
|
||||
/**
|
||||
* Draws the Sprite to the given Render Target.
|
||||
*
|
||||
* Any transform or tint that has been applied to the Sprite will be retained when drawn.
|
||||
*
|
||||
* Calling this method will invoke the `onDrawSprite` callback. This callback will fire after
|
||||
* the shader has been set, but before the sprite has been drawn, so use it to set any additional
|
||||
* uniforms you may need.
|
||||
*
|
||||
* Note: Manipulating the Sprite during this callback will _not_ change how it is drawn to the Render Target.
|
||||
* @param target The Render Target to draw the Sprite to.
|
||||
* @param clear Clear the Render Target before drawing the Sprite? Default false.
|
||||
* @param shader The shader to use to draw the Sprite. Defaults to the `drawSpriteShader`.
|
||||
*/
|
||||
drawSprite(target: Phaser.Renderer.WebGL.RenderTarget, clear?: boolean, shader?: Phaser.Renderer.WebGL.WebGLShader): void;
|
||||
|
||||
/**
|
||||
* Gets a Render Target the right size to render the Sprite on.
|
||||
*
|
||||
* If the Sprite exceeds the size of the renderer, the Render Target will only ever be the maximum
|
||||
* size of the renderer.
|
||||
*/
|
||||
getSpriteTarget(): Phaser.Renderer.WebGL.RenderTarget;
|
||||
|
||||
/**
|
||||
* Gets a matching Render Target, the same size as the one the Sprite was drawn to,
|
||||
* useful for double-buffer style effects such as blurs.
|
||||
*/
|
||||
getSwapTarget(): Phaser.Renderer.WebGL.RenderTarget;
|
||||
|
||||
/**
|
||||
* Gets a matching Render Target, the same size as the one the Sprite was drawn to,
|
||||
* useful for double-buffer style effects such as blurs.
|
||||
*/
|
||||
getAltSwapTarget(): Phaser.Renderer.WebGL.RenderTarget;
|
||||
|
||||
/**
|
||||
* This callback is invoked when you call the `copySprite` method.
|
||||
*
|
||||
|
@ -82613,8 +82692,6 @@ declare namespace Phaser {
|
|||
* No target resizing takes place. If the `source` Render Target is larger than the `target`,
|
||||
* then only a portion the same size as the `target` dimensions is copied across.
|
||||
*
|
||||
* Make sure you have enabled `drawToFrame` on this pipeline, or this method won't do anything.
|
||||
*
|
||||
* Calling this method will invoke the `onCopySprite` handler and will also call
|
||||
* the `onFXCopy` callback on the Sprite. Both of these happen prior to the copy, allowing you
|
||||
* to use them to set shader uniforms and other values.
|
||||
|
@ -82697,9 +82774,9 @@ declare namespace Phaser {
|
|||
* `drawToGame` or `copyToGame` methods as the final thing it does. However, you can do as
|
||||
* much additional processing as you like prior to this.
|
||||
* @param target The Render Target to draw to the game.
|
||||
* @param swapTarget The Swap Render Target, useful for double-buffef effects.
|
||||
* @param swapTarget The Swap Render Target, useful for double-buffer effects.
|
||||
*/
|
||||
onDraw(target: Phaser.Renderer.WebGL.RenderTarget, swapTarget: Phaser.Renderer.WebGL.RenderTarget): void;
|
||||
onDraw(target: Phaser.Renderer.WebGL.RenderTarget, swapTarget?: Phaser.Renderer.WebGL.RenderTarget): void;
|
||||
|
||||
/**
|
||||
* Set the UV values for the 6 vertices that make up the quad used by the copy shader.
|
||||
|
@ -82733,6 +82810,11 @@ declare namespace Phaser {
|
|||
*/
|
||||
resetUVs(): void;
|
||||
|
||||
/**
|
||||
* Destroys all shader instances, removes all object references and nulls all external references.
|
||||
*/
|
||||
destroy(): this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83180,15 +83262,15 @@ declare namespace Phaser {
|
|||
function getFloatsFromUintRGB(rgb: number): any[];
|
||||
|
||||
/**
|
||||
* Check to see how many texture units the GPU supports, based on the given config value.
|
||||
* Then tests this against the maximum number of iterations GLSL can support.
|
||||
* Check to see how many texture units the GPU supports in a fragment shader
|
||||
* and if the value specific in the game config is allowed.
|
||||
* @param gl The WebGLContext used to create the shaders.
|
||||
* @param maxTextures The Game Config maxTextures value.
|
||||
*/
|
||||
function checkShaderMax(gl: WebGLRenderingContext, maxTextures: number): number;
|
||||
|
||||
/**
|
||||
* Checks the given Fragment Shader Source for `%count%` and `%forloop%` declarations and
|
||||
* Checks the given Fragment Shader Source for `%count%` declarations and
|
||||
* replaces those with GLSL code for setting `texture = texture2D(uMainSampler[i], outTexCoord)`.
|
||||
* @param fragmentShaderSource The Fragment Shader source code to operate on.
|
||||
* @param maxTextures The number of maxTextures value.
|
||||
|
@ -83508,6 +83590,14 @@ declare namespace Phaser {
|
|||
*/
|
||||
setProjectionMatrix(width: number, height: number): this;
|
||||
|
||||
/**
|
||||
* Adjusts this pipelines ortho Projection Matrix to flip the y
|
||||
* and bottom values. Call with 'false' as the parameter to flip
|
||||
* them back again.
|
||||
* @param flipY Flip the y and bottom values? Default true.
|
||||
*/
|
||||
flipProjectionMatrix(flipY?: boolean): void;
|
||||
|
||||
/**
|
||||
* Adjusts this pipelines ortho Projection Matrix to match that of the global
|
||||
* WebGL Renderer Projection Matrix.
|
||||
|
@ -83573,8 +83663,9 @@ declare namespace Phaser {
|
|||
* however, you can do as much additional processing as you like in this method if
|
||||
* you override it from within your own pipelines.
|
||||
* @param renderTarget The Render Target.
|
||||
* @param swapTarget A Swap Render Target, useful for double-buffer effects. Only set by SpriteFX Pipelines.
|
||||
*/
|
||||
onDraw(renderTarget: Phaser.Renderer.WebGL.RenderTarget): void;
|
||||
onDraw(renderTarget: Phaser.Renderer.WebGL.RenderTarget, swapTarget?: Phaser.Renderer.WebGL.RenderTarget): void;
|
||||
|
||||
/**
|
||||
* This method is called every time the Pipeline Manager deactivates this pipeline, swapping from
|
||||
|
@ -84126,8 +84217,8 @@ declare namespace Phaser {
|
|||
* directly, use the `WebGLShader` method equivalent instead, to avoid the program
|
||||
* being set.
|
||||
* @param name The name of the uniform to set.
|
||||
* @param transpose Should the matrix be transpose
|
||||
* @param matrix Matrix data
|
||||
* @param transpose Whether to transpose the matrix. Should be `false`.
|
||||
* @param matrix The matrix data. If using a Matrix4 this should be the `Matrix4.val` property.
|
||||
* @param shader The shader to set the value on. If not given, the `currentShader` is used.
|
||||
*/
|
||||
setMatrix4fv(name: string, transpose: boolean, matrix: Float32Array, shader?: Phaser.Renderer.WebGL.WebGLShader): this;
|
||||
|
@ -85986,7 +86077,8 @@ declare namespace Phaser {
|
|||
getParent(config: Phaser.Types.Core.GameConfig): void;
|
||||
|
||||
/**
|
||||
* Calculates the size of the parent bounds and updates the `parentSize` component, if the canvas has a dom parent.
|
||||
* Calculates the size of the parent bounds and updates the `parentSize`
|
||||
* properties, only if the canvas has a dom parent.
|
||||
*/
|
||||
getParentBounds(): boolean;
|
||||
|
||||
|
@ -87679,9 +87771,9 @@ declare namespace Phaser {
|
|||
class Scene {
|
||||
/**
|
||||
*
|
||||
* @param config Scene specific configuration settings.
|
||||
* @param config The scene key or scene specific configuration settings.
|
||||
*/
|
||||
constructor(config: string | Phaser.Types.Scenes.SettingsConfig);
|
||||
constructor(config?: string | Phaser.Types.Scenes.SettingsConfig);
|
||||
|
||||
/**
|
||||
* The Scene Systems. You must never overwrite this property, or all hell will break lose.
|
||||
|
|
Loading…
Reference in a new issue