pixie files update
This commit is contained in:
parent
b7d79cb2d6
commit
9da560524f
2 changed files with 50 additions and 24 deletions
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (c) 2012, Mat Groves
|
* Copyright (c) 2012, Mat Groves
|
||||||
* http://goodboydigital.com/
|
* http://goodboydigital.com/
|
||||||
*
|
*
|
||||||
* Compiled: 2014-01-09
|
* Compiled: 2014-01-10
|
||||||
*
|
*
|
||||||
* pixi.js is licensed under the MIT License.
|
* pixi.js is licensed under the MIT License.
|
||||||
* http://www.opensource.org/licenses/mit-license.php
|
* http://www.opensource.org/licenses/mit-license.php
|
||||||
|
@ -2256,6 +2256,8 @@ PIXI.Text.prototype.updateText = function()
|
||||||
var lineHeight = this.determineFontHeight('font: ' + this.style.font + ';') + this.style.strokeThickness;
|
var lineHeight = this.determineFontHeight('font: ' + this.style.font + ';') + this.style.strokeThickness;
|
||||||
this.canvas.height = lineHeight * lines.length;
|
this.canvas.height = lineHeight * lines.length;
|
||||||
|
|
||||||
|
if(navigator.isCocoonJS) this.context.clearRect(0,0,this.canvas.width,this.canvas.height);
|
||||||
|
|
||||||
//set canvas text styles
|
//set canvas text styles
|
||||||
this.context.fillStyle = this.style.fill;
|
this.context.fillStyle = this.style.fill;
|
||||||
this.context.font = this.style.font;
|
this.context.font = this.style.font;
|
||||||
|
@ -3103,6 +3105,10 @@ PIXI.InteractionManager.prototype.onTouchMove = function(event)
|
||||||
// update the touch position
|
// update the touch position
|
||||||
touchData.global.x = (touchEvent.clientX - rect.left) * (this.target.width / rect.width);
|
touchData.global.x = (touchEvent.clientX - rect.left) * (this.target.width / rect.width);
|
||||||
touchData.global.y = (touchEvent.clientY - rect.top) * (this.target.height / rect.height);
|
touchData.global.y = (touchEvent.clientY - rect.top) * (this.target.height / rect.height);
|
||||||
|
if(navigator.isCocoonJS) {
|
||||||
|
touchData.global.x = touchEvent.clientX;
|
||||||
|
touchData.global.y = touchEvent.clientY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var length = this.interactiveItems.length;
|
var length = this.interactiveItems.length;
|
||||||
|
@ -3138,6 +3144,10 @@ PIXI.InteractionManager.prototype.onTouchStart = function(event)
|
||||||
this.touchs[touchEvent.identifier] = touchData;
|
this.touchs[touchEvent.identifier] = touchData;
|
||||||
touchData.global.x = (touchEvent.clientX - rect.left) * (this.target.width / rect.width);
|
touchData.global.x = (touchEvent.clientX - rect.left) * (this.target.width / rect.width);
|
||||||
touchData.global.y = (touchEvent.clientY - rect.top) * (this.target.height / rect.height);
|
touchData.global.y = (touchEvent.clientY - rect.top) * (this.target.height / rect.height);
|
||||||
|
if(navigator.isCocoonJS) {
|
||||||
|
touchData.global.x = touchEvent.clientX;
|
||||||
|
touchData.global.y = touchEvent.clientY;
|
||||||
|
}
|
||||||
|
|
||||||
var length = this.interactiveItems.length;
|
var length = this.interactiveItems.length;
|
||||||
|
|
||||||
|
@ -3183,6 +3193,10 @@ PIXI.InteractionManager.prototype.onTouchEnd = function(event)
|
||||||
var up = false;
|
var up = false;
|
||||||
touchData.global.x = (touchEvent.clientX - rect.left) * (this.target.width / rect.width);
|
touchData.global.x = (touchEvent.clientX - rect.left) * (this.target.width / rect.width);
|
||||||
touchData.global.y = (touchEvent.clientY - rect.top) * (this.target.height / rect.height);
|
touchData.global.y = (touchEvent.clientY - rect.top) * (this.target.height / rect.height);
|
||||||
|
if(navigator.isCocoonJS) {
|
||||||
|
touchData.global.x = touchEvent.clientX;
|
||||||
|
touchData.global.y = touchEvent.clientY;
|
||||||
|
}
|
||||||
|
|
||||||
var length = this.interactiveItems.length;
|
var length = this.interactiveItems.length;
|
||||||
for (var j = 0; j < length; j++)
|
for (var j = 0; j < length; j++)
|
||||||
|
@ -11087,36 +11101,48 @@ PIXI.BitmapFontLoader.prototype.onXMLLoaded = function()
|
||||||
{
|
{
|
||||||
if (this.ajaxRequest.status === 200 || window.location.protocol.indexOf('http') === -1)
|
if (this.ajaxRequest.status === 200 || window.location.protocol.indexOf('http') === -1)
|
||||||
{
|
{
|
||||||
var textureUrl = this.baseUrl + this.ajaxRequest.responseXML.getElementsByTagName('page')[0].attributes.getNamedItem('file').nodeValue;
|
var responseXML = this.ajaxRequest.responseXML;
|
||||||
|
if(!responseXML || /MSIE 9/i.test(navigator.userAgent) || navigator.isCocoonJS) {
|
||||||
|
if(typeof(window.DOMParser) === 'function') {
|
||||||
|
var domparser = new DOMParser();
|
||||||
|
responseXML = domparser.parseFromString(this.ajaxRequest.responseText, 'text/xml');
|
||||||
|
} else {
|
||||||
|
var div = document.createElement('div');
|
||||||
|
div.innerHTML = this.ajaxRequest.responseText;
|
||||||
|
responseXML = div;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var textureUrl = this.baseUrl + responseXML.getElementsByTagName('page')[0].getAttribute('file');
|
||||||
var image = new PIXI.ImageLoader(textureUrl, this.crossorigin);
|
var image = new PIXI.ImageLoader(textureUrl, this.crossorigin);
|
||||||
this.texture = image.texture.baseTexture;
|
this.texture = image.texture.baseTexture;
|
||||||
|
|
||||||
var data = {};
|
var data = {};
|
||||||
var info = this.ajaxRequest.responseXML.getElementsByTagName('info')[0];
|
var info = responseXML.getElementsByTagName('info')[0];
|
||||||
var common = this.ajaxRequest.responseXML.getElementsByTagName('common')[0];
|
var common = responseXML.getElementsByTagName('common')[0];
|
||||||
data.font = info.attributes.getNamedItem('face').nodeValue;
|
data.font = info.getAttribute('face');
|
||||||
data.size = parseInt(info.attributes.getNamedItem('size').nodeValue, 10);
|
data.size = parseInt(info.getAttribute('size'), 10);
|
||||||
data.lineHeight = parseInt(common.attributes.getNamedItem('lineHeight').nodeValue, 10);
|
data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10);
|
||||||
data.chars = {};
|
data.chars = {};
|
||||||
|
|
||||||
//parse letters
|
//parse letters
|
||||||
var letters = this.ajaxRequest.responseXML.getElementsByTagName('char');
|
var letters = responseXML.getElementsByTagName('char');
|
||||||
|
|
||||||
for (var i = 0; i < letters.length; i++)
|
for (var i = 0; i < letters.length; i++)
|
||||||
{
|
{
|
||||||
var charCode = parseInt(letters[i].attributes.getNamedItem('id').nodeValue, 10);
|
var charCode = parseInt(letters[i].getAttribute('id'), 10);
|
||||||
|
|
||||||
var textureRect = new PIXI.Rectangle(
|
var textureRect = new PIXI.Rectangle(
|
||||||
parseInt(letters[i].attributes.getNamedItem('x').nodeValue, 10),
|
parseInt(letters[i].getAttribute('x'), 10),
|
||||||
parseInt(letters[i].attributes.getNamedItem('y').nodeValue, 10),
|
parseInt(letters[i].getAttribute('y'), 10),
|
||||||
parseInt(letters[i].attributes.getNamedItem('width').nodeValue, 10),
|
parseInt(letters[i].getAttribute('width'), 10),
|
||||||
parseInt(letters[i].attributes.getNamedItem('height').nodeValue, 10)
|
parseInt(letters[i].getAttribute('height'), 10)
|
||||||
);
|
);
|
||||||
|
|
||||||
data.chars[charCode] = {
|
data.chars[charCode] = {
|
||||||
xOffset: parseInt(letters[i].attributes.getNamedItem('xoffset').nodeValue, 10),
|
xOffset: parseInt(letters[i].getAttribute('xoffset'), 10),
|
||||||
yOffset: parseInt(letters[i].attributes.getNamedItem('yoffset').nodeValue, 10),
|
yOffset: parseInt(letters[i].getAttribute('yoffset'), 10),
|
||||||
xAdvance: parseInt(letters[i].attributes.getNamedItem('xadvance').nodeValue, 10),
|
xAdvance: parseInt(letters[i].getAttribute('xadvance'), 10),
|
||||||
kerning: {},
|
kerning: {},
|
||||||
texture: PIXI.TextureCache[charCode] = new PIXI.Texture(this.texture, textureRect)
|
texture: PIXI.TextureCache[charCode] = new PIXI.Texture(this.texture, textureRect)
|
||||||
|
|
||||||
|
@ -11124,12 +11150,12 @@ PIXI.BitmapFontLoader.prototype.onXMLLoaded = function()
|
||||||
}
|
}
|
||||||
|
|
||||||
//parse kernings
|
//parse kernings
|
||||||
var kernings = this.ajaxRequest.responseXML.getElementsByTagName('kerning');
|
var kernings = responseXML.getElementsByTagName('kerning');
|
||||||
for (i = 0; i < kernings.length; i++)
|
for (i = 0; i < kernings.length; i++)
|
||||||
{
|
{
|
||||||
var first = parseInt(kernings[i].attributes.getNamedItem('first').nodeValue, 10);
|
var first = parseInt(kernings[i].getAttribute('first'), 10);
|
||||||
var second = parseInt(kernings[i].attributes.getNamedItem('second').nodeValue, 10);
|
var second = parseInt(kernings[i].getAttribute('second'), 10);
|
||||||
var amount = parseInt(kernings[i].attributes.getNamedItem('amount').nodeValue, 10);
|
var amount = parseInt(kernings[i].getAttribute('amount'), 10);
|
||||||
|
|
||||||
data.chars[second].kerning[first] = amount;
|
data.chars[second].kerning[first] = amount;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue