Phaser.Create = function (game){ this.game = game; this.bmd = game.make.bitmapData(); this.canvas = this.bmd.canvas; this.ctx = this.bmd.context; this.palettes = [{ 0: '#000', 1: '#9D9D9D', 2: '#FFF', 3: '#BE2633', 4: '#E06F8B', 5: '#493C2B', 6: '#A46422', 7: '#EB8931', 8: '#F7E26B', 9: '#2F484E', A: '#44891A', B: '#A3CE27', C: '#1B2632', D: '#005784', E: '#31A2F2', F: '#B2DCEF'} , { 0: '#000', 1: '#191028', 2: '#46af45', 3: '#a1d685', 4: '#453e78', 5: '#7664fe', 6: '#833129', 7: '#9ec2e8', 8: '#dc534b', 9: '#e18d79', A: '#d6b97b', B: '#e9d8a1', C: '#216c4b', D: '#d365c8', E: '#afaab9', F: '#f5f4eb'} , { 0: '#000', 1: '#2234d1', 2: '#0c7e45', 3: '#44aacc', 4: '#8a3622', 5: '#5c2e78', 6: '#aa5c3d', 7: '#b5b5b5', 8: '#5e606e', 9: '#4c81fb', A: '#6cd947', B: '#7be2f9', C: '#eb8a60', D: '#e23d69', E: '#ffd93f', F: '#fff'} , { 0: '#000', 1: '#fff', 2: '#8b4131', 3: '#7bbdc5', 4: '#8b41ac', 5: '#6aac41', 6: '#3931a4', 7: '#d5de73', 8: '#945a20', 9: '#5a4100', A: '#bd736a', B: '#525252', C: '#838383', D: '#acee8b', E: '#7b73de', F: '#acacac'} , { 0: '#000', 1: '#191028', 2: '#46af45', 3: '#a1d685', 4: '#453e78', 5: '#7664fe', 6: '#833129', 7: '#9ec2e8', 8: '#dc534b', 9: '#e18d79', A: '#d6b97b', B: '#e9d8a1', C: '#216c4b', D: '#d365c8', E: '#afaab9', F: '#fff'} ] ; } ; Phaser.Create.PALETTE_ARNE = 0; Phaser.Create.PALETTE_JMP = 1; Phaser.Create.PALETTE_CGA = 2; Phaser.Create.PALETTE_C64 = 3; Phaser.Create.PALETTE_JAPANESE_MACHINE = 4; Phaser.Create.prototype = { texture: function (key, data, pixelWidth, pixelHeight, palette){ if (pixelWidth === undefined) { pixelWidth = 8; } if (pixelHeight === undefined) { pixelHeight = pixelWidth; } if (palette === undefined) { palette = 0; } var w = _AN_Read_length('length', data[0]) * pixelWidth; var h = _AN_Read_length('length', data) * pixelHeight; this.bmd.resize(w, h); _AN_Call_clear('clear', this.bmd); for (var y = 0; y < _AN_Read_length('length', data); y++ ){ var row = data[y]; for (var x = 0; x < _AN_Read_length('length', row); x++ ){ var d = row[x]; if (d !== '.' && d !== ' ') { this.ctx.fillStyle = this.palettes[palette][d]; this.ctx.fillRect(x * pixelWidth, y * pixelHeight, pixelWidth, pixelHeight); } } } return this.bmd.generateTexture(key); } , grid: function (key, width, height, cellWidth, cellHeight, color){ this.bmd.resize(width, height); this.ctx.fillStyle = color; for (var y = 0; y < height; y += cellHeight){ this.ctx.fillRect(0, y, width, 1); } for (var x = 0; x < width; x += cellWidth){ this.ctx.fillRect(x, 0, 1, height); } return this.bmd.generateTexture(key); } } ; Phaser.Create.prototype.constructor = Phaser.Create;