phaser/v3/src/gameobjects/quad/BuildFromConfig.js

22 lines
687 B
JavaScript
Raw Normal View History

2017-05-19 19:07:30 +00:00
var Quad = require('./Quad');
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
var GetValue = require('../../utils/object/GetValue');
var BuildGameObject = require('../BuildGameObject');
var BuildFromConfig = function (state, config)
{
var key = GetAdvancedValue(config, 'key', null);
var frame = GetAdvancedValue(config, 'frame', null);
var vertices = GetValue(config, 'vertices', []);
var indices = GetValue(config, 'indices', []);
var uv = GetValue(config, 'uv', []);
var quad = new Quad(state, 0, 0, vertices, uv, indices, key, frame);
BuildGameObject(state, quad, config);
return quad;
};
module.exports = BuildFromConfig;