Tidying up the wip folder and updating pixi.
109
examples/wip/filters/index.php
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
// Global
|
||||
$files = dirToArray(dirname(__FILE__));
|
||||
$total = 0;
|
||||
|
||||
foreach ($files as $key => $value)
|
||||
{
|
||||
if (is_array($value) && count($value) > 0)
|
||||
{
|
||||
$total += count($value);
|
||||
}
|
||||
}
|
||||
|
||||
function getFile() {
|
||||
|
||||
global $files, $dir, $filename, $title, $code;
|
||||
|
||||
if (isset($_GET['d']) && isset($_GET['f']))
|
||||
{
|
||||
$dir = urldecode($_GET['d']);
|
||||
$filename = urldecode($_GET['d']) . '/' . urldecode($_GET['f']);
|
||||
$title = urldecode($_GET['t']);
|
||||
|
||||
if (file_exists($filename))
|
||||
{
|
||||
$code = file_get_contents($filename);
|
||||
$files = dirToArray($dir);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function dirToArray($dir) {
|
||||
|
||||
$ignore = array('.', '..', '_site', 'assets', 'states', 'book');
|
||||
$result = array();
|
||||
$root = scandir($dir);
|
||||
$dirs = array_diff($root, $ignore);
|
||||
|
||||
foreach ($dirs as $key => $value)
|
||||
{
|
||||
if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
|
||||
{
|
||||
$result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (substr($value, -3) == '.js')
|
||||
{
|
||||
$result[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function printJSLinks($dir, $files) {
|
||||
|
||||
$output = "";
|
||||
|
||||
foreach ($files as $key => $value)
|
||||
{
|
||||
$value2 = substr($value, 0, -3);
|
||||
$file = urlencode($value);
|
||||
|
||||
$output .= "<a href=\"wip/filters/index.php?f=$file\">$value2</a><br />";
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>phaser</title>
|
||||
<base href="../../"></base>
|
||||
<?php
|
||||
require('../../../build/config.php');
|
||||
|
||||
if (isset($_GET['f']))
|
||||
{
|
||||
$f = $_GET['f'];
|
||||
?>
|
||||
<script src="wip/<?php echo $f?>" type="text/javascript"></script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="phaser-example"></div>
|
||||
|
||||
<h2>work in progress filters</h2>
|
||||
|
||||
<?php
|
||||
echo printJSLinks('wip', $files);
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 179 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 151 KiB |
Before Width: | Height: | Size: 200 KiB After Width: | Height: | Size: 200 KiB |
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 171 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 258 KiB After Width: | Height: | Size: 258 KiB |
|
@ -32,7 +32,7 @@
|
|||
|
||||
function dirToArray($dir) {
|
||||
|
||||
$ignore = array('.', '..', '_site', 'assets', 'states', 'book');
|
||||
$ignore = array('.', '..', '_site', 'assets', 'states', 'book', 'filters');
|
||||
$result = array();
|
||||
$root = scandir($dir);
|
||||
$dirs = array_diff($root, $ignore);
|
||||
|
|
47
examples/wip/removeFilter.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
var logo;
|
||||
var background;
|
||||
var filter;
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('phaser', 'assets/sprites/phaser2.png');
|
||||
game.load.script('fire', '../filters/Fire.js');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
|
||||
background = game.add.sprite(0, 0);
|
||||
background.width = 800;
|
||||
background.height = 600;
|
||||
|
||||
filter = game.add.filter('Fire', 800, 600);
|
||||
filter.alpha = 0.0;
|
||||
|
||||
background.filters = [filter];
|
||||
|
||||
logo = game.add.sprite(game.world.centerX, game.world.centerY, 'phaser');
|
||||
logo.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.input.onDown.add(removeBackground, this);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
filter.update();
|
||||
|
||||
}
|
||||
|
||||
function removeBackground() {
|
||||
|
||||
console.log('removeBackground');
|
||||
|
||||
// background.destroy();
|
||||
background.removeFilter(filter);
|
||||
|
||||
}
|
22
examples/wip/template.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
var sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
}
|
|
@ -860,6 +860,13 @@ Phaser.Sprite.prototype.destroy = function() {
|
|||
this.animations.destroy();
|
||||
}
|
||||
|
||||
if (this._filters)
|
||||
{
|
||||
console.log('removeFilter', this._filters);
|
||||
this.removeFilter(this._filters);
|
||||
console.log(this._filters);
|
||||
}
|
||||
|
||||
this.alive = false;
|
||||
this.exists = false;
|
||||
this.visible = false;
|
||||
|
|
|
@ -246,7 +246,7 @@ PIXI.InteractionManager.prototype.update = function()
|
|||
// loks like there was a hit!
|
||||
if(item.__hit)
|
||||
{
|
||||
if(item.buttonMode) this.interactionDOMElement.style.cursor = "pointer";
|
||||
if(item.buttonMode) this.interactionDOMElement.style.cursor = item.defaultCursor;
|
||||
|
||||
if(!item.__isOver)
|
||||
{
|
||||
|
|
|
@ -14,24 +14,24 @@
|
|||
PIXI.Circle = function(x, y, radius)
|
||||
{
|
||||
/**
|
||||
* @property x
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
* @property x
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
this.x = x || 0;
|
||||
|
||||
/**
|
||||
* @property y
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
* @property y
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
this.y = y || 0;
|
||||
|
||||
/**
|
||||
* @property radius
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
* @property radius
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
this.radius = radius || 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,31 +15,31 @@
|
|||
PIXI.Ellipse = function(x, y, width, height)
|
||||
{
|
||||
/**
|
||||
* @property x
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
* @property x
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
this.x = x || 0;
|
||||
|
||||
/**
|
||||
* @property y
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
* @property y
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
this.y = y || 0;
|
||||
|
||||
/**
|
||||
* @property width
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
* @property width
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
this.width = width || 0;
|
||||
|
||||
/**
|
||||
* @property height
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
* @property height
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
this.height = height || 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,6 +122,8 @@ PIXI.DisplayObject = function()
|
|||
*/
|
||||
this._interactive = false;
|
||||
|
||||
this.defaultCursor = "pointer";
|
||||
|
||||
/**
|
||||
* [read-only] Current transform of the object based on world (parent) factors
|
||||
*
|
||||
|
@ -368,6 +370,12 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', {
|
|||
*/
|
||||
PIXI.DisplayObject.prototype.addFilter = function(data)
|
||||
{
|
||||
//if(this.filter)return;
|
||||
//this.filter = true;
|
||||
// data[0].target = this;
|
||||
|
||||
console.log('addFilter');
|
||||
console.log(data);
|
||||
|
||||
// insert a filter block..
|
||||
// TODO Onject pool thease bad boys..
|
||||
|
@ -386,6 +394,8 @@ PIXI.DisplayObject.prototype.addFilter = function(data)
|
|||
start.open = true;
|
||||
|
||||
start.target = this;
|
||||
|
||||
console.log('start', start);
|
||||
|
||||
/*
|
||||
* insert start
|
||||
|
@ -455,6 +465,7 @@ PIXI.DisplayObject.prototype.addFilter = function(data)
|
|||
// if webGL...
|
||||
if(this.__renderGroup)
|
||||
{
|
||||
console.log('__renderGroup');
|
||||
this.__renderGroup.addFilterBlocks(start, end);
|
||||
}
|
||||
|
||||
|
@ -470,13 +481,20 @@ PIXI.DisplayObject.prototype.removeFilter = function(data)
|
|||
{
|
||||
//if(!this.filter)return;
|
||||
//this.filter = false;
|
||||
console.log("YUOIO")
|
||||
// console.log("YUOIO")
|
||||
// modify the list..
|
||||
|
||||
console.log('DisplayObject removeFilter');
|
||||
console.log(data);
|
||||
|
||||
var startBlock = data.start;
|
||||
|
||||
console.log('start', startBlock);
|
||||
|
||||
var nextObject = startBlock._iNext;
|
||||
var previousObject = startBlock._iPrev;
|
||||
|
||||
|
||||
|
||||
if(nextObject)nextObject._iPrev = previousObject;
|
||||
if(previousObject)previousObject._iNext = nextObject;
|
||||
|
|
|
@ -166,7 +166,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
|
|||
updateLast = updateLast.parent;
|
||||
}
|
||||
}
|
||||
else if(index === 0)
|
||||
else if(index == 0)
|
||||
{
|
||||
previousObject = this;
|
||||
}
|
||||
|
@ -295,14 +295,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
|
|||
|
||||
if(this.last == childLast)
|
||||
{
|
||||
|
||||
var tempLast = childFirst._iPrev;
|
||||
// need to make sure the parents last is updated too
|
||||
var updateLast = this;
|
||||
while(updateLast.last == childLast.last)
|
||||
|
||||
while(updateLast.last == childLast)
|
||||
{
|
||||
updateLast.last = tempLast;
|
||||
updateLast = updateLast.parent;
|
||||
if(!updateLast)break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ PIXI.Sprite = function(texture)
|
|||
* Setting than anchor to 0.5,0.5 means the textures origin is centered
|
||||
* Setting the anchor to 1,1 would mean the textures origin points will be the bottom right
|
||||
*
|
||||
* @property anchor
|
||||
* @type Point
|
||||
*/
|
||||
* @property anchor
|
||||
* @type Point
|
||||
*/
|
||||
this.anchor = new PIXI.Point();
|
||||
|
||||
/**
|
||||
|
|
|
@ -296,7 +296,7 @@ spine.Animation.prototype = {
|
|||
spine.binarySearch = function (values, target, step) {
|
||||
var low = 0;
|
||||
var high = Math.floor(values.length / step) - 2;
|
||||
if (high === 0) return step;
|
||||
if (high == 0) return step;
|
||||
var current = high >>> 1;
|
||||
while (true) {
|
||||
if (values[(current + 1) * step] <= target)
|
||||
|
@ -368,7 +368,7 @@ spine.Curves.prototype = {
|
|||
var lastY = y - dfy;
|
||||
return lastY + (y - lastY) * (percent - lastX) / (x - lastX);
|
||||
}
|
||||
if (i === 0) break;
|
||||
if (i == 0) break;
|
||||
i--;
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
|
@ -711,7 +711,7 @@ spine.Skeleton.prototype = {
|
|||
},
|
||||
/** @return May return null. */
|
||||
getRootBone: function () {
|
||||
return this.bones.length === 0 ? null : this.bones[0];
|
||||
return this.bones.length == 0 ? null : this.bones[0];
|
||||
},
|
||||
/** @return May be null. */
|
||||
findBone: function (boneName) {
|
||||
|
@ -983,7 +983,7 @@ spine.AnimationState.prototype = {
|
|||
entry.loop = loop;
|
||||
|
||||
if (!delay || delay <= 0) {
|
||||
var previousAnimation = this.queue.length === 0 ? this.current : this.queue[this.queue.length - 1].animation;
|
||||
var previousAnimation = this.queue.length == 0 ? this.current : this.queue[this.queue.length - 1].animation;
|
||||
if (previousAnimation != null)
|
||||
delay = previousAnimation.duration - this.data.getMix(previousAnimation, animation) + (delay || 0);
|
||||
else
|
||||
|
@ -1232,7 +1232,7 @@ spine.Atlas = function (atlasText, textureLoader) {
|
|||
var line = reader.readLine();
|
||||
if (line == null) break;
|
||||
line = reader.trim(line);
|
||||
if (line.length === 0)
|
||||
if (line.length == 0)
|
||||
page = null;
|
||||
else if (!page) {
|
||||
page = new spine.AtlasPage();
|
||||
|
@ -1421,7 +1421,7 @@ spine.AtlasReader.prototype = {
|
|||
for (; i < 3; i++) {
|
||||
var comma = line.indexOf(",", lastMatch);
|
||||
if (comma == -1) {
|
||||
if (i === 0) throw "Invalid line: " + line;
|
||||
if (i == 0) throw "Invalid line: " + line;
|
||||
break;
|
||||
}
|
||||
tuple[i] = this.trim(line.substr(lastMatch, comma - lastMatch));
|
||||
|
|
|
@ -29,25 +29,25 @@ PIXI.CrossHatchFilter = function()
|
|||
" gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);",
|
||||
" ",
|
||||
" if (lum < 1.00) {",
|
||||
" if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) === 0.0) {",
|
||||
" if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {",
|
||||
" gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);",
|
||||
" }",
|
||||
" }",
|
||||
" ",
|
||||
" if (lum < 0.75) {",
|
||||
" if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) === 0.0) {",
|
||||
" if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {",
|
||||
" gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);",
|
||||
" }",
|
||||
" }",
|
||||
" ",
|
||||
" if (lum < 0.50) {",
|
||||
" if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) === 0.0) {",
|
||||
" if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {",
|
||||
" gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);",
|
||||
" }",
|
||||
" }",
|
||||
" ",
|
||||
" if (lum < 0.3) {",
|
||||
" if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) === 0.0) {",
|
||||
" if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {",
|
||||
" gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);",
|
||||
" }",
|
||||
" }",
|
||||
|
|
|
@ -24,26 +24,26 @@ PIXI.AssetLoader = function(assetURLs, crossorigin)
|
|||
|
||||
/**
|
||||
* The array of asset URLs that are going to be loaded
|
||||
*
|
||||
*
|
||||
* @property assetURLs
|
||||
* @type Array<String>
|
||||
*/
|
||||
this.assetURLs = assetURLs;
|
||||
|
||||
/**
|
||||
* Whether the requests should be treated as cross origin
|
||||
*
|
||||
* @property crossorigin
|
||||
* @type Boolean
|
||||
*/
|
||||
* Whether the requests should be treated as cross origin
|
||||
*
|
||||
* @property crossorigin
|
||||
* @type Boolean
|
||||
*/
|
||||
this.crossorigin = crossorigin;
|
||||
|
||||
/**
|
||||
* Maps file extension to loader types
|
||||
*
|
||||
* @property loadersByType
|
||||
* @type Object
|
||||
*/
|
||||
* Maps file extension to loader types
|
||||
*
|
||||
* @property loadersByType
|
||||
* @type Object
|
||||
*/
|
||||
this.loadersByType = {
|
||||
"jpg": PIXI.ImageLoader,
|
||||
"jpeg": PIXI.ImageLoader,
|
||||
|
@ -113,7 +113,7 @@ PIXI.AssetLoader.prototype.onAssetLoaded = function()
|
|||
this.dispatchEvent({type: "onProgress", content: this});
|
||||
if(this.onProgress) this.onProgress();
|
||||
|
||||
if(this.loadCount === 0)
|
||||
if(this.loadCount == 0)
|
||||
{
|
||||
this.dispatchEvent({type: "onComplete", content: this});
|
||||
if(this.onComplete) this.onComplete();
|
||||
|
|
|
@ -17,43 +17,43 @@
|
|||
PIXI.BitmapFontLoader = function(url, crossorigin)
|
||||
{
|
||||
/*
|
||||
* i use texture packer to load the assets..
|
||||
* http://www.codeandweb.com/texturepacker
|
||||
* make sure to set the format as "JSON"
|
||||
*/
|
||||
* i use texture packer to load the assets..
|
||||
* http://www.codeandweb.com/texturepacker
|
||||
* make sure to set the format as "JSON"
|
||||
*/
|
||||
PIXI.EventTarget.call(this);
|
||||
|
||||
/**
|
||||
* The url of the bitmap font data
|
||||
*
|
||||
* @property url
|
||||
* @type String
|
||||
*/
|
||||
* The url of the bitmap font data
|
||||
*
|
||||
* @property url
|
||||
* @type String
|
||||
*/
|
||||
this.url = url;
|
||||
|
||||
/**
|
||||
* Whether the requests should be treated as cross origin
|
||||
*
|
||||
* @property crossorigin
|
||||
* @type Boolean
|
||||
*/
|
||||
* Whether the requests should be treated as cross origin
|
||||
*
|
||||
* @property crossorigin
|
||||
* @type Boolean
|
||||
*/
|
||||
this.crossorigin = crossorigin;
|
||||
|
||||
/**
|
||||
* [read-only] The base url of the bitmap font data
|
||||
*
|
||||
* @property baseUrl
|
||||
* @type String
|
||||
* @readOnly
|
||||
*/
|
||||
* [read-only] The base url of the bitmap font data
|
||||
*
|
||||
* @property baseUrl
|
||||
* @type String
|
||||
* @readOnly
|
||||
*/
|
||||
this.baseUrl = url.replace(/[^\/]*$/, "");
|
||||
|
||||
/**
|
||||
* [read-only] The texture of the bitmap font
|
||||
*
|
||||
* @property baseUrl
|
||||
* @type String
|
||||
*/
|
||||
* [read-only] The texture of the bitmap font
|
||||
*
|
||||
* @property baseUrl
|
||||
* @type String
|
||||
*/
|
||||
this.texture = null;
|
||||
};
|
||||
|
||||
|
|
|
@ -18,18 +18,18 @@ PIXI.ImageLoader = function(url, crossorigin)
|
|||
PIXI.EventTarget.call(this);
|
||||
|
||||
/**
|
||||
* The texture being loaded
|
||||
*
|
||||
* @property texture
|
||||
* @type Texture
|
||||
*/
|
||||
* The texture being loaded
|
||||
*
|
||||
* @property texture
|
||||
* @type Texture
|
||||
*/
|
||||
this.texture = PIXI.Texture.fromImage(url, crossorigin);
|
||||
|
||||
/**
|
||||
* if the image is loaded with loadFramedSpriteSheet
|
||||
* frames will contain the sprite sheet frames
|
||||
*
|
||||
*/
|
||||
* if the image is loaded with loadFramedSpriteSheet
|
||||
* frames will contain the sprite sheet frames
|
||||
*
|
||||
*/
|
||||
this.frames = [];
|
||||
};
|
||||
|
||||
|
|
|
@ -52,19 +52,19 @@ PIXI.SpriteSheetLoader = function (url, crossorigin) {
|
|||
this.baseUrl = url.replace(/[^\/]*$/, "");
|
||||
|
||||
/**
|
||||
* The texture being loaded
|
||||
*
|
||||
* @property texture
|
||||
* @type Texture
|
||||
*/
|
||||
* The texture being loaded
|
||||
*
|
||||
* @property texture
|
||||
* @type Texture
|
||||
*/
|
||||
this.texture = null;
|
||||
|
||||
/**
|
||||
* The frames of the sprite sheet
|
||||
*
|
||||
* @property frames
|
||||
* @type Object
|
||||
*/
|
||||
* The frames of the sprite sheet
|
||||
*
|
||||
* @property frames
|
||||
* @type Object
|
||||
*/
|
||||
this.frames = {};
|
||||
};
|
||||
|
||||
|
|
|
@ -19,45 +19,45 @@ PIXI.Graphics = function()
|
|||
this.renderable = true;
|
||||
|
||||
/**
|
||||
* The alpha of the fill of this graphics object
|
||||
*
|
||||
* @property fillAlpha
|
||||
* @type Number
|
||||
*/
|
||||
* The alpha of the fill of this graphics object
|
||||
*
|
||||
* @property fillAlpha
|
||||
* @type Number
|
||||
*/
|
||||
this.fillAlpha = 1;
|
||||
|
||||
/**
|
||||
* The width of any lines drawn
|
||||
*
|
||||
* @property lineWidth
|
||||
* @type Number
|
||||
*/
|
||||
* The width of any lines drawn
|
||||
*
|
||||
* @property lineWidth
|
||||
* @type Number
|
||||
*/
|
||||
this.lineWidth = 0;
|
||||
|
||||
/**
|
||||
* The color of any lines drawn
|
||||
*
|
||||
* @property lineColor
|
||||
* @type String
|
||||
*/
|
||||
* The color of any lines drawn
|
||||
*
|
||||
* @property lineColor
|
||||
* @type String
|
||||
*/
|
||||
this.lineColor = "black";
|
||||
|
||||
/**
|
||||
* Graphics data
|
||||
*
|
||||
* @property graphicsData
|
||||
* @type Array
|
||||
* @private
|
||||
*/
|
||||
* Graphics data
|
||||
*
|
||||
* @property graphicsData
|
||||
* @type Array
|
||||
* @private
|
||||
*/
|
||||
this.graphicsData = [];
|
||||
|
||||
/**
|
||||
* Current path
|
||||
*
|
||||
* @property currentPath
|
||||
* @type Object
|
||||
* @private
|
||||
*/
|
||||
* Current path
|
||||
*
|
||||
* @property currentPath
|
||||
* @type Object
|
||||
* @private
|
||||
*/
|
||||
this.currentPath = {points:[]};
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ PIXI.Graphics.prototype.constructor = PIXI.Graphics;
|
|||
*/
|
||||
PIXI.Graphics.prototype.lineStyle = function(lineWidth, color, alpha)
|
||||
{
|
||||
if(this.currentPath.points.length === 0)this.graphicsData.pop();
|
||||
if(this.currentPath.points.length == 0)this.graphicsData.pop();
|
||||
|
||||
this.lineWidth = lineWidth || 0;
|
||||
this.lineColor = color || 0;
|
||||
|
@ -96,7 +96,7 @@ PIXI.Graphics.prototype.lineStyle = function(lineWidth, color, alpha)
|
|||
*/
|
||||
PIXI.Graphics.prototype.moveTo = function(x, y)
|
||||
{
|
||||
if(this.currentPath.points.length === 0)this.graphicsData.pop();
|
||||
if(this.currentPath.points.length == 0)this.graphicsData.pop();
|
||||
|
||||
this.currentPath = this.currentPath = {lineWidth:this.lineWidth, lineColor:this.lineColor, lineAlpha:this.lineAlpha,
|
||||
fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling, points:[], type:PIXI.Graphics.POLY};
|
||||
|
@ -157,7 +157,7 @@ PIXI.Graphics.prototype.endFill = function()
|
|||
*/
|
||||
PIXI.Graphics.prototype.drawRect = function( x, y, width, height )
|
||||
{
|
||||
if(this.currentPath.points.length === 0)this.graphicsData.pop();
|
||||
if(this.currentPath.points.length == 0)this.graphicsData.pop();
|
||||
|
||||
this.currentPath = {lineWidth:this.lineWidth, lineColor:this.lineColor, lineAlpha:this.lineAlpha,
|
||||
fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling,
|
||||
|
@ -177,7 +177,7 @@ PIXI.Graphics.prototype.drawRect = function( x, y, width, height )
|
|||
*/
|
||||
PIXI.Graphics.prototype.drawCircle = function( x, y, radius)
|
||||
{
|
||||
if(this.currentPath.points.length === 0)this.graphicsData.pop();
|
||||
if(this.currentPath.points.length == 0)this.graphicsData.pop();
|
||||
|
||||
this.currentPath = {lineWidth:this.lineWidth, lineColor:this.lineColor, lineAlpha:this.lineAlpha,
|
||||
fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling,
|
||||
|
@ -198,7 +198,7 @@ PIXI.Graphics.prototype.drawCircle = function( x, y, radius)
|
|||
*/
|
||||
PIXI.Graphics.prototype.drawElipse = function( x, y, width, height)
|
||||
{
|
||||
if(this.currentPath.points.length === 0)this.graphicsData.pop();
|
||||
if(this.currentPath.points.length == 0)this.graphicsData.pop();
|
||||
|
||||
this.currentPath = {lineWidth:this.lineWidth, lineColor:this.lineColor, lineAlpha:this.lineAlpha,
|
||||
fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling,
|
||||
|
|
|
@ -226,6 +226,7 @@ PIXI.PixiShader.prototype.syncUniforms = function()
|
|||
// This would probably be faster in an array and it would guarantee key order
|
||||
for (var key in this.uniforms)
|
||||
{
|
||||
|
||||
uniform = this.uniforms[key];
|
||||
|
||||
if (uniform.glValueLength == 1)
|
||||
|
|
|
@ -9,7 +9,7 @@ PIXI._batchs = [];
|
|||
*/
|
||||
PIXI._getBatch = function(gl)
|
||||
{
|
||||
if(PIXI._batchs.length === 0)
|
||||
if(PIXI._batchs.length == 0)
|
||||
{
|
||||
return new PIXI.WebGLBatch(gl);
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ PIXI.WebGLBatch.prototype.remove = function(sprite)
|
|||
{
|
||||
this.size--;
|
||||
|
||||
if(this.size === 0)
|
||||
if(this.size == 0)
|
||||
{
|
||||
sprite.batch = null;
|
||||
sprite.__prev = null;
|
||||
|
@ -522,7 +522,7 @@ PIXI.WebGLBatch.prototype.render = function(start, end)
|
|||
this.dirty = false;
|
||||
}
|
||||
|
||||
if (this.size === 0)return;
|
||||
if (this.size == 0)return;
|
||||
|
||||
this.update();
|
||||
var gl = this.gl;
|
||||
|
|
|
@ -45,8 +45,15 @@ PIXI.WebGLFilterManager.prototype.pushFilter = function(filterBlock)
|
|||
|
||||
|
||||
var texture = this.texturePool.pop();
|
||||
if(!texture)texture = new PIXI.FilterTexture(this.width, this.height);
|
||||
|
||||
if(!texture)
|
||||
{
|
||||
texture = new PIXI.FilterTexture(this.width, this.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
texture.resize(this.width, this.height);
|
||||
}
|
||||
|
||||
gl.bindTexture(gl.TEXTURE_2D, texture.texture);
|
||||
|
||||
this.getBounds(filterBlock.target);
|
||||
|
@ -508,6 +515,8 @@ PIXI.FilterTexture = function(width, height)
|
|||
|
||||
PIXI.FilterTexture.prototype.resize = function(width, height)
|
||||
{
|
||||
if(this.width == width && this.height == height)return;
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ PIXI.WebGLGraphics.buildLine = function(graphicsData, webGLData)
|
|||
|
||||
var wrap = true;
|
||||
var points = graphicsData.points;
|
||||
if(points.length === 0)return;
|
||||
if(points.length == 0)return;
|
||||
|
||||
// if the line width is an odd number add 0.5 to align to a whole pixel
|
||||
if(graphicsData.lineWidth%2)
|
||||
|
|
|
@ -25,7 +25,7 @@ PIXI.WebGLRenderGroup = function(gl, transparent)
|
|||
|
||||
this.batchs = [];
|
||||
this.toRemove = [];
|
||||
// console.log(this.transparent)
|
||||
console.log(this.transparent)
|
||||
this.filterManager = new PIXI.WebGLFilterManager(this.transparent);
|
||||
}
|
||||
|
||||
|
@ -775,7 +775,7 @@ PIXI.WebGLRenderGroup.prototype.removeObject = function(displayObject)
|
|||
|
||||
// ok so.. check to see if you adjacent batchs should be joined.
|
||||
// TODO may optimise?
|
||||
if(index === 0 || index == this.batchs.length-1)
|
||||
if(index == 0 || index == this.batchs.length-1)
|
||||
{
|
||||
// wha - eva! just get of the empty batch!
|
||||
this.batchs.splice(index, 1);
|
||||
|
@ -848,7 +848,7 @@ PIXI.WebGLRenderGroup.prototype.initTilingSprite = function(sprite)
|
|||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, sprite._indexBuffer);
|
||||
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, sprite.indices, gl.STATIC_DRAW);
|
||||
|
||||
// return ( (x > 0) && ((x & (x - 1)) === 0) );
|
||||
// return ( (x > 0) && ((x & (x - 1)) == 0) );
|
||||
|
||||
if(sprite.texture.baseTexture._glTexture)
|
||||
{
|
||||
|
|
|
@ -111,7 +111,7 @@ PIXI.WebGLRenderer.prototype.constructor = PIXI.WebGLRenderer;
|
|||
*/
|
||||
PIXI.WebGLRenderer.getBatch = function()
|
||||
{
|
||||
if(PIXI._batchs.length === 0)
|
||||
if(PIXI._batchs.length == 0)
|
||||
{
|
||||
return new PIXI.WebGLBatch(PIXI.WebGLRenderer.gl);
|
||||
}
|
||||
|
|
|
@ -111,6 +111,19 @@ PIXI.BaseTexture.prototype.destroy = function()
|
|||
PIXI.texturesToDestroy.push(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method destroy
|
||||
*/
|
||||
|
||||
PIXI.BaseTexture.prototype.updateSourceImage = function(newSrc)
|
||||
{
|
||||
this.hasLoaded = false;
|
||||
this.source.src = null;
|
||||
this.source.src = newSrc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function that returns a base texture based on an image url
|
||||
* If the image is not in the base texture cache it will be created and loaded
|
||||
|
|
|
@ -115,8 +115,7 @@ PIXI.Texture.prototype.setFrame = function(frame)
|
|||
|
||||
if(frame.x + frame.width > this.baseTexture.width || frame.y + frame.height > this.baseTexture.height)
|
||||
{
|
||||
console.log(frame);
|
||||
throw new Error("Texture Error: frame does not fit inside the base Texture dimensions ", frame);
|
||||
throw new Error("Texture Error: frame does not fit inside the base Texture dimensions " + this);
|
||||
}
|
||||
|
||||
this.updateFrame = true;
|
||||
|
|