2022-12-02 18:07:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2022 Photon Storm Ltd.
|
|
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
|
|
|
*/
|
|
|
|
|
|
|
|
var NineSlice = require('./NineSlice');
|
|
|
|
var GameObjectFactory = require('../GameObjectFactory');
|
|
|
|
|
|
|
|
/**
|
2022-12-05 21:43:23 +00:00
|
|
|
* Creates a new Nine Slice Game Object and adds it to the Scene.
|
2022-12-02 18:07:20 +00:00
|
|
|
*
|
2022-12-05 21:43:23 +00:00
|
|
|
* Note: This method will only be available if the Nine Slice Game Object and WebGL support have been built into Phaser.
|
2022-12-02 18:07:20 +00:00
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.GameObjectFactory#nineslice
|
|
|
|
* @webglOnly
|
|
|
|
* @since 3.60.0
|
|
|
|
*
|
2022-12-05 21:43:23 +00:00
|
|
|
* @param {object} sliceConfig -
|
2022-12-02 18:07:20 +00:00
|
|
|
* @param {number} [x] - The horizontal position of this Game Object in the world.
|
|
|
|
* @param {number} [y] - The vertical position of this Game Object in the world.
|
|
|
|
* @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.
|
|
|
|
* @param {string|number} [frame] - An optional frame from the Texture this Game Object is rendering with.
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.NineSlice} The Game Object that was created.
|
|
|
|
*/
|
|
|
|
if (typeof WEBGL_RENDERER)
|
|
|
|
{
|
2022-12-05 21:43:23 +00:00
|
|
|
GameObjectFactory.register('nineslice', function (sliceConfig, x, y, texture, frame)
|
2022-12-02 18:07:20 +00:00
|
|
|
{
|
2022-12-05 21:43:23 +00:00
|
|
|
return this.displayList.add(new NineSlice(this.scene, sliceConfig, x, y, texture, frame));
|
2022-12-02 18:07:20 +00:00
|
|
|
});
|
|
|
|
}
|