Merge pull request #561 from alvinsight/dev
Docs, examples again, test folder, removeAll func
This commit is contained in:
commit
c191cdcf70
47 changed files with 379 additions and 14298 deletions
|
@ -19,7 +19,7 @@ any breakthroughs will be posted up there too!
|
||||||
|
|
||||||
- [WebGL Filters!](<http://www.goodboydigital.com/pixijs/examples/15/indexAll.html>)
|
- [WebGL Filters!](<http://www.goodboydigital.com/pixijs/examples/15/indexAll.html>)
|
||||||
|
|
||||||
- [Run pixi run](<http://www.goodboydigital.com/runpixierun/>)
|
- [Run pixie run](<http://www.goodboydigital.com/runpixierun/>)
|
||||||
|
|
||||||
- [Fight for Everyone](<http://www.theleisuresociety.co.uk/fightforeveryone>)
|
- [Fight for Everyone](<http://www.theleisuresociety.co.uk/fightforeveryone>)
|
||||||
|
|
||||||
|
|
|
@ -41,17 +41,14 @@
|
||||||
|
|
||||||
function runList(item)
|
function runList(item)
|
||||||
{
|
{
|
||||||
console.log(">>>>>>>>>")
|
|
||||||
console.log("_")
|
console.log("_")
|
||||||
var safe = 0;
|
var safe = 0;
|
||||||
var tmp = item;
|
var tmp = item;
|
||||||
while(tmp._iNext)
|
while(tmp._iNext)
|
||||||
{
|
{
|
||||||
safe++;
|
safe++;
|
||||||
// console.log(tmp.childIndex + tmp);
|
|
||||||
tmp = tmp._iNext;
|
tmp = tmp._iNext;
|
||||||
console.log(tmp);//.childIndex);
|
console.log(tmp);//.childIndex);
|
||||||
// console.log(tmp);
|
|
||||||
|
|
||||||
if(safe > 100)
|
if(safe > 100)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +80,7 @@
|
||||||
function onAssetsLoaded()
|
function onAssetsLoaded()
|
||||||
{
|
{
|
||||||
var bitmapFontText = new PIXI.BitmapText("bitmap fonts are\n now supported!", {font: "35px Desyrel", align: "right"});
|
var bitmapFontText = new PIXI.BitmapText("bitmap fonts are\n now supported!", {font: "35px Desyrel", align: "right"});
|
||||||
bitmapFontText.position.x = 620 - bitmapFontText.width - 20;
|
bitmapFontText.position.x = 620 - bitmapFontText.textWidth - 20;
|
||||||
bitmapFontText.position.y = 20;
|
bitmapFontText.position.y = 20;
|
||||||
|
|
||||||
runList(bitmapFontText);
|
runList(bitmapFontText);
|
||||||
|
@ -131,26 +128,31 @@
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
var score = 0;
|
var score = 0;
|
||||||
|
var remaining = 10;
|
||||||
|
|
||||||
|
stage.removeAll();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
|
|
||||||
requestAnimFrame(animate);
|
// requestAnimFrame(animate);
|
||||||
|
|
||||||
count++;
|
// count++;
|
||||||
|
|
||||||
if(count == 50)
|
// if(count == 50)
|
||||||
{
|
// {
|
||||||
count = 0;
|
// count = 0;
|
||||||
score++;
|
// score++;
|
||||||
// update the text...
|
// // update the text...
|
||||||
countingText.setText("COUNT 4EVAR: " + score);
|
// countingText.setText("COUNT 4EVAR: " + score);
|
||||||
|
|
||||||
}
|
// }
|
||||||
// just for fun, let's rotate the text
|
// // just for fun, let's rotate the text
|
||||||
spinningText.rotation += 0.03;
|
// spinningText.rotation += 0.03;
|
||||||
|
|
||||||
// render the stage
|
// // render the stage
|
||||||
renderer.render(stage);
|
// renderer.render(stage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
item.anchor.y = 0.5;
|
item.anchor.y = 0.5;
|
||||||
|
|
||||||
stuffContainer.addChild(item);
|
stuffContainer.addChild(item);
|
||||||
console.log("_")
|
|
||||||
items.push(item);
|
items.push(item);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,6 @@
|
||||||
|
|
||||||
var renderer = PIXI.autoDetectRenderer(620, 380);
|
var renderer = PIXI.autoDetectRenderer(620, 380);
|
||||||
|
|
||||||
// set the canvas width and height to fill the screen
|
|
||||||
//renderer.view.style.width = window.innerWidth + "px";
|
|
||||||
//renderer.view.style.height = window.innerHeight + "px";
|
|
||||||
renderer.view.style.display = "block";
|
renderer.view.style.display = "block";
|
||||||
|
|
||||||
// add render view to DOM
|
// add render view to DOM
|
||||||
|
|
|
@ -141,8 +141,6 @@
|
||||||
thing.lineTo(-120 + Math.cos(count)* 20, 100 + Math.sin(count)* 20);
|
thing.lineTo(-120 + Math.cos(count)* 20, 100 + Math.sin(count)* 20);
|
||||||
thing.lineTo(-120 + Math.sin(count) * 20, -100 + Math.cos(count)* 20);
|
thing.lineTo(-120 + Math.sin(count) * 20, -100 + Math.cos(count)* 20);
|
||||||
thing.rotation = count * 0.1;
|
thing.rotation = count * 0.1;
|
||||||
|
|
||||||
//var mask1 = new PIXI.Graphics();
|
|
||||||
|
|
||||||
|
|
||||||
renderer.render(stage);
|
renderer.render(stage);
|
||||||
|
|
|
@ -100,8 +100,7 @@
|
||||||
/*
|
/*
|
||||||
* Add a pixi Logo!
|
* Add a pixi Logo!
|
||||||
*/
|
*/
|
||||||
var logo = PIXI.Sprite.fromImage("../../logo_small.png")
|
var logo = PIXI.Sprite.fromImage("../../logo_small.png");
|
||||||
// stage.addChild(logo);
|
|
||||||
|
|
||||||
logo.anchor.x = 1;
|
logo.anchor.x = 1;
|
||||||
logo.position.x = 620
|
logo.position.x = 620
|
||||||
|
@ -112,7 +111,7 @@
|
||||||
|
|
||||||
logo.click = logo.tap = function()
|
logo.click = logo.tap = function()
|
||||||
{
|
{
|
||||||
window.open("https://github.com/GoodBoyDigital/pixi.js", "_blank")
|
window.open("https://github.com/GoodBoyDigital/pixi.js", "_blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
var help = new PIXI.Text("Click to turn filters on / off.", {font:"bold 12pt Arial", fill:"white"});
|
var help = new PIXI.Text("Click to turn filters on / off.", {font:"bold 12pt Arial", fill:"white"});
|
||||||
|
@ -120,9 +119,6 @@
|
||||||
help.position.x = 10;
|
help.position.x = 10;
|
||||||
stage.addChild(help);
|
stage.addChild(help);
|
||||||
|
|
||||||
//stage.filters = [filter];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
requestAnimFrame(animate);
|
requestAnimFrame(animate);
|
||||||
|
|
||||||
|
|
|
@ -90,10 +90,6 @@
|
||||||
viewWidth + dudeBoundsPadding * 2,
|
viewWidth + dudeBoundsPadding * 2,
|
||||||
viewHeight + dudeBoundsPadding * 2);
|
viewHeight + dudeBoundsPadding * 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create a displacment map
|
|
||||||
|
|
||||||
|
|
||||||
var tick = 0;
|
var tick = 0;
|
||||||
requestAnimationFrame(animate);
|
requestAnimationFrame(animate);
|
||||||
|
@ -109,7 +105,7 @@
|
||||||
dude.position.y += Math.cos(dude.direction) * dude.speed;
|
dude.position.y += Math.cos(dude.direction) * dude.speed;
|
||||||
dude.rotation = -dude.direction - Math.PI/2;
|
dude.rotation = -dude.direction - Math.PI/2;
|
||||||
|
|
||||||
// wrap the dudes by testing there bounds..
|
// wrap the dudes by testing their bounds..
|
||||||
if(dude.position.x < dudeBounds.x)dude.position.x += dudeBounds.width;
|
if(dude.position.x < dudeBounds.x)dude.position.x += dudeBounds.width;
|
||||||
else if(dude.position.x > dudeBounds.x + dudeBounds.width)dude.position.x -= dudeBounds.width
|
else if(dude.position.x > dudeBounds.x + dudeBounds.width)dude.position.x -= dudeBounds.width
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,6 @@
|
||||||
viewWidth + dudeBoundsPadding * 2,
|
viewWidth + dudeBoundsPadding * 2,
|
||||||
viewHeight + dudeBoundsPadding * 2);
|
viewHeight + dudeBoundsPadding * 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create a displacment map
|
|
||||||
|
|
||||||
|
|
||||||
var tick = 0;
|
var tick = 0;
|
||||||
requestAnimationFrame(animate);
|
requestAnimationFrame(animate);
|
||||||
|
@ -124,7 +120,7 @@
|
||||||
dude.rotation = -dude.direction + Math.PI;
|
dude.rotation = -dude.direction + Math.PI;
|
||||||
|
|
||||||
|
|
||||||
// wrap the dudes by testing there bounds..
|
// wrap the dudes by testing their bounds..
|
||||||
if(dude.position.x < dudeBounds.x)dude.position.x += dudeBounds.width;
|
if(dude.position.x < dudeBounds.x)dude.position.x += dudeBounds.width;
|
||||||
else if(dude.position.x > dudeBounds.x + dudeBounds.width)dude.position.x -= dudeBounds.width
|
else if(dude.position.x > dudeBounds.x + dudeBounds.width)dude.position.x -= dudeBounds.width
|
||||||
|
|
||||||
|
@ -137,7 +133,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// time to render the state!
|
// time to render the stage !
|
||||||
renderer.render(stage);
|
renderer.render(stage);
|
||||||
|
|
||||||
// request another animation frame..
|
// request another animation frame..
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -106,18 +106,18 @@
|
||||||
button.mouseout = function(data){
|
button.mouseout = function(data){
|
||||||
|
|
||||||
this.isOver = false;
|
this.isOver = false;
|
||||||
|
|
||||||
if(this.isdown)return
|
if(this.isdown)return
|
||||||
this.setTexture(textureButton)
|
this.setTexture(textureButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
button.click = function(data){
|
button.click = function(data){
|
||||||
// click!
|
|
||||||
console.log("CLICK!");
|
console.log("CLICK!");
|
||||||
// alert("CLICK!")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button.tap = function(data){
|
button.tap = function(data){
|
||||||
// click!
|
|
||||||
console.log("TAP!!");
|
console.log("TAP!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
// create a renderer instance
|
// create a renderer instance
|
||||||
|
|
||||||
var renderer = PIXI.autoDetectRenderer(400, 300, null, true);
|
var renderer = PIXI.autoDetectRenderer(400, 300,false,true);
|
||||||
|
|
||||||
// add the renderer view element to the DOM
|
// add the renderer view element to the DOM
|
||||||
document.body.appendChild(renderer.view);
|
document.body.appendChild(renderer.view);
|
||||||
|
|
|
@ -9,10 +9,6 @@
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.textHolder{
|
|
||||||
width: 400px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
<script src="../../bin/pixi.dev.js"></script>
|
<script src="../../bin/pixi.dev.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -45,7 +41,7 @@
|
||||||
{
|
{
|
||||||
// create our little bunny friend..
|
// create our little bunny friend..
|
||||||
var bunny = new PIXI.Sprite(texture);
|
var bunny = new PIXI.Sprite(texture);
|
||||||
// bunny.width = 300;
|
|
||||||
// enable the bunny to be interactive.. this will allow it to respond to mouse and touch events
|
// enable the bunny to be interactive.. this will allow it to respond to mouse and touch events
|
||||||
bunny.interactive = true;
|
bunny.interactive = true;
|
||||||
// this button mode will mean the hand cursor appears when you rollover the bunny with your mouse
|
// this button mode will mean the hand cursor appears when you rollover the bunny with your mouse
|
||||||
|
@ -64,7 +60,7 @@
|
||||||
// stop the default event...
|
// stop the default event...
|
||||||
data.originalEvent.preventDefault();
|
data.originalEvent.preventDefault();
|
||||||
|
|
||||||
// store a refference to the data
|
// store a reference to the data
|
||||||
// The reason for this is because of multitouch
|
// The reason for this is because of multitouch
|
||||||
// we want to track the movement of this particular touch
|
// we want to track the movement of this particular touch
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
@ -86,7 +82,6 @@
|
||||||
{
|
{
|
||||||
if(this.dragging)
|
if(this.dragging)
|
||||||
{
|
{
|
||||||
// need to get parent coords..
|
|
||||||
var newPosition = this.data.getLocalPosition(this.parent);
|
var newPosition = this.data.getLocalPosition(this.parent);
|
||||||
this.position.x = newPosition.x;
|
this.position.x = newPosition.x;
|
||||||
this.position.y = newPosition.y;
|
this.position.y = newPosition.y;
|
||||||
|
@ -103,10 +98,8 @@
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
|
|
||||||
requestAnimFrame( animate );
|
requestAnimFrame(animate);
|
||||||
|
|
||||||
// just for fun, lets rotate mr rabbit a little
|
|
||||||
//stage.interactionManager.update();
|
|
||||||
// render the stage
|
// render the stage
|
||||||
renderer.render(stage);
|
renderer.render(stage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
// create a texture from an image path
|
// create a texture from an image path
|
||||||
var texture = PIXI.Texture.fromImage("p2.jpeg");
|
var texture = PIXI.Texture.fromImage("p2.jpeg");
|
||||||
|
|
||||||
// create a tiling sprite..
|
// create a tiling sprite ...
|
||||||
// requires a texture, width and height
|
// requires a texture, width and height
|
||||||
// to work in webGL the texture size must be a power of two
|
// to work in webGL the texture size must be a power of two
|
||||||
var tilingSprite = new PIXI.TilingSprite(texture, window.innerWidth, window.innerHeight)
|
var tilingSprite = new PIXI.TilingSprite(texture, window.innerWidth, window.innerHeight)
|
||||||
|
@ -45,8 +45,8 @@
|
||||||
|
|
||||||
requestAnimFrame(animate);
|
requestAnimFrame(animate);
|
||||||
|
|
||||||
|
count += 0.005;
|
||||||
|
|
||||||
count += 0.005
|
|
||||||
tilingSprite.tileScale.x = 2 + Math.sin(count);
|
tilingSprite.tileScale.x = 2 + Math.sin(count);
|
||||||
tilingSprite.tileScale.y = 2 + Math.cos(count);
|
tilingSprite.tileScale.y = 2 + Math.cos(count);
|
||||||
|
|
||||||
|
|
BIN
examples/test/bunny.png
Normal file
BIN
examples/test/bunny.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 449 B |
132
examples/test/index.html
Normal file
132
examples/test/index.html
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<!--<link href=<script src="http://fonts.googleapis.com/css?family=Snippet|Arvo:700italic|Podkova<script src=" rel=<script src="stylesheet<script src=" type=<script src="text/css<script src=">-->
|
||||||
|
<title>pixi.js example 10 Text</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script src="../../src/pixi/Pixi.js"></script>
|
||||||
|
<script src="../../src/pixi/core/Point.js"></script>
|
||||||
|
<script src="../../src/pixi/core/Rectangle.js"></script>
|
||||||
|
<script src="../../src/pixi/core/Polygon.js"></script>
|
||||||
|
<script src="../../src/pixi/core/Circle.js"></script>
|
||||||
|
<script src="../../src/pixi/core/Ellipse.js"></script>
|
||||||
|
<script src="../../src/pixi/core/Matrix.js"></script>
|
||||||
|
<script src="../../src/pixi/display/DisplayObject.js"></script>
|
||||||
|
<script src="../../src/pixi/display/DisplayObjectContainer.js"></script>
|
||||||
|
<script src="../../src/pixi/display/Sprite.js"></script>
|
||||||
|
<script src="../../src/pixi/display/SpriteBatch.js"></script>
|
||||||
|
<script src="../../src/pixi/display/MovieClip.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/FilterBlock.js"></script>
|
||||||
|
<script src="../../src/pixi/text/Text.js"></script>
|
||||||
|
<script src="../../src/pixi/text/BitmapText.js"></script>
|
||||||
|
<script src="../../src/pixi/InteractionData.js"></script>
|
||||||
|
<script src="../../src/pixi/InteractionManager.js"></script>
|
||||||
|
<script src="../../src/pixi/display/Stage.js"></script>
|
||||||
|
<script src="../../src/pixi/utils/Utils.js"></script>
|
||||||
|
<script src="../../src/pixi/utils/EventTarget.js"></script>
|
||||||
|
<script src="../../src/pixi/utils/Detector.js"></script>
|
||||||
|
<script src="../../src/pixi/utils/Polyk.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/utils/WebGLShaderUtils.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/shaders/PixiShader.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/shaders/PixiFastShader.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/shaders/StripShader.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/shaders/PrimitiveShader.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/utils/WebGLGraphics.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/WebGLRenderer.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/utils/WebGLMaskManager.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/utils/WebGLShaderManager.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/utils/WebGLFilterManager.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/webgl/utils/FilterTexture.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/canvas/utils/CanvasMaskManager.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/canvas/CanvasRenderer.js"></script>
|
||||||
|
<script src="../../src/pixi/renderers/canvas/CanvasGraphics.js"></script>
|
||||||
|
<script src="../../src/pixi/primitives/Graphics.js"></script>
|
||||||
|
<script src="../../src/pixi/extras/Strip.js"></script>
|
||||||
|
<script src="../../src/pixi/extras/Rope.js"></script>
|
||||||
|
<script src="../../src/pixi/extras/TilingSprite.js"></script>
|
||||||
|
<script src="../../src/pixi/extras/Spine.js"></script>
|
||||||
|
<script src="../../src/pixi/textures/BaseTexture.js"></script>
|
||||||
|
<script src="../../src/pixi/textures/Texture.js"></script>
|
||||||
|
<script src="../../src/pixi/textures/RenderTexture.js"></script>
|
||||||
|
<script src="../../src/pixi/loaders/AssetLoader.js"></script>
|
||||||
|
<script src="../../src/pixi/loaders/JsonLoader.js"></script>
|
||||||
|
<script src="../../src/pixi/loaders/AtlasLoader.js"></script>
|
||||||
|
<script src="../../src/pixi/loaders/SpriteSheetLoader.js"></script>
|
||||||
|
<script src="../../src/pixi/loaders/ImageLoader.js"></script>
|
||||||
|
<script src="../../src/pixi/loaders/BitmapFontLoader.js"></script>
|
||||||
|
<script src="../../src/pixi/loaders/SpineLoader.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/AbstractFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/AlphaMaskFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/ColorMatrixFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/GrayFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/DisplacementFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/PixelateFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/BlurXFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/BlurYFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/BlurFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/InvertFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/SepiaFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/TwistFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/ColorStepFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/DotScreenFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/CrossHatchFilter.js"></script>
|
||||||
|
<script src="../../src/pixi/filters/RGBSplitFilter.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
// create an new instance of a pixi stage
|
||||||
|
var stage = new PIXI.Stage(0x66FF99);
|
||||||
|
|
||||||
|
// create a renderer instance
|
||||||
|
var renderer = PIXI.autoDetectRenderer(400, 300);
|
||||||
|
|
||||||
|
// add the renderer view element to the DOM
|
||||||
|
document.body.appendChild(renderer.view);
|
||||||
|
|
||||||
|
requestAnimFrame(animate);
|
||||||
|
|
||||||
|
// create a texture from an image path
|
||||||
|
var texture = PIXI.Texture.fromImage("bunny.png");
|
||||||
|
|
||||||
|
// create a new Sprite using the texture
|
||||||
|
var bunny = new PIXI.Sprite(texture);
|
||||||
|
|
||||||
|
// center the sprites anchor point
|
||||||
|
bunny.anchor.x = 0.5;
|
||||||
|
bunny.anchor.y = 0.5;
|
||||||
|
|
||||||
|
// move the sprite t the center of the screen
|
||||||
|
bunny.position.x = 200;
|
||||||
|
bunny.position.y = 150;
|
||||||
|
|
||||||
|
stage.addChild(bunny);
|
||||||
|
|
||||||
|
function animate() {
|
||||||
|
|
||||||
|
requestAnimFrame(animate);
|
||||||
|
|
||||||
|
// just for fun, let's rotate mr rabbit a little
|
||||||
|
bunny.rotation += 0.1;
|
||||||
|
|
||||||
|
// render the stage
|
||||||
|
renderer.render(stage);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -57,9 +57,10 @@ PIXI.InteractionManager = function(stage)
|
||||||
this.pool = [];
|
this.pool = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO-Alvin
|
* An array containing all the iterative items from the our interactive tree
|
||||||
* @property interactiveItems
|
* @property interactiveItems
|
||||||
* @type Array
|
* @type Array
|
||||||
|
* @private
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
this.interactiveItems = [];
|
this.interactiveItems = [];
|
||||||
|
@ -84,8 +85,20 @@ PIXI.InteractionManager = function(stage)
|
||||||
|
|
||||||
this.last = 0;
|
this.last = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The css style of the cursor that is being used
|
||||||
|
* @property currentCursorStyle
|
||||||
|
* @type String
|
||||||
|
*
|
||||||
|
*/
|
||||||
this.currentCursorStyle = 'inherit';
|
this.currentCursorStyle = 'inherit';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is set to true when the mouse is moved out of the canvas
|
||||||
|
* @property mouseOut
|
||||||
|
* @type Boolean
|
||||||
|
*
|
||||||
|
*/
|
||||||
this.mouseOut = false;
|
this.mouseOut = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,7 +110,7 @@ PIXI.InteractionManager.prototype.constructor = PIXI.InteractionManager;
|
||||||
*
|
*
|
||||||
* @method collectInteractiveSprite
|
* @method collectInteractiveSprite
|
||||||
* @param displayObject {DisplayObject} the displayObject to collect
|
* @param displayObject {DisplayObject} the displayObject to collect
|
||||||
* @param iParent {DisplayObject}
|
* @param iParent {DisplayObject} the display object's parent
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
PIXI.InteractionManager.prototype.collectInteractiveSprite = function(displayObject, iParent)
|
PIXI.InteractionManager.prototype.collectInteractiveSprite = function(displayObject, iParent)
|
||||||
|
@ -385,7 +398,7 @@ PIXI.InteractionManager.prototype.onMouseDown = function(event)
|
||||||
/**
|
/**
|
||||||
* Is called when the mouse button is moved out of the renderer element
|
* Is called when the mouse button is moved out of the renderer element
|
||||||
*
|
*
|
||||||
* @method onMouseDown
|
* @method onMouseOut
|
||||||
* @param event {Event} The DOM event of a mouse button being moved out
|
* @param event {Event} The DOM event of a mouse button being moved out
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
var PIXI = PIXI || {};
|
var PIXI = PIXI || {};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO-Alvin
|
|
||||||
* Create a const class just for the sake of documenting them under one hat ?
|
|
||||||
*
|
*
|
||||||
|
* This file contains a lot of pixi consts which are used across the rendering engine
|
||||||
|
* @class Consts
|
||||||
*/
|
*/
|
||||||
PIXI.WEBGL_RENDERER = 0;
|
PIXI.WEBGL_RENDERER = 0;
|
||||||
PIXI.CANVAS_RENDERER = 1;
|
PIXI.CANVAS_RENDERER = 1;
|
||||||
|
|
|
@ -2,18 +2,27 @@
|
||||||
* @author Mat Groves http://matgroves.com/ @Doormat23
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* @class Matrix
|
|
||||||
* The Matrix class will choose the best type of array to use between
|
|
||||||
* a regular javascript Array and a Float32Array if the latter is available
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
PIXI.determineMatrixArrayType = function() {
|
PIXI.determineMatrixArrayType = function() {
|
||||||
return (typeof Float32Array !== 'undefined') ? Float32Array : Array;
|
return (typeof Float32Array !== 'undefined') ? Float32Array : Array;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @class Matrix2
|
||||||
|
* The Matrix2 class will choose the best type of array to use between
|
||||||
|
* a regular javascript Array and a Float32Array if the latter is available
|
||||||
|
*
|
||||||
|
*/
|
||||||
PIXI.Matrix2 = PIXI.determineMatrixArrayType();
|
PIXI.Matrix2 = PIXI.determineMatrixArrayType();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @class Matrix
|
||||||
|
* The Matrix class is now an object, which makes it a lot faster,
|
||||||
|
* here is a representation of it :
|
||||||
|
* | a | b | tx|
|
||||||
|
* | c | c | ty|
|
||||||
|
* | 0 | 0 | 1 |
|
||||||
|
*
|
||||||
|
*/
|
||||||
PIXI.Matrix = function()
|
PIXI.Matrix = function()
|
||||||
{
|
{
|
||||||
this.a = 1;
|
this.a = 1;
|
||||||
|
@ -24,6 +33,12 @@ PIXI.Matrix = function()
|
||||||
this.ty = 0;
|
this.ty = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a pixi matrix object based on the array given as a parameter
|
||||||
|
*
|
||||||
|
* @method fromArray
|
||||||
|
* @param array {Array} The array that the matrix will be filled with
|
||||||
|
*/
|
||||||
PIXI.Matrix.prototype.fromArray = function(array)
|
PIXI.Matrix.prototype.fromArray = function(array)
|
||||||
{
|
{
|
||||||
this.a = array[0];
|
this.a = array[0];
|
||||||
|
@ -34,6 +49,13 @@ PIXI.Matrix.prototype.fromArray = function(array)
|
||||||
this.ty = array[5];
|
this.ty = array[5];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an array from the current Matrix object
|
||||||
|
*
|
||||||
|
* @method toArray
|
||||||
|
* @param transpose {Boolean} Whether we need to transpose the matrix or not
|
||||||
|
* @return array {Array} the newly created array which contains the matrix
|
||||||
|
*/
|
||||||
PIXI.Matrix.prototype.toArray = function(transpose)
|
PIXI.Matrix.prototype.toArray = function(transpose)
|
||||||
{
|
{
|
||||||
if(!this.array) this.array = new Float32Array(9);
|
if(!this.array) this.array = new Float32Array(9);
|
||||||
|
|
|
@ -399,7 +399,6 @@ PIXI.DisplayObject.prototype.updateTransform = function()
|
||||||
// var localTransform = this.localTransform//.toArray();
|
// var localTransform = this.localTransform//.toArray();
|
||||||
var parentTransform = this.parent.worldTransform;//.toArray();
|
var parentTransform = this.parent.worldTransform;//.toArray();
|
||||||
var worldTransform = this.worldTransform;//.toArray();
|
var worldTransform = this.worldTransform;//.toArray();
|
||||||
//console.log(localTransform)
|
|
||||||
var px = this.pivot.x;
|
var px = this.pivot.x;
|
||||||
var py = this.pivot.y;
|
var py = this.pivot.y;
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,24 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all the children
|
||||||
|
*
|
||||||
|
* @method removeAll
|
||||||
|
* NOT tested yet
|
||||||
|
*/
|
||||||
|
/* PIXI.DisplayObjectContainer.prototype.removeAll = function()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
for(var i = 0 , j = this.children.length; i < j; i++)
|
||||||
|
{
|
||||||
|
this.removeChild(this.children[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
* Updates the container's childrens transform for rendering
|
* Updates the container's childrens transform for rendering
|
||||||
*
|
*
|
||||||
|
@ -392,5 +410,4 @@ PIXI.DisplayObjectContainer.prototype._renderCanvas = function(renderSession)
|
||||||
{
|
{
|
||||||
renderSession.maskManager.popMask(renderSession.context);
|
renderSession.maskManager.popMask(renderSession.context);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -165,12 +165,13 @@ PIXI.Sprite.prototype.onTextureUpdate = function()
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the bounds of the sprite as a rectangle object
|
* Returns the framing rectangle of the sprite as a PIXI.Rectangle object
|
||||||
*
|
*
|
||||||
* @method getBounds
|
* @method getBounds
|
||||||
* @return {Rectangle} the rectangular bounding area
|
* @param matrix {Matrix} the transformation matrix of the sprite
|
||||||
*/
|
* @return {Rectangle} the framing rectangle
|
||||||
PIXI.Sprite.prototype.getBounds = function( matrix )
|
*/
|
||||||
|
PIXI.Sprite.prototype.getBounds = function(matrix)
|
||||||
{
|
{
|
||||||
|
|
||||||
var width = this.texture.frame.width;
|
var width = this.texture.frame.width;
|
||||||
|
|
|
@ -3,7 +3,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO-Alvin
|
* The SpriteBatch class is a really fast version of the DisplayObjectContainer
|
||||||
|
* built solely for speed, so use when you need a lot of sprites or particles.
|
||||||
|
* And it's extremely easy to use :
|
||||||
|
|
||||||
|
var container = new PIXI.SpriteBatch();
|
||||||
|
|
||||||
|
stage.addChild(container);
|
||||||
|
|
||||||
|
for(var i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
var sprite = new PIXI.Sprite.fromImage("myImage.png");
|
||||||
|
container.addChild(sprite);
|
||||||
|
}
|
||||||
|
* And here you have a hundred sprites that will be renderer at the speed of light
|
||||||
*
|
*
|
||||||
* @class SpriteBatch
|
* @class SpriteBatch
|
||||||
* @constructor
|
* @constructor
|
||||||
|
@ -18,10 +31,9 @@ PIXI.SpriteBatch = function(texture)
|
||||||
this.ready = false;
|
this.ready = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
PIXI.SpriteBatch.prototype = Object.create( PIXI.DisplayObjectContainer.prototype );
|
PIXI.SpriteBatch.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
|
||||||
PIXI.SpriteBatch.constructor = PIXI.SpriteBatch;
|
PIXI.SpriteBatch.constructor = PIXI.SpriteBatch;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialises the spriteBatch
|
* Initialises the spriteBatch
|
||||||
*
|
*
|
||||||
|
@ -44,7 +56,7 @@ PIXI.SpriteBatch.prototype.initWebGL = function(gl)
|
||||||
*/
|
*/
|
||||||
PIXI.SpriteBatch.prototype.updateTransform = function()
|
PIXI.SpriteBatch.prototype.updateTransform = function()
|
||||||
{
|
{
|
||||||
// dont need to!
|
// TODO dont need to!
|
||||||
PIXI.DisplayObject.prototype.updateTransform.call( this );
|
PIXI.DisplayObject.prototype.updateTransform.call( this );
|
||||||
// PIXI.DisplayObjectContainer.prototype.updateTransform.call( this );
|
// PIXI.DisplayObjectContainer.prototype.updateTransform.call( this );
|
||||||
};
|
};
|
||||||
|
@ -143,8 +155,6 @@ PIXI.SpriteBatch.prototype._renderCanvas = function(renderSession)
|
||||||
d = child._cr * child.scale.y;
|
d = child._cr * child.scale.y;
|
||||||
|
|
||||||
context.setTransform(a, c, b, d, child.position.x, child.position.y);
|
context.setTransform(a, c, b, d, child.position.x, child.position.y);
|
||||||
|
|
||||||
//context.setTransform(transform.a, transform.c, transform.b, transform.d, transform.tx, transform.ty);
|
|
||||||
|
|
||||||
context.drawImage(texture.baseTexture.source,
|
context.drawImage(texture.baseTexture.source,
|
||||||
frame.x,
|
frame.x,
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
*
|
*
|
||||||
* @class Rope
|
* @class Rope
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param texture {Texture} TODO-Alvin
|
* @param texture {Texture} The texture to use
|
||||||
* @param y {Array} TODO-Alvin
|
* @param points {Array}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
PIXI.Rope = function(texture, points)
|
PIXI.Rope = function(texture, points)
|
||||||
|
@ -38,7 +38,7 @@ PIXI.Rope.prototype = Object.create( PIXI.Strip.prototype );
|
||||||
PIXI.Rope.prototype.constructor = PIXI.Rope;
|
PIXI.Rope.prototype.constructor = PIXI.Rope;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Refreshes TODO-Alvin
|
* Refreshes
|
||||||
*
|
*
|
||||||
* @method refresh
|
* @method refresh
|
||||||
*/
|
*/
|
||||||
|
@ -177,7 +177,6 @@ PIXI.Rope.prototype.updateTransform = function()
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
* Sets the texture that the Rope will use
|
* Sets the texture that the Rope will use
|
||||||
* TODO-Alvin
|
|
||||||
*
|
*
|
||||||
* @method setTexture
|
* @method setTexture
|
||||||
* @param texture {Texture} the texture that will be used
|
* @param texture {Texture} the texture that will be used
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var spine = {};
|
var spine = {};
|
||||||
|
|
||||||
spine.BoneData = function (name, parent) {
|
spine.BoneData = function (name, parent) {
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
* @class Strip
|
* @class Strip
|
||||||
* @extends DisplayObjectContainer
|
* @extends DisplayObjectContainer
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param texture {Texture} TODO-Alvin
|
* @param texture {Texture} The texture to use
|
||||||
* @param width {Number} the width of the TODO-Alvin
|
* @param width {Number} the width
|
||||||
* @param height {Number} the height of the TODO-Alvin
|
* @param height {Number} the height
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
PIXI.Strip = function(texture, width, height)
|
PIXI.Strip = function(texture, width, height)
|
||||||
|
@ -82,7 +82,6 @@ PIXI.Strip.prototype.constructor = PIXI.Strip;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets the texture that the Strip will use
|
* Sets the texture that the Strip will use
|
||||||
* TODO-Alvin
|
|
||||||
*
|
*
|
||||||
* @method setTexture
|
* @method setTexture
|
||||||
* @param texture {Texture} the texture that will be used
|
* @param texture {Texture} the texture that will be used
|
||||||
|
@ -110,5 +109,4 @@ PIXI.Strip.prototype.setTexture = function(texture)
|
||||||
PIXI.Strip.prototype.onTextureUpdate = function()
|
PIXI.Strip.prototype.onTextureUpdate = function()
|
||||||
{
|
{
|
||||||
this.updateFrame = true;
|
this.updateFrame = true;
|
||||||
};
|
};
|
||||||
// some helper functions..
|
|
|
@ -40,7 +40,7 @@ PIXI.TilingSprite = function(texture, width, height)
|
||||||
this.tileScale = new PIXI.Point(1,1);
|
this.tileScale = new PIXI.Point(1,1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* A point that represents the scale of the texture object
|
||||||
*
|
*
|
||||||
* @property tileScaleOffset
|
* @property tileScaleOffset
|
||||||
* @type Point
|
* @type Point
|
||||||
|
@ -55,6 +55,14 @@ PIXI.TilingSprite = function(texture, width, height)
|
||||||
*/
|
*/
|
||||||
this.tilePosition = new PIXI.Point(0,0);
|
this.tilePosition = new PIXI.Point(0,0);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this sprite is renderable or not
|
||||||
|
*
|
||||||
|
* @property renderable
|
||||||
|
* @type Boolean
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
this.renderable = true;
|
this.renderable = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,7 +85,7 @@ PIXI.TilingSprite = function(texture, width, height)
|
||||||
};
|
};
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
PIXI.TilingSprite.prototype = Object.create( PIXI.Sprite.prototype );
|
PIXI.TilingSprite.prototype = Object.create(PIXI.Sprite.prototype);
|
||||||
PIXI.TilingSprite.prototype.constructor = PIXI.TilingSprite;
|
PIXI.TilingSprite.prototype.constructor = PIXI.TilingSprite;
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +121,7 @@ Object.defineProperty(PIXI.TilingSprite.prototype, 'height', {
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the texture is updated, this event will fire to update the scale and frame
|
* When the texture is updated, this event will be fired to update the scale and frame
|
||||||
*
|
*
|
||||||
* @method onTextureUpdate
|
* @method onTextureUpdate
|
||||||
* @param event
|
* @param event
|
||||||
|
@ -121,13 +129,16 @@ Object.defineProperty(PIXI.TilingSprite.prototype, 'height', {
|
||||||
*/
|
*/
|
||||||
PIXI.TilingSprite.prototype.onTextureUpdate = function()
|
PIXI.TilingSprite.prototype.onTextureUpdate = function()
|
||||||
{
|
{
|
||||||
// so if _width is 0 then width was not set..
|
|
||||||
//console.log("HI MUM")
|
|
||||||
|
|
||||||
|
|
||||||
this.updateFrame = true;
|
this.updateFrame = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the object using the WebGL renderer
|
||||||
|
*
|
||||||
|
* @method _renderWebGL
|
||||||
|
* @param renderSession {RenderSession}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -179,7 +190,13 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the object using the Canvas renderer
|
||||||
|
*
|
||||||
|
* @method _renderCanvas
|
||||||
|
* @param renderSession {RenderSession}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
||||||
{
|
{
|
||||||
if(this.visible === false || this.alpha === 0)return;
|
if(this.visible === false || this.alpha === 0)return;
|
||||||
|
@ -227,7 +244,6 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
||||||
tilePosition.x %= this.tilingTexture.baseTexture.width;
|
tilePosition.x %= this.tilingTexture.baseTexture.width;
|
||||||
tilePosition.y %= this.tilingTexture.baseTexture.height;
|
tilePosition.y %= this.tilingTexture.baseTexture.height;
|
||||||
|
|
||||||
// console.log(tileScale.x)
|
|
||||||
// offset
|
// offset
|
||||||
context.scale(tileScale.x,tileScale.y);
|
context.scale(tileScale.x,tileScale.y);
|
||||||
context.translate(tilePosition.x, tilePosition.y);
|
context.translate(tilePosition.x, tilePosition.y);
|
||||||
|
@ -246,6 +262,13 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the framing rectangle of the sprite as a PIXI.Rectangle object
|
||||||
|
*
|
||||||
|
* @method getBounds
|
||||||
|
* @return {Rectangle} the framing rectangle
|
||||||
|
*/
|
||||||
PIXI.TilingSprite.prototype.getBounds = function()
|
PIXI.TilingSprite.prototype.getBounds = function()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -319,7 +342,12 @@ PIXI.TilingSprite.prototype.getBounds = function()
|
||||||
return bounds;
|
return bounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @method generateTilingTexture
|
||||||
|
*
|
||||||
|
* @param forcePowerOfTwo {Boolean} Whether we want to force the texture to be a power of two
|
||||||
|
*/
|
||||||
PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo)
|
PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo)
|
||||||
{
|
{
|
||||||
var texture = this.texture;
|
var texture = this.texture;
|
||||||
|
|
|
@ -19,7 +19,6 @@ PIXI.AlphaMaskFilter = function(texture)
|
||||||
texture.baseTexture._powerOf2 = true;
|
texture.baseTexture._powerOf2 = true;
|
||||||
|
|
||||||
// set the uniforms
|
// set the uniforms
|
||||||
//console.log()
|
|
||||||
this.uniforms = {
|
this.uniforms = {
|
||||||
mask: {type: 'sampler2D', value:texture},
|
mask: {type: 'sampler2D', value:texture},
|
||||||
mapDimensions: {type: '2f', value:{x:1, y:5112}},
|
mapDimensions: {type: '2f', value:{x:1, y:5112}},
|
||||||
|
|
|
@ -19,7 +19,6 @@ PIXI.DisplacementFilter = function(texture)
|
||||||
texture.baseTexture._powerOf2 = true;
|
texture.baseTexture._powerOf2 = true;
|
||||||
|
|
||||||
// set the uniforms
|
// set the uniforms
|
||||||
//console.log()
|
|
||||||
this.uniforms = {
|
this.uniforms = {
|
||||||
displacementMap: {type: 'sampler2D', value:texture},
|
displacementMap: {type: 'sampler2D', value:texture},
|
||||||
scale: {type: '2f', value:{x:30, y:30}},
|
scale: {type: '2f', value:{x:30, y:30}},
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PIXI.FilterBlock = function()
|
PIXI.FilterBlock = function()
|
||||||
{
|
{
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
|
|
|
@ -20,7 +20,6 @@ PIXI.NormalMapFilter = function(texture)
|
||||||
texture.baseTexture._powerOf2 = true;
|
texture.baseTexture._powerOf2 = true;
|
||||||
|
|
||||||
// set the uniforms
|
// set the uniforms
|
||||||
//console.log()
|
|
||||||
this.uniforms = {
|
this.uniforms = {
|
||||||
displacementMap: {type: 'sampler2D', value:texture},
|
displacementMap: {type: 'sampler2D', value:texture},
|
||||||
scale: {type: '2f', value:{x:15, y:15}},
|
scale: {type: '2f', value:{x:15, y:15}},
|
||||||
|
|
|
@ -80,7 +80,7 @@ PIXI.Graphics = function()
|
||||||
this.currentPath = {points:[]};
|
this.currentPath = {points:[]};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebGL lines ? TODO-Alvin
|
* Array containing some WebGL-related properties used by the WebGL renderer
|
||||||
*
|
*
|
||||||
* @property _webGL
|
* @property _webGL
|
||||||
* @type Array
|
* @type Array
|
||||||
|
@ -89,7 +89,7 @@ PIXI.Graphics = function()
|
||||||
this._webGL = [];
|
this._webGL = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this shape is used as a mask
|
* Whether this shape is being used as a mask
|
||||||
*
|
*
|
||||||
* @property isMask
|
* @property isMask
|
||||||
* @type isMask
|
* @type isMask
|
||||||
|
@ -105,7 +105,7 @@ PIXI.Graphics = function()
|
||||||
this.bounds = null;
|
this.bounds = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the bound padding TODO-Alvin
|
* the bounds' padding used for bounds calculation
|
||||||
*
|
*
|
||||||
* @property bounds
|
* @property bounds
|
||||||
* @type Number
|
* @type Number
|
||||||
|
@ -578,7 +578,7 @@ PIXI.Graphics.prototype.updateBounds = function()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the cached sprite that was made using the generate TODO-Alvin
|
* Generates the cached sprite when the sprite has cacheAsBitmap = true
|
||||||
*
|
*
|
||||||
* @method _generateCachedSprite
|
* @method _generateCachedSprite
|
||||||
* @private
|
* @private
|
||||||
|
|
|
@ -145,7 +145,7 @@ PIXI.CanvasRenderer = function(width, height, view, transparent)
|
||||||
this.maskManager = new PIXI.CanvasMaskManager();
|
this.maskManager = new PIXI.CanvasMaskManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RenderSession TODO-Alvin
|
* The render session is just a bunch of parameter used for rendering
|
||||||
* @property renderSession
|
* @property renderSession
|
||||||
* @type Object
|
* @type Object
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,19 +14,16 @@ PIXI.CanvasMaskManager = function()
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO-Alvin
|
* This method adds it to the current stack of masks
|
||||||
*
|
*
|
||||||
* @method pushMask
|
* @method pushMask
|
||||||
* @param maskData TODO-Alvin
|
* @param maskData the maskData that will be pushed
|
||||||
* @param context {Context2D} the 2d drawing method of the canvas
|
* @param context {Context2D} the 2d drawing method of the canvas
|
||||||
*/
|
*/
|
||||||
PIXI.CanvasMaskManager.prototype.pushMask = function(maskData, context)
|
PIXI.CanvasMaskManager.prototype.pushMask = function(maskData, context)
|
||||||
{
|
{
|
||||||
context.save();
|
context.save();
|
||||||
|
|
||||||
//maskData.visible = false;
|
|
||||||
// maskData.alpha = 0;
|
|
||||||
|
|
||||||
var cacheAlpha = maskData.alpha;
|
var cacheAlpha = maskData.alpha;
|
||||||
var transform = maskData.worldTransform;
|
var transform = maskData.worldTransform;
|
||||||
|
|
||||||
|
|
|
@ -19,17 +19,15 @@ PIXI.CanvasTinter = function()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO-Alvin
|
* Basically this method just needs a sprite and a color and tints the sprite
|
||||||
|
* with the given color
|
||||||
|
*
|
||||||
* @method getTintedTexture
|
* @method getTintedTexture
|
||||||
* @param sprite {Sprite} the sprite to tint
|
* @param sprite {Sprite} the sprite to tint
|
||||||
* @param color {Number} the color to use to tint the sprite with
|
* @param color {Number} the color to use to tint the sprite with
|
||||||
*/
|
*/
|
||||||
PIXI.CanvasTinter.getTintedTexture = function(sprite, color)
|
PIXI.CanvasTinter.getTintedTexture = function(sprite, color)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// cache on sprite
|
|
||||||
// cache on texture
|
|
||||||
// no cache
|
|
||||||
|
|
||||||
var texture = sprite.texture;
|
var texture = sprite.texture;
|
||||||
|
|
||||||
|
|
|
@ -63,10 +63,9 @@ PIXI.WebGLRenderer = function(width, height, view, transparent, antialias)
|
||||||
this.view.height = this.height;
|
this.view.height = this.height;
|
||||||
|
|
||||||
// deal with losing context..
|
// deal with losing context..
|
||||||
// TODO-Alvin
|
|
||||||
this.contextLost = this.handleContextLost.bind(this);
|
this.contextLost = this.handleContextLost.bind(this);
|
||||||
this.contextRestoredLost = this.handleContextRestored.bind(this);
|
this.contextRestoredLost = this.handleContextRestored.bind(this);
|
||||||
// console.log(this.handleContextRestored)
|
|
||||||
this.view.addEventListener('webglcontextlost', this.contextLost, false);
|
this.view.addEventListener('webglcontextlost', this.contextLost, false);
|
||||||
this.view.addEventListener('webglcontextrestored', this.contextRestoredLost, false);
|
this.view.addEventListener('webglcontextrestored', this.contextRestoredLost, false);
|
||||||
|
|
||||||
|
@ -136,7 +135,6 @@ PIXI.WebGLRenderer = function(width, height, view, transparent, antialias)
|
||||||
this.maskManager = new PIXI.WebGLMaskManager(gl); // manages the masks using the stencil buffer
|
this.maskManager = new PIXI.WebGLMaskManager(gl); // manages the masks using the stencil buffer
|
||||||
this.filterManager = new PIXI.WebGLFilterManager(gl, this.transparent); // manages the filters
|
this.filterManager = new PIXI.WebGLFilterManager(gl, this.transparent); // manages the filters
|
||||||
|
|
||||||
//
|
|
||||||
this.renderSession = {};
|
this.renderSession = {};
|
||||||
this.renderSession.gl = this.gl;
|
this.renderSession.gl = this.gl;
|
||||||
this.renderSession.drawCount = 0;
|
this.renderSession.drawCount = 0;
|
||||||
|
@ -206,9 +204,6 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
|
||||||
|
|
||||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
// this.projection.x = this.width/2;
|
|
||||||
//this.projection.y = -this.height/2;
|
|
||||||
|
|
||||||
this.renderDisplayObject( stage, this.projection );
|
this.renderDisplayObject( stage, this.projection );
|
||||||
|
|
||||||
// interaction
|
// interaction
|
||||||
|
@ -257,8 +252,8 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
|
||||||
*
|
*
|
||||||
* @method renderDIsplayObject
|
* @method renderDIsplayObject
|
||||||
* @param displayObject {DisplayObject} The DisplayObject to render
|
* @param displayObject {DisplayObject} The DisplayObject to render
|
||||||
* @param projection {Point}
|
* @param projection {Point} The projection
|
||||||
* @param buffer {Array} buffer TODO-Alvin
|
* @param buffer {Array} a standard WebGL buffer
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLRenderer.prototype.renderDisplayObject = function(displayObject, projection, buffer)
|
PIXI.WebGLRenderer.prototype.renderDisplayObject = function(displayObject, projection, buffer)
|
||||||
{
|
{
|
||||||
|
@ -335,7 +330,6 @@ PIXI.WebGLRenderer.destroyTexture = function(texture)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO-Alvin
|
|
||||||
*
|
*
|
||||||
* @method updateTextureFrame
|
* @method updateTextureFrame
|
||||||
* @param texture {Texture} The texture to update the frame from
|
* @param texture {Texture} The texture to update the frame from
|
||||||
|
@ -524,7 +518,7 @@ PIXI.WebGLRenderer.prototype.handleContextRestored = function()
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy TODO-Alvin
|
* Removes everything from the renderer (event listeners, spritebatch, etc...)
|
||||||
*
|
*
|
||||||
* @method destroy
|
* @method destroy
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class PIXI.PixiFastShader
|
* @class PixiFastShader
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param gl {WebGLContext} the current WebGL drawing context
|
* @param gl {WebGLContext} the current WebGL drawing context
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class PIXI.PixiShader
|
* @class PixiShader
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
PIXI.PixiShader = function(gl)
|
PIXI.PixiShader = function(gl)
|
||||||
|
|
|
@ -56,7 +56,7 @@ PIXI.WebGLFilterManager.prototype.begin = function(renderSession, buffer)
|
||||||
/**
|
/**
|
||||||
* Applies the filter and adds it to the current filter stack
|
* Applies the filter and adds it to the current filter stack
|
||||||
* @method pushFilter
|
* @method pushFilter
|
||||||
* @param filterBlock {Object} TODO-Alvin
|
* @param filterBlock {Object} the filter that will be pushed to the current filter stack
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLFilterManager.prototype.pushFilter = function(filterBlock)
|
PIXI.WebGLFilterManager.prototype.pushFilter = function(filterBlock)
|
||||||
{
|
{
|
||||||
|
@ -87,13 +87,7 @@ PIXI.WebGLFilterManager.prototype.pushFilter = function(filterBlock)
|
||||||
|
|
||||||
gl.bindTexture(gl.TEXTURE_2D, texture.texture);
|
gl.bindTexture(gl.TEXTURE_2D, texture.texture);
|
||||||
|
|
||||||
// this.getBounds(filterBlock.target);
|
|
||||||
|
|
||||||
filterBlock.target.filterArea = filterBlock.target.getBounds();
|
filterBlock.target.filterArea = filterBlock.target.getBounds();
|
||||||
// console.log(filterBlock.target.filterArea)
|
|
||||||
// console.log(filterBlock.target.filterArea);
|
|
||||||
// addpadding?
|
|
||||||
//displayObject.filterArea.x
|
|
||||||
|
|
||||||
var filterArea = filterBlock.target.filterArea;
|
var filterArea = filterBlock.target.filterArea;
|
||||||
|
|
||||||
|
@ -112,7 +106,6 @@ PIXI.WebGLFilterManager.prototype.pushFilter = function(filterBlock)
|
||||||
//gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, filterArea.width, filterArea.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
//gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, filterArea.width, filterArea.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, texture.frameBuffer);
|
gl.bindFramebuffer(gl.FRAMEBUFFER, texture.frameBuffer);
|
||||||
|
|
||||||
//console.log(filterArea)
|
|
||||||
// set view port
|
// set view port
|
||||||
gl.viewport(0, 0, filterArea.width, filterArea.height);
|
gl.viewport(0, 0, filterArea.width, filterArea.height);
|
||||||
|
|
||||||
|
@ -122,20 +115,16 @@ PIXI.WebGLFilterManager.prototype.pushFilter = function(filterBlock)
|
||||||
offset.x = -filterArea.x;
|
offset.x = -filterArea.x;
|
||||||
offset.y = -filterArea.y;
|
offset.y = -filterArea.y;
|
||||||
|
|
||||||
//console.log(PIXI.defaultShader.projectionVector)
|
|
||||||
// update projection
|
// update projection
|
||||||
gl.uniform2f(this.defaultShader.projectionVector, filterArea.width/2, -filterArea.height/2);
|
gl.uniform2f(this.defaultShader.projectionVector, filterArea.width/2, -filterArea.height/2);
|
||||||
gl.uniform2f(this.defaultShader.offsetVector, -filterArea.x, -filterArea.y);
|
gl.uniform2f(this.defaultShader.offsetVector, -filterArea.x, -filterArea.y);
|
||||||
//PIXI.primitiveProgram
|
|
||||||
|
|
||||||
gl.colorMask(true, true, true, true);
|
gl.colorMask(true, true, true, true);
|
||||||
gl.clearColor(0,0,0, 0);
|
gl.clearColor(0,0,0, 0);
|
||||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
//filter.texture = texture;
|
|
||||||
filterBlock._glFilterTexture = texture;
|
filterBlock._glFilterTexture = texture;
|
||||||
|
|
||||||
//console.log("PUSH")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -303,7 +292,6 @@ PIXI.WebGLFilterManager.prototype.popFilter = function()
|
||||||
gl.bindTexture(gl.TEXTURE_2D, texture.texture);
|
gl.bindTexture(gl.TEXTURE_2D, texture.texture);
|
||||||
|
|
||||||
// apply!
|
// apply!
|
||||||
//filter.applyFilterPass(sizeX, sizeY);
|
|
||||||
this.applyFilterPass(filter, filterArea, sizeX, sizeY);
|
this.applyFilterPass(filter, filterArea, sizeX, sizeY);
|
||||||
|
|
||||||
// now restore the regular shader..
|
// now restore the regular shader..
|
||||||
|
@ -350,12 +338,10 @@ PIXI.WebGLFilterManager.prototype.applyFilterPass = function(filter, filterArea,
|
||||||
|
|
||||||
if(filter.uniforms.dimensions)
|
if(filter.uniforms.dimensions)
|
||||||
{
|
{
|
||||||
//console.log(filter.uniforms.dimensions)
|
|
||||||
filter.uniforms.dimensions.value[0] = this.width;//width;
|
filter.uniforms.dimensions.value[0] = this.width;//width;
|
||||||
filter.uniforms.dimensions.value[1] = this.height;//height;
|
filter.uniforms.dimensions.value[1] = this.height;//height;
|
||||||
filter.uniforms.dimensions.value[2] = this.vertexArray[0];
|
filter.uniforms.dimensions.value[2] = this.vertexArray[0];
|
||||||
filter.uniforms.dimensions.value[3] = this.vertexArray[5];//filterArea.height;
|
filter.uniforms.dimensions.value[3] = this.vertexArray[5];//filterArea.height;
|
||||||
// console.log(this.vertexArray[5])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shader.syncUniforms();
|
shader.syncUniforms();
|
||||||
|
@ -438,7 +424,7 @@ PIXI.WebGLFilterManager.prototype.initShaderBuffers = function()
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO-Alvin
|
* Destroys the filter and removes it from the filter stack
|
||||||
* @method destroy
|
* @method destroy
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLFilterManager.prototype.destroy = function()
|
PIXI.WebGLFilterManager.prototype.destroy = function()
|
||||||
|
|
|
@ -145,7 +145,7 @@ PIXI.WebGLGraphics.updateGraphics = function(graphics, gl)
|
||||||
* @static
|
* @static
|
||||||
* @private
|
* @private
|
||||||
* @method buildRectangle
|
* @method buildRectangle
|
||||||
* @param graphicsData {Graphics} The graphics object to draw TODO-Alvin
|
* @param graphicsData {Graphics} The graphics object containing all the necessary properties
|
||||||
* @param webGLData {Object}
|
* @param webGLData {Object}
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
|
PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
|
||||||
|
@ -219,9 +219,8 @@ PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLGraphics.buildCircle = function(graphicsData, webGLData)
|
PIXI.WebGLGraphics.buildCircle = function(graphicsData, webGLData)
|
||||||
{
|
{
|
||||||
// --- //
|
|
||||||
// need to convert points to a nice regular data
|
// need to convert points to a nice regular data
|
||||||
//
|
|
||||||
var rectData = graphicsData.points;
|
var rectData = graphicsData.points;
|
||||||
var x = rectData[0];
|
var x = rectData[0];
|
||||||
var y = rectData[1];
|
var y = rectData[1];
|
||||||
|
@ -287,7 +286,7 @@ PIXI.WebGLGraphics.buildCircle = function(graphicsData, webGLData)
|
||||||
* @static
|
* @static
|
||||||
* @private
|
* @private
|
||||||
* @method buildLine
|
* @method buildLine
|
||||||
* @param graphicsData {Graphics} The graphics object to draw TODO-Alvin
|
* @param graphicsData {Graphics} The graphics object containing all the necessary properties
|
||||||
* @param webGLData {Object}
|
* @param webGLData {Object}
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLGraphics.buildLine = function(graphicsData, webGLData)
|
PIXI.WebGLGraphics.buildLine = function(graphicsData, webGLData)
|
||||||
|
@ -497,7 +496,7 @@ PIXI.WebGLGraphics.buildLine = function(graphicsData, webGLData)
|
||||||
* @static
|
* @static
|
||||||
* @private
|
* @private
|
||||||
* @method buildPoly
|
* @method buildPoly
|
||||||
* @param graphicsData {Graphics} The graphics object to draw TODO-Alvin
|
* @param graphicsData {Graphics} The graphics object containing all the necessary properties
|
||||||
* @param webGLData {Object}
|
* @param webGLData {Object}
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLGraphics.buildPoly = function(graphicsData, webGLData)
|
PIXI.WebGLGraphics.buildPoly = function(graphicsData, webGLData)
|
||||||
|
|
|
@ -61,7 +61,7 @@ PIXI.WebGLMaskManager.prototype.pushMask = function(maskData, renderSession)
|
||||||
* Removes the last filter from the filter stack and doesn't return it
|
* Removes the last filter from the filter stack and doesn't return it
|
||||||
* @method popMask
|
* @method popMask
|
||||||
*
|
*
|
||||||
* @param renderSession {RenderSession} TODO-Alvin
|
* @param renderSession {RenderSession} an object containing all the useful parameters
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLMaskManager.prototype.popMask = function(renderSession)
|
PIXI.WebGLMaskManager.prototype.popMask = function(renderSession)
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@ PIXI.WebGLMaskManager.prototype.popMask = function(renderSession)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO-Alvin
|
* Destroys the mask stack
|
||||||
* @method destroy
|
* @method destroy
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLMaskManager.prototype.destroy = function()
|
PIXI.WebGLMaskManager.prototype.destroy = function()
|
||||||
|
|
|
@ -50,9 +50,9 @@ PIXI.WebGLShaderManager.prototype.setContext = function(gl)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialises the context and the properties
|
* Takes the attributes given in parameters
|
||||||
* @method setAttribs
|
* @method setAttribs
|
||||||
* @param attribs {Array} TODO-Alvin
|
* @param attribs {Array} attribs
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLShaderManager.prototype.setAttribs = function(attribs)
|
PIXI.WebGLShaderManager.prototype.setAttribs = function(attribs)
|
||||||
{
|
{
|
||||||
|
@ -91,12 +91,11 @@ PIXI.WebGLShaderManager.prototype.setAttribs = function(attribs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(this.tempAttribState)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO-Alvin
|
* Sets-up the given shader
|
||||||
|
*
|
||||||
* @method activateShader
|
* @method activateShader
|
||||||
* @param shader {Object} the shader that is going to be activated
|
* @param shader {Object} the shader that is going to be activated
|
||||||
*/
|
*/
|
||||||
|
@ -105,11 +104,9 @@ PIXI.WebGLShaderManager.prototype.activateShader = function(shader)
|
||||||
//if(this.currentShader == shader)return;
|
//if(this.currentShader == shader)return;
|
||||||
|
|
||||||
this.currentShader = shader;
|
this.currentShader = shader;
|
||||||
// console.log(shader.program)
|
|
||||||
this.gl.useProgram(shader.program);
|
this.gl.useProgram(shader.program);
|
||||||
this.setAttribs(shader.attributes);
|
this.setAttribs(shader.attributes);
|
||||||
|
|
||||||
// console.log(shader.attributes)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @author Mat Groves http://matgroves.com/ @Doormat23
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO-Alvin ???
|
// TODO Alvin and Mat
|
||||||
// Should we eventually create a Utils class ?
|
// Should we eventually create a Utils class ?
|
||||||
// Or just move this file to the pixi.js file ?
|
// Or just move this file to the pixi.js file ?
|
||||||
PIXI.initDefaultShaders = function()
|
PIXI.initDefaultShaders = function()
|
||||||
|
@ -40,7 +40,6 @@ PIXI._CompileShader = function(gl, shaderSrc, shaderType)
|
||||||
|
|
||||||
PIXI.compileProgram = function(gl, vertexSrc, fragmentSrc)
|
PIXI.compileProgram = function(gl, vertexSrc, fragmentSrc)
|
||||||
{
|
{
|
||||||
//var gl = PIXI.gl;
|
|
||||||
var fragmentShader = PIXI.CompileFragmentShader(gl, fragmentSrc);
|
var fragmentShader = PIXI.CompileFragmentShader(gl, fragmentSrc);
|
||||||
var vertexShader = PIXI.CompileVertexShader(gl, vertexSrc);
|
var vertexShader = PIXI.CompileVertexShader(gl, vertexSrc);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ PIXI.WebGLSpriteBatch = function(gl)
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO-Alvin
|
*
|
||||||
*
|
*
|
||||||
* @property vertSize
|
* @property vertSize
|
||||||
* @type Number
|
* @type Number
|
||||||
|
@ -28,7 +28,7 @@ PIXI.WebGLSpriteBatch = function(gl)
|
||||||
this.vertSize = 6;
|
this.vertSize = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO-Alvin
|
* The number of images in the SpriteBatch before it flushes
|
||||||
* @property size
|
* @property size
|
||||||
* @type Number
|
* @type Number
|
||||||
*/
|
*/
|
||||||
|
@ -133,7 +133,7 @@ PIXI.WebGLSpriteBatch.prototype.end = function()
|
||||||
*
|
*
|
||||||
* @method render
|
* @method render
|
||||||
*
|
*
|
||||||
* @param sprite {Sprite} the sprite to render TODO-Alvin
|
* @param sprite {Sprite} the sprite to render when using this spritebatch
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLSpriteBatch.prototype.render = function(sprite)
|
PIXI.WebGLSpriteBatch.prototype.render = function(sprite)
|
||||||
{
|
{
|
||||||
|
@ -249,10 +249,10 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Renders a tilingSprite using the spriteBatch
|
||||||
* @method renderTilingSprite
|
* @method renderTilingSprite
|
||||||
*
|
*
|
||||||
* @param sprite {TilingSprite} the sprite to render TODO-Alvin
|
* @param sprite {TilingSprite} the tilingSprite to render
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
|
PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
|
||||||
{
|
{
|
||||||
|
@ -374,9 +374,9 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Renders the content and empties the current batch
|
||||||
*
|
*
|
||||||
* @method flush TODO-Alvin
|
* @method flush
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLSpriteBatch.prototype.flush = function()
|
PIXI.WebGLSpriteBatch.prototype.flush = function()
|
||||||
|
@ -459,11 +459,10 @@ PIXI.WebGLSpriteBatch.prototype.start = function()
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Sets-up the given blendMode from WebGL's point of view
|
||||||
* @method setBlendMode
|
* @method setBlendMode
|
||||||
*
|
*
|
||||||
* @param blendMode {Number} the blendMode, should be a Pixi const, such as PIXI.BlendModes.ADD
|
* @param blendMode {Number} the blendMode, should be a Pixi const, such as PIXI.BlendModes.ADD
|
||||||
* TODO-Alvin
|
|
||||||
*/
|
*/
|
||||||
PIXI.WebGLSpriteBatch.prototype.setBlendMode = function(blendMode)
|
PIXI.WebGLSpriteBatch.prototype.setBlendMode = function(blendMode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* http://www.bmglyph.com/ for mac.
|
* http://www.bmglyph.com/ for mac.
|
||||||
*
|
*
|
||||||
* @class BitmapText
|
* @class BitmapText
|
||||||
* @extends SpriteBatch
|
* @extends DisplayObjectContainer
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param text {String} The copy that you would like the text to display
|
* @param text {String} The copy that you would like the text to display
|
||||||
* @param style {Object} The style parameters
|
* @param style {Object} The style parameters
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
PIXI.BitmapText = function(text, style)
|
PIXI.BitmapText = function(text, style)
|
||||||
{
|
{
|
||||||
PIXI.SpriteBatch.call(this);
|
PIXI.DisplayObjectContainer.call(this);
|
||||||
|
|
||||||
this._pool = [];
|
this._pool = [];
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ PIXI.BitmapText = function(text, style)
|
||||||
};
|
};
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
PIXI.BitmapText.prototype = Object.create(PIXI.SpriteBatch.prototype);
|
PIXI.BitmapText.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
|
||||||
PIXI.BitmapText.prototype.constructor = PIXI.BitmapText;
|
PIXI.BitmapText.prototype.constructor = PIXI.BitmapText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,7 +190,7 @@ PIXI.BitmapText.prototype.updateTransform = function()
|
||||||
this.dirty = false;
|
this.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PIXI.SpriteBatch.prototype.updateTransform.call(this);
|
PIXI.DisplayObjectContainer.prototype.updateTransform.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
PIXI.BitmapText.fonts = {};
|
PIXI.BitmapText.fonts = {};
|
||||||
|
|
|
@ -24,21 +24,45 @@
|
||||||
doc.addChild(sprite);
|
doc.addChild(sprite);
|
||||||
renderTexture.render(doc); // Renders to center of renderTexture
|
renderTexture.render(doc); // Renders to center of renderTexture
|
||||||
|
|
||||||
@class RenderTexture
|
* @class RenderTexture
|
||||||
@extends Texture
|
* @extends Texture
|
||||||
@constructor
|
* @constructor
|
||||||
@param width {Number} The width of the render texture
|
* @param width {Number} The width of the render texture
|
||||||
@param height {Number} The height of the render texture
|
* @param height {Number} The height of the render texture
|
||||||
*/
|
*/
|
||||||
PIXI.RenderTexture = function(width, height, renderer)
|
PIXI.RenderTexture = function(width, height, renderer)
|
||||||
{
|
{
|
||||||
PIXI.EventTarget.call( this );
|
PIXI.EventTarget.call( this );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The with of the render texture
|
||||||
|
*
|
||||||
|
* @property width
|
||||||
|
* @type Number
|
||||||
|
*/
|
||||||
this.width = width || 100;
|
this.width = width || 100;
|
||||||
|
/**
|
||||||
|
* The height of the render texture
|
||||||
|
*
|
||||||
|
* @property height
|
||||||
|
* @type Number
|
||||||
|
*/
|
||||||
this.height = height || 100;
|
this.height = height || 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The framing rectangle of the render texture
|
||||||
|
*
|
||||||
|
* @property frame
|
||||||
|
* @type Rectangle
|
||||||
|
*/
|
||||||
this.frame = new PIXI.Rectangle(0, 0, this.width, this.height);
|
this.frame = new PIXI.Rectangle(0, 0, this.width, this.height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base texture object that this texture uses
|
||||||
|
*
|
||||||
|
* @property baseTexture
|
||||||
|
* @type BaseTexture
|
||||||
|
*/
|
||||||
this.baseTexture = new PIXI.BaseTexture();
|
this.baseTexture = new PIXI.BaseTexture();
|
||||||
this.baseTexture.width = this.width;
|
this.baseTexture.width = this.width;
|
||||||
this.baseTexture.height = this.height;
|
this.baseTexture.height = this.height;
|
||||||
|
@ -71,7 +95,7 @@ PIXI.RenderTexture = function(width, height, renderer)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PIXI.RenderTexture.prototype = Object.create( PIXI.Texture.prototype );
|
PIXI.RenderTexture.prototype = Object.create(PIXI.Texture.prototype);
|
||||||
PIXI.RenderTexture.prototype.constructor = PIXI.RenderTexture;
|
PIXI.RenderTexture.prototype.constructor = PIXI.RenderTexture;
|
||||||
|
|
||||||
PIXI.RenderTexture.prototype.resize = function(width, height)
|
PIXI.RenderTexture.prototype.resize = function(width, height)
|
||||||
|
@ -161,7 +185,6 @@ PIXI.RenderTexture.prototype.renderWebGL = function(displayObject, position, cle
|
||||||
*/
|
*/
|
||||||
PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, position, clear)
|
PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, position, clear)
|
||||||
{
|
{
|
||||||
//console.log("!!")
|
|
||||||
var children = displayObject.children;
|
var children = displayObject.children;
|
||||||
|
|
||||||
displayObject.worldTransform = PIXI.RenderTexture.tempMatrix;
|
displayObject.worldTransform = PIXI.RenderTexture.tempMatrix;
|
||||||
|
@ -186,5 +209,4 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, position, cl
|
||||||
context.setTransform(1,0,0,1,0,0);
|
context.setTransform(1,0,0,1,0,0);
|
||||||
};
|
};
|
||||||
|
|
||||||
PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
|
PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
|
||||||
|
|
|
@ -31,7 +31,7 @@ PIXI.Texture = function(baseTexture, frame)
|
||||||
baseTexture = baseTexture.baseTexture;
|
baseTexture = baseTexture.baseTexture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base texture of this texture
|
* The base texture of that this texture uses
|
||||||
*
|
*
|
||||||
* @property baseTexture
|
* @property baseTexture
|
||||||
* @type BaseTexture
|
* @type BaseTexture
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
* @static
|
* @static
|
||||||
* @param width=800 {Number} the width of the renderers view
|
* @param width=800 {Number} the width of the renderers view
|
||||||
* @param height=600 {Number} the height of the renderers view
|
* @param height=600 {Number} the height of the renderers view
|
||||||
* @param [view] {Canvas} the canvas to use as a view, optional
|
* @param [view] {Canvas} the canvas to use as a view, optional
|
||||||
* @param [transparent=false] {Boolean} the transparency of the render view, default false
|
|
||||||
* @param [antialias=false] {Boolean} sets antialias (only applicable in webGL chrome at the moment)
|
* @param [antialias=false] {Boolean} sets antialias (only applicable in webGL chrome at the moment)
|
||||||
|
* @param [transparent=false] {Boolean} the transparency of the render view, default false
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
PIXI.autoDetectRenderer = function(width, height, view, transparent, antialias)
|
PIXI.autoDetectRenderer = function(width, height, view,antialias,transparent)
|
||||||
{
|
{
|
||||||
if(!width)width = 800;
|
if(!width)width = 800;
|
||||||
if(!height)height = 600;
|
if(!height)height = 600;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue