2
0
Fork 0
mirror of https://github.com/photonstorm/phaser synced 2024-12-23 11:33:28 +00:00
phaser/src/gameobjects/image/ImageCreator.js

18 lines
599 B
JavaScript

var BuildGameObject = require('../BuildGameObject');
var GameObjectCreator = require('../GameObjectCreator');
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
var Image = require('./Image');
// When registering a factory function 'this' refers to the GameObjectCreator context.
GameObjectCreator.register('image', function (config)
{
var key = GetAdvancedValue(config, 'key', null);
var frame = GetAdvancedValue(config, 'frame', null);
var image = new Image(this.scene, 0, 0, key, frame);
BuildGameObject(this.scene, image, config);
return image;
});