mirror of https://github.com/axmolengine/axmol.git
issue #1454: Removed some duplicated resources files.
This commit is contained in:
parent
9d75f33b7e
commit
dd8c993581
|
@ -1 +0,0 @@
|
|||
5fe89fb5bd58cedf13b0363f97b20e3ea7ff255d
|
|
@ -1 +0,0 @@
|
|||
8957affa037faf5669fc5fdedb51eb70abc583bb
|
|
@ -1 +0,0 @@
|
|||
d04c7f9966964a7f6384212b434d088473703ae5
|
Binary file not shown.
Before Width: | Height: | Size: 60 KiB |
|
@ -0,0 +1,517 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
var TAG_BASE = 2000;
|
||||
var MAX_NODES = 1500;
|
||||
var NODES_INCREASE = 50;
|
||||
var s_nCurCase = 0;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// NodeChildrenMenuLayer
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var NodeChildrenMenuLayer = PerformBasicLayer.extend({
|
||||
_maxCases:4,
|
||||
showCurrentTest:function () {
|
||||
var nodes = (this.getParent()).getQuantityOfNodes();
|
||||
var scene = null;
|
||||
switch (this._curCase) {
|
||||
case 0:
|
||||
scene = new IterateSpriteSheetCArray();
|
||||
break;
|
||||
case 1:
|
||||
scene = new AddSpriteSheet();
|
||||
break;
|
||||
case 2:
|
||||
scene = new RemoveSpriteSheet();
|
||||
break;
|
||||
case 3:
|
||||
scene = new ReorderSpriteSheet();
|
||||
break;
|
||||
}
|
||||
s_nCurCase = this._curCase;
|
||||
|
||||
if (scene) {
|
||||
scene.initWithQuantityOfNodes(nodes);
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// NodeChildrenMainScene
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var NodeChildrenMainScene = cc.Scene.extend({
|
||||
_lastRenderedCount:null,
|
||||
_quantityOfNodes:null,
|
||||
_currentQuantityOfNodes:null,
|
||||
|
||||
ctor:function () {
|
||||
var parent = new cc.Scene();
|
||||
__associateObjWithNative(this, parent);
|
||||
this.init();
|
||||
},
|
||||
|
||||
initWithQuantityOfNodes:function (nodes) {
|
||||
//srand(time());
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
|
||||
// Title
|
||||
var label = cc.LabelTTF.create(this.title(), "Arial", 40);
|
||||
this.addChild(label, 1);
|
||||
label.setPosition(cc.p(s.width / 2, s.height - 32));
|
||||
label.setColor(cc.c3b(255, 255, 40));
|
||||
|
||||
// Subtitle
|
||||
var strSubTitle = this.subtitle();
|
||||
if (strSubTitle.length) {
|
||||
var l = cc.LabelTTF.create(strSubTitle, "Thonburi", 16);
|
||||
this.addChild(l, 1);
|
||||
l.setPosition(cc.p(s.width / 2, s.height - 80));
|
||||
}
|
||||
|
||||
this._lastRenderedCount = 0;
|
||||
this._currentQuantityOfNodes = 0;
|
||||
this._quantityOfNodes = nodes;
|
||||
|
||||
cc.MenuItemFont.setFontSize(65);
|
||||
var that = this;
|
||||
var decrease = cc.MenuItemFont.create(" - ", this, this.onDecrease);
|
||||
decrease.setColor(cc.c3b(0, 200, 20));
|
||||
var increase = cc.MenuItemFont.create(" + ", this, this.onIncrease);
|
||||
increase.setColor(cc.c3b(0, 200, 20));
|
||||
|
||||
var menu = cc.Menu.create(decrease, increase);
|
||||
menu.alignItemsHorizontally();
|
||||
menu.setPosition(cc.p(s.width / 2, s.height / 2 + 15));
|
||||
this.addChild(menu, 1);
|
||||
|
||||
var infoLabel = cc.LabelTTF.create("0 nodes", "Marker Felt", 30);
|
||||
infoLabel.setColor(cc.c3b(0, 200, 20));
|
||||
infoLabel.setPosition(cc.p(s.width / 2, s.height / 2 - 15));
|
||||
this.addChild(infoLabel, 1, TAG_INFO_LAYER);
|
||||
|
||||
var menu = new NodeChildrenMenuLayer(true, 4, s_nCurCase);
|
||||
this.addChild(menu);
|
||||
|
||||
this.updateQuantityLabel();
|
||||
this.updateQuantityOfNodes();
|
||||
},
|
||||
title:function () {
|
||||
return "No title";
|
||||
},
|
||||
subtitle:function () {
|
||||
return "";
|
||||
},
|
||||
updateQuantityOfNodes:function () {
|
||||
|
||||
},
|
||||
onDecrease:function (sender) {
|
||||
this._quantityOfNodes -= NODES_INCREASE;
|
||||
if (this._quantityOfNodes < 0) {
|
||||
this._quantityOfNodes = 0;
|
||||
}
|
||||
|
||||
this.updateQuantityLabel();
|
||||
this.updateQuantityOfNodes();
|
||||
},
|
||||
onIncrease:function (sender) {
|
||||
this._quantityOfNodes += NODES_INCREASE;
|
||||
if (this._quantityOfNodes > MAX_NODES) {
|
||||
this._quantityOfNodes = MAX_NODES
|
||||
}
|
||||
|
||||
this.updateQuantityLabel();
|
||||
this.updateQuantityOfNodes();
|
||||
},
|
||||
updateQuantityLabel:function () {
|
||||
if (this._quantityOfNodes != this._lastRenderedCount) {
|
||||
var infoLabel = this.getChildByTag(TAG_INFO_LAYER);
|
||||
var str = this._quantityOfNodes + " nodes";
|
||||
infoLabel.setString(str);
|
||||
|
||||
this._lastRenderedCount = this._quantityOfNodes;
|
||||
}
|
||||
},
|
||||
getQuantityOfNodes:function () {
|
||||
return this._quantityOfNodes;
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// IterateSpriteSheet
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var IterateSpriteSheet = NodeChildrenMainScene.extend({
|
||||
_batchNode:null,
|
||||
_profilingTimer:null,
|
||||
ctor:function () {
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
this._profilingTimer = new cc.ProfilingTimer();
|
||||
}
|
||||
},
|
||||
updateQuantityOfNodes:function () {
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
|
||||
// increase nodes
|
||||
if (this._currentQuantityOfNodes < this._quantityOfNodes) {
|
||||
for (var i = 0; i < (this._quantityOfNodes - this._currentQuantityOfNodes); i++) {
|
||||
var sprite = cc.Sprite.createWithTexture(this._batchNode.getTexture(), cc.rect(0, 0, 32, 32));
|
||||
this._batchNode.addChild(sprite);
|
||||
sprite.setPosition(cc.p(cc.RANDOM_0_1() * s.width, cc.RANDOM_0_1() * s.height));
|
||||
}
|
||||
}
|
||||
|
||||
// decrease nodes
|
||||
else if (this._currentQuantityOfNodes > this._quantityOfNodes) {
|
||||
for (var i = 0; i < (this._currentQuantityOfNodes - this._quantityOfNodes); i++) {
|
||||
var index = this._currentQuantityOfNodes - i - 1;
|
||||
this._batchNode.removeChildAtIndex(index, true);
|
||||
}
|
||||
}
|
||||
|
||||
this._currentQuantityOfNodes = this._quantityOfNodes;
|
||||
},
|
||||
initWithQuantityOfNodes:function (nodes) {
|
||||
this._batchNode = cc.SpriteBatchNode.create("Images/spritesheet1.png");
|
||||
this.addChild(this._batchNode);
|
||||
|
||||
this._super(nodes);
|
||||
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
this._profilingTimer = cc.Profiler.timerWithName(this.profilerName(), this);
|
||||
}
|
||||
this.scheduleUpdate();
|
||||
},
|
||||
update:function (dt) {
|
||||
},
|
||||
profilerName:function () {
|
||||
return "none";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// IterateSpriteSheetFastEnum
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var IterateSpriteSheetFastEnum = IterateSpriteSheet.extend({
|
||||
update:function (dt) {
|
||||
// iterate using fast enumeration protocol
|
||||
var children = this._batchNode.getChildren();
|
||||
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
cc.ProfilingBeginTimingBlock(this._profilingTimer);
|
||||
}
|
||||
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var sprite = children[i];
|
||||
sprite.setVisible(false);
|
||||
}
|
||||
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
cc.ProfilingEndTimingBlock(this._profilingTimer);
|
||||
}
|
||||
},
|
||||
|
||||
title:function () {
|
||||
return "A - Iterate SpriteSheet";
|
||||
},
|
||||
subtitle:function () {
|
||||
return "Iterate children using Fast Enum API. See console";
|
||||
},
|
||||
profilerName:function () {
|
||||
return "iter fast enum";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// IterateSpriteSheetCArray
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var IterateSpriteSheetCArray = IterateSpriteSheet.extend({
|
||||
update:function (dt) {
|
||||
// iterate using fast enumeration protocol
|
||||
var children = this._batchNode.getChildren();
|
||||
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
cc.ProfilingBeginTimingBlock(this._profilingTimer);
|
||||
}
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var sprite = children[i];
|
||||
sprite.setVisible(false);
|
||||
}
|
||||
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
cc.ProfilingEndTimingBlock(this._profilingTimer);
|
||||
}
|
||||
},
|
||||
|
||||
title:function () {
|
||||
return "B - Iterate SpriteSheet";
|
||||
},
|
||||
subtitle:function () {
|
||||
return "Iterate children using Array API. See console";
|
||||
},
|
||||
profilerName:function () {
|
||||
return "iter c-array";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// AddRemoveSpriteSheet
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var AddRemoveSpriteSheet = NodeChildrenMainScene.extend({
|
||||
_batchNode:null,
|
||||
ctor:function () {
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
this._profilingTimer = new cc.ProfilingTimer();
|
||||
}
|
||||
},
|
||||
updateQuantityOfNodes:function () {
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
|
||||
// increase nodes
|
||||
if (this._currentQuantityOfNodes < this._quantityOfNodes) {
|
||||
for (var i = 0; i < (this._quantityOfNodes - this._currentQuantityOfNodes); i++) {
|
||||
var sprite = cc.Sprite.createWithTexture(this._batchNode.getTexture(), cc.rect(0, 0, 32, 32));
|
||||
this._batchNode.addChild(sprite);
|
||||
sprite.setPosition(cc.p(cc.RANDOM_0_1() * s.width, cc.RANDOM_0_1() * s.height));
|
||||
sprite.setVisible(false);
|
||||
}
|
||||
}
|
||||
// decrease nodes
|
||||
else if (this._currentQuantityOfNodes > this._quantityOfNodes) {
|
||||
for (var i = 0; i < (this._currentQuantityOfNodes - this._quantityOfNodes); i++) {
|
||||
var index = this._currentQuantityOfNodes - i - 1;
|
||||
this._batchNode.removeChildAtIndex(index, true);
|
||||
}
|
||||
}
|
||||
|
||||
this._currentQuantityOfNodes = this._quantityOfNodes;
|
||||
},
|
||||
initWithQuantityOfNodes:function (nodes) {
|
||||
this._batchNode = cc.SpriteBatchNode.create("Images/spritesheet1.png");
|
||||
this.addChild(this._batchNode);
|
||||
|
||||
this._super(nodes);
|
||||
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
this._profilingTimer = cc.Profiler.timerWithName(this.profilerName(), this);
|
||||
}
|
||||
|
||||
this.scheduleUpdate();
|
||||
},
|
||||
update:function (dt) {
|
||||
},
|
||||
profilerName:function () {
|
||||
return "none";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// AddSpriteSheet
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var AddSpriteSheet = AddRemoveSpriteSheet.extend({
|
||||
update:function (dt) {
|
||||
// reset seed
|
||||
//srandom(0);
|
||||
|
||||
// 15 percent
|
||||
var totalToAdd = this._currentQuantityOfNodes * 0.15;
|
||||
|
||||
if (totalToAdd > 0) {
|
||||
var sprites = [];
|
||||
var zs = [];
|
||||
|
||||
// Don't include the sprite creation time and random as part of the profiling
|
||||
for (var i = 0; i < totalToAdd; i++) {
|
||||
var sprite = cc.Sprite.createWithTexture(this._batchNode.getTexture(), cc.rect(0, 0, 32, 32));
|
||||
sprites.push(sprite);
|
||||
zs[i] = cc.RANDOM_MINUS1_1() * 50;
|
||||
}
|
||||
|
||||
// add them with random Z (very important!)
|
||||
if (cc.ENABLE_PROFILERS)
|
||||
cc.ProfilingBeginTimingBlock(this._profilingTimer);
|
||||
}
|
||||
|
||||
for (var i = 0; i < totalToAdd; i++) {
|
||||
this._batchNode.addChild(sprites[i], zs[i], TAG_BASE + i);
|
||||
}
|
||||
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
cc.ProfilingEndTimingBlock(this._profilingTimer);
|
||||
}
|
||||
|
||||
// remove them
|
||||
for (var i = 0; i < totalToAdd; i++) {
|
||||
this._batchNode.removeChildByTag(TAG_BASE + i, true);
|
||||
}
|
||||
|
||||
delete zs;
|
||||
|
||||
},
|
||||
title:function () {
|
||||
return "C - Add to spritesheet";
|
||||
},
|
||||
subtitle:function () {
|
||||
return "Adds %10 of total sprites with random z. See console";
|
||||
},
|
||||
profilerName:function () {
|
||||
return "add sprites";
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// RemoveSpriteSheet
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var RemoveSpriteSheet = AddRemoveSpriteSheet.extend({
|
||||
update:function (dt) {
|
||||
//srandom(0);
|
||||
|
||||
// 15 percent
|
||||
var totalToAdd = this._currentQuantityOfNodes * 0.15;
|
||||
|
||||
if (totalToAdd > 0) {
|
||||
var sprites = [];
|
||||
|
||||
// Don't include the sprite creation time as part of the profiling
|
||||
for (var i = 0; i < totalToAdd; i++) {
|
||||
var sprite = cc.Sprite.createWithTexture(this._batchNode.getTexture(), cc.rect(0, 0, 32, 32));
|
||||
sprites.push(sprite);
|
||||
}
|
||||
|
||||
// add them with random Z (very important!)
|
||||
for (var i = 0; i < totalToAdd; i++) {
|
||||
this._batchNode.addChild(sprites[i], cc.RANDOM_MINUS1_1() * 50, TAG_BASE + i);
|
||||
}
|
||||
|
||||
// remove them
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
cc.ProfilingBeginTimingBlock(this._profilingTimer);
|
||||
}
|
||||
|
||||
for (var i = 0; i < totalToAdd; i++) {
|
||||
this._batchNode.removeChildByTag(TAG_BASE + i, true);
|
||||
}
|
||||
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
cc.ProfilingEndTimingBlock(this._profilingTimer);
|
||||
}
|
||||
}
|
||||
},
|
||||
title:function () {
|
||||
return "D - Del from spritesheet";
|
||||
},
|
||||
subtitle:function () {
|
||||
return "Remove %10 of total sprites placed randomly. See console";
|
||||
},
|
||||
profilerName:function () {
|
||||
return "remove sprites";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// ReorderSpriteSheet
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var ReorderSpriteSheet = AddRemoveSpriteSheet.extend({
|
||||
|
||||
update:function (dt) {
|
||||
//srandom(0);
|
||||
|
||||
// 15 percent
|
||||
var totalToAdd = this._currentQuantityOfNodes * 0.15;
|
||||
|
||||
if (totalToAdd > 0) {
|
||||
var sprites = [];
|
||||
|
||||
// Don't include the sprite creation time as part of the profiling
|
||||
for (var i = 0; i < totalToAdd; i++) {
|
||||
var sprite = cc.Sprite.createWithTexture(this._batchNode.getTexture(), cc.rect(0, 0, 32, 32));
|
||||
sprites.push(sprite);
|
||||
}
|
||||
|
||||
// add them with random Z (very important!)
|
||||
for (var i = 0; i < totalToAdd; i++) {
|
||||
this._batchNode.addChild(sprites[i], cc.RANDOM_MINUS1_1() * 50, TAG_BASE + i);
|
||||
}
|
||||
|
||||
// [this._batchNode sortAllChildren];
|
||||
|
||||
// reorder them
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
cc.ProfilingBeginTimingBlock(this._profilingTimer);
|
||||
}
|
||||
|
||||
for (var i = 0; i < totalToAdd; i++) {
|
||||
var node = this._batchNode.getChildren()[i];
|
||||
;
|
||||
this._batchNode.reorderChild(node, cc.RANDOM_MINUS1_1() * 50);
|
||||
}
|
||||
if (cc.ENABLE_PROFILERS) {
|
||||
cc.ProfilingEndTimingBlock(this._profilingTimer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// remove them
|
||||
for (var i = 0; i < totalToAdd; i++) {
|
||||
this._batchNode.removeChildByTag(TAG_BASE + i, true);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
title:function () {
|
||||
return "E - Reorder from spritesheet";
|
||||
},
|
||||
subtitle:function () {
|
||||
return "Reorder %10 of total sprites placed randomly. See console";
|
||||
},
|
||||
profilerName:function () {
|
||||
return "reorder sprites";
|
||||
}
|
||||
});
|
||||
|
||||
function runNodeChildrenTest() {
|
||||
var scene = new IterateSpriteSheetCArray();
|
||||
scene.initWithQuantityOfNodes(NODES_INCREASE);
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
}
|
|
@ -0,0 +1,515 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
var TAG_PARTICLE_SYSTEM = 3;
|
||||
var TAG_LABEL_ATLAS = 4;
|
||||
var MAX_PARTICLES = 1000;
|
||||
var PARTICLE_NODES_INCREASE = 50;
|
||||
var s_nParCurIdx = 0;
|
||||
var TAG_PARTICLE_MENU_LAYER = 1000;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// ParticleMenuLayer
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var ParticleMenuLayer = PerformBasicLayer.extend({
|
||||
_maxCases:4,
|
||||
showCurrentTest:function () {
|
||||
var scene = this.getParent();
|
||||
var subTest = scene.getSubTestNum();
|
||||
var parNum = scene.getParticlesNum();
|
||||
|
||||
var newScene = null;
|
||||
|
||||
switch (this._curCase) {
|
||||
case 0:
|
||||
newScene = new ParticlePerformTest1;
|
||||
break;
|
||||
case 1:
|
||||
newScene = new ParticlePerformTest2;
|
||||
break;
|
||||
case 2:
|
||||
newScene = new ParticlePerformTest3;
|
||||
break;
|
||||
case 3:
|
||||
newScene = new ParticlePerformTest4;
|
||||
break;
|
||||
}
|
||||
|
||||
s_nParCurIdx = this._curCase;
|
||||
if (newScene) {
|
||||
newScene.initWithSubTest(subTest, parNum);
|
||||
cc.Director.getInstance().replaceScene(newScene);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// ParticleMainScene
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var ParticleMainScene = cc.Scene.extend({
|
||||
_lastRenderedCount:null,
|
||||
_quantityParticles:null,
|
||||
_subtestNumber:null,
|
||||
initWithSubTest:function (asubtest, particles) {
|
||||
//srandom(0);
|
||||
|
||||
this._subtestNumber = asubtest;
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
|
||||
this._lastRenderedCount = 0;
|
||||
this._quantityParticles = particles;
|
||||
|
||||
cc.MenuItemFont.setFontSize(65);
|
||||
var decrease = cc.MenuItemFont.create(" - ", this, this.onDecrease);
|
||||
decrease.setColor(cc.c3b(0, 200, 20));
|
||||
var increase = cc.MenuItemFont.create(" + ", this, this.onIncrease);
|
||||
increase.setColor(cc.c3b(0, 200, 20));
|
||||
|
||||
var menu = cc.Menu.create(decrease, increase, null);
|
||||
menu.alignItemsHorizontally();
|
||||
menu.setPosition(cc.p(s.width / 2, s.height / 2 + 15));
|
||||
this.addChild(menu, 1);
|
||||
|
||||
var infoLabel = cc.LabelTTF.create("0 nodes", "Marker Felt", 30);
|
||||
infoLabel.setColor(cc.c3b(0, 200, 20));
|
||||
infoLabel.setPosition(cc.p(s.width / 2, s.height - 90));
|
||||
this.addChild(infoLabel, 1, TAG_INFO_LAYER);
|
||||
|
||||
// particles on stage
|
||||
//var labelAtlas = cc.LabelAtlas.create("0000", "res/Images/fps_images.png", 16, 24, '.');
|
||||
var labelAtlas = cc.LabelTTF.create("0000", "Marker Felt", 30);
|
||||
this.addChild(labelAtlas, 0, TAG_LABEL_ATLAS);
|
||||
labelAtlas.setPosition(cc.p(s.width - 66, 50));
|
||||
|
||||
// Next Prev Test
|
||||
var menu = new ParticleMenuLayer(true, 4, s_nParCurIdx);
|
||||
this.addChild(menu, 1, TAG_PARTICLE_MENU_LAYER);
|
||||
|
||||
// Sub Tests
|
||||
cc.MenuItemFont.setFontSize(40);
|
||||
var subMenu = cc.Menu.create(null);
|
||||
for (var i = 1; i <= 3; ++i) {
|
||||
var str = i.toString();
|
||||
var itemFont = cc.MenuItemFont.create(str, this, this.testNCallback);
|
||||
itemFont.setTag(i);
|
||||
subMenu.addChild(itemFont, 10);
|
||||
|
||||
if (i <= 1) {
|
||||
itemFont.setColor(cc.c3b(200, 20, 20));
|
||||
}
|
||||
else {
|
||||
itemFont.setColor(cc.c3b(0, 200, 20));
|
||||
}
|
||||
}
|
||||
subMenu.alignItemsHorizontally();
|
||||
subMenu.setPosition(cc.p(s.width / 2, 80));
|
||||
this.addChild(subMenu, 2);
|
||||
|
||||
var label = cc.LabelTTF.create(this.title(), "Arial", 40);
|
||||
this.addChild(label, 1);
|
||||
label.setPosition(cc.p(s.width / 2, s.height - 32));
|
||||
label.setColor(cc.c3b(255, 255, 40));
|
||||
|
||||
this.updateQuantityLabel();
|
||||
this.createParticleSystem();
|
||||
|
||||
this.schedule(this.step);
|
||||
},
|
||||
title:function () {
|
||||
return "No title";
|
||||
},
|
||||
|
||||
step:function (dt) {
|
||||
var atlas = this.getChildByTag(TAG_LABEL_ATLAS);
|
||||
var emitter = this.getChildByTag(TAG_PARTICLE_SYSTEM);
|
||||
|
||||
var str = emitter.getParticleCount();
|
||||
atlas.setString(str);
|
||||
},
|
||||
createParticleSystem:function () {
|
||||
var particleSystem = null;
|
||||
|
||||
/*
|
||||
* Tests:
|
||||
* 1 Quad Particle System using 32-bit textures (PNG)
|
||||
* 2: Quad Particle System using 16-bit textures (PNG)
|
||||
* 3: Quad Particle System using 8-bit textures (PNG)
|
||||
* 4: Quad Particle System using 4-bit textures (PVRTC)
|
||||
*/
|
||||
|
||||
this.removeChildByTag(TAG_PARTICLE_SYSTEM, true);
|
||||
|
||||
//todo
|
||||
// remove the "fire.png" from the TextureCache cache.
|
||||
var texture = cc.TextureCache.getInstance().addImage("res/Images/fire.png");
|
||||
cc.TextureCache.getInstance().removeTexture(texture);
|
||||
|
||||
particleSystem = new cc.ParticleSystemQuad();
|
||||
|
||||
switch (this._subtestNumber) {
|
||||
case 1:
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888);
|
||||
particleSystem.initWithTotalParticles(this._quantityParticles);
|
||||
particleSystem.setTexture(cc.TextureCache.getInstance().addImage("res/Images/fire.png"));
|
||||
break;
|
||||
case 2:
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444);
|
||||
particleSystem.initWithTotalParticles(this._quantityParticles);
|
||||
particleSystem.setTexture(cc.TextureCache.getInstance().addImage("res/Images/fire.png"));
|
||||
break;
|
||||
case 3:
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_2D_PIXEL_FORMAT_A8);
|
||||
particleSystem.initWithTotalParticles(this._quantityParticles);
|
||||
particleSystem.setTexture(cc.TextureCache.getInstance().addImage("res/Images/fire.png"));
|
||||
break;
|
||||
default:
|
||||
particleSystem = null;
|
||||
cc.log("Shall not happen!");
|
||||
break;
|
||||
}
|
||||
this.addChild(particleSystem, 0, TAG_PARTICLE_SYSTEM);
|
||||
|
||||
this.doTest();
|
||||
|
||||
// restore the default pixel format
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888);
|
||||
},
|
||||
onDecrease:function (sender) {
|
||||
this._quantityParticles -= PARTICLE_NODES_INCREASE;
|
||||
if (this._quantityParticles < 0)
|
||||
this._quantityParticles = 0;
|
||||
|
||||
this.updateQuantityLabel();
|
||||
this.createParticleSystem();
|
||||
},
|
||||
onIncrease:function (sender) {
|
||||
this._quantityParticles += PARTICLE_NODES_INCREASE;
|
||||
if (this._quantityParticles > MAX_PARTICLES) {
|
||||
this._quantityParticles = MAX_PARTICLES;
|
||||
}
|
||||
this.updateQuantityLabel();
|
||||
this.createParticleSystem();
|
||||
},
|
||||
testNCallback:function (sender) {
|
||||
this._subtestNumber = sender.getTag();
|
||||
var menu = this.getChildByTag(TAG_PARTICLE_MENU_LAYER);
|
||||
menu.restartCallback(sender);
|
||||
},
|
||||
updateQuantityLabel:function () {
|
||||
if (this._quantityParticles != this._lastRenderedCount) {
|
||||
var infoLabel = this.getChildByTag(TAG_INFO_LAYER);
|
||||
var str = this._quantityParticles + " particles";
|
||||
infoLabel.setString(str);
|
||||
|
||||
this._lastRenderedCount = this._quantityParticles;
|
||||
}
|
||||
},
|
||||
getSubTestNum:function () {
|
||||
return this._subtestNumber;
|
||||
},
|
||||
getParticlesNum:function () {
|
||||
return this._quantityParticles;
|
||||
},
|
||||
doTest:function () {
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// ParticlePerformTest1
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var ParticlePerformTest1 = ParticleMainScene.extend({
|
||||
|
||||
title:function () {
|
||||
return "A " + this._subtestNumber + " size=4";
|
||||
},
|
||||
doTest:function () {
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
var particleSystem = this.getChildByTag(TAG_PARTICLE_SYSTEM);
|
||||
|
||||
// duration
|
||||
particleSystem.setDuration(-1);
|
||||
|
||||
// gravity
|
||||
particleSystem.setGravity(cc.p(0, -90));
|
||||
|
||||
// angle
|
||||
particleSystem.setAngle(90);
|
||||
particleSystem.setAngleVar(0);
|
||||
|
||||
// radial
|
||||
particleSystem.setRadialAccel(0);
|
||||
particleSystem.setRadialAccelVar(0);
|
||||
|
||||
// speed of particles
|
||||
particleSystem.setSpeed(180);
|
||||
particleSystem.setSpeedVar(50);
|
||||
|
||||
// emitter position
|
||||
particleSystem.setPosition(cc.p(s.width / 2, 100));
|
||||
particleSystem.setPosVar(cc.p(s.width / 2, 0));
|
||||
|
||||
// life of particles
|
||||
particleSystem.setLife(2.0);
|
||||
particleSystem.setLifeVar(1);
|
||||
|
||||
// emits per frame
|
||||
particleSystem.setEmissionRate(particleSystem.getTotalParticles() / particleSystem.getLife());
|
||||
|
||||
// color of particles
|
||||
var startColor = new cc.Color4F(0.5, 0.5, 0.5, 1.0);
|
||||
particleSystem.setStartColor(startColor);
|
||||
|
||||
var startColorVar = new cc.Color4F(0.5, 0.5, 0.5, 1.0);
|
||||
particleSystem.setStartColorVar(startColorVar);
|
||||
|
||||
var endColor = new cc.Color4F(0.1, 0.1, 0.1, 0.2);
|
||||
particleSystem.setEndColor(endColor);
|
||||
|
||||
var endColorVar = new cc.Color4F(0.1, 0.1, 0.1, 0.2);
|
||||
particleSystem.setEndColorVar(endColorVar);
|
||||
|
||||
// size, in pixels
|
||||
particleSystem.setEndSize(4.0);
|
||||
particleSystem.setStartSize(4.0);
|
||||
particleSystem.setEndSizeVar(0);
|
||||
particleSystem.setStartSizeVar(0);
|
||||
|
||||
// additive
|
||||
particleSystem.setBlendAdditive(false);
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// ParticlePerformTest2
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var ParticlePerformTest2 = ParticleMainScene.extend({
|
||||
|
||||
title:function () {
|
||||
return "B " + this._subtestNumber + " size=8";
|
||||
},
|
||||
doTest:function () {
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
var particleSystem = this.getChildByTag(TAG_PARTICLE_SYSTEM);
|
||||
|
||||
// duration
|
||||
particleSystem.setDuration(-1);
|
||||
|
||||
// gravity
|
||||
particleSystem.setGravity(cc.p(0, -90));
|
||||
|
||||
// angle
|
||||
particleSystem.setAngle(90);
|
||||
particleSystem.setAngleVar(0);
|
||||
|
||||
// radial
|
||||
particleSystem.setRadialAccel(0);
|
||||
particleSystem.setRadialAccelVar(0);
|
||||
|
||||
// speed of particles
|
||||
particleSystem.setSpeed(180);
|
||||
particleSystem.setSpeedVar(50);
|
||||
|
||||
// emitter position
|
||||
particleSystem.setPosition(cc.p(s.width / 2, 100));
|
||||
particleSystem.setPosVar(cc.p(s.width / 2, 0));
|
||||
|
||||
// life of particles
|
||||
particleSystem.setLife(2.0);
|
||||
particleSystem.setLifeVar(1);
|
||||
|
||||
// emits per frame
|
||||
particleSystem.setEmissionRate(particleSystem.getTotalParticles() / particleSystem.getLife());
|
||||
|
||||
// color of particles
|
||||
var startColor = new cc.Color4F(0.5, 0.5, 0.5, 1.0);
|
||||
particleSystem.setStartColor(startColor);
|
||||
|
||||
var startColorVar = new cc.Color4F(0.5, 0.5, 0.5, 1.0);
|
||||
particleSystem.setStartColorVar(startColorVar);
|
||||
|
||||
var endColor = new cc.Color4F(0.1, 0.1, 0.1, 0.2);
|
||||
particleSystem.setEndColor(endColor);
|
||||
|
||||
var endColorVar = new cc.Color4F(0.1, 0.1, 0.1, 0.2);
|
||||
particleSystem.setEndColorVar(endColorVar);
|
||||
|
||||
// size, in pixels
|
||||
particleSystem.setEndSize(8.0);
|
||||
particleSystem.setStartSize(8.0);
|
||||
particleSystem.setEndSizeVar(0);
|
||||
particleSystem.setStartSizeVar(0);
|
||||
|
||||
// additive
|
||||
particleSystem.setBlendAdditive(false);
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// ParticlePerformTest3
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var ParticlePerformTest3 = ParticleMainScene.extend({
|
||||
|
||||
title:function () {
|
||||
return "C " + this._subtestNumber + " size=32";
|
||||
},
|
||||
doTest:function () {
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
var particleSystem = this.getChildByTag(TAG_PARTICLE_SYSTEM);
|
||||
|
||||
// duration
|
||||
particleSystem.setDuration(-1);
|
||||
|
||||
// gravity
|
||||
particleSystem.setGravity(cc.p(0, -90));
|
||||
|
||||
// angle
|
||||
particleSystem.setAngle(90);
|
||||
particleSystem.setAngleVar(0);
|
||||
|
||||
// radial
|
||||
particleSystem.setRadialAccel(0);
|
||||
particleSystem.setRadialAccelVar(0);
|
||||
|
||||
// speed of particles
|
||||
particleSystem.setSpeed(180);
|
||||
particleSystem.setSpeedVar(50);
|
||||
|
||||
// emitter position
|
||||
particleSystem.setPosition(cc.p(s.width / 2, 100));
|
||||
particleSystem.setPosVar(cc.p(s.width / 2, 0));
|
||||
|
||||
// life of particles
|
||||
particleSystem.setLife(2.0);
|
||||
particleSystem.setLifeVar(1);
|
||||
|
||||
// emits per frame
|
||||
particleSystem.setEmissionRate(particleSystem.getTotalParticles() / particleSystem.getLife());
|
||||
|
||||
// color of particles
|
||||
var startColor = new cc.Color4F(0.5, 0.5, 0.5, 1.0);
|
||||
particleSystem.setStartColor(startColor);
|
||||
|
||||
var startColorVar = new cc.Color4F(0.5, 0.5, 0.5, 1.0);
|
||||
particleSystem.setStartColorVar(startColorVar);
|
||||
|
||||
var endColor = new cc.Color4F(0.1, 0.1, 0.1, 0.2);
|
||||
particleSystem.setEndColor(endColor);
|
||||
|
||||
var endColorVar = new cc.Color4F(0.1, 0.1, 0.1, 0.2);
|
||||
particleSystem.setEndColorVar(endColorVar);
|
||||
|
||||
// size, in pixels
|
||||
particleSystem.setEndSize(32.0);
|
||||
particleSystem.setStartSize(32.0);
|
||||
particleSystem.setEndSizeVar(0);
|
||||
particleSystem.setStartSizeVar(0);
|
||||
|
||||
// additive
|
||||
particleSystem.setBlendAdditive(false);
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// ParticlePerformTest4
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var ParticlePerformTest4 = ParticleMainScene.extend({
|
||||
|
||||
title:function () {
|
||||
return "D " + this._subtestNumber + " size=64";
|
||||
},
|
||||
doTest:function () {
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
var particleSystem = this.getChildByTag(TAG_PARTICLE_SYSTEM);
|
||||
|
||||
// duration
|
||||
particleSystem.setDuration(-1);
|
||||
|
||||
// gravity
|
||||
particleSystem.setGravity(cc.p(0, -90));
|
||||
|
||||
// angle
|
||||
particleSystem.setAngle(90);
|
||||
particleSystem.setAngleVar(0);
|
||||
|
||||
// radial
|
||||
particleSystem.setRadialAccel(0);
|
||||
particleSystem.setRadialAccelVar(0);
|
||||
|
||||
// speed of particles
|
||||
particleSystem.setSpeed(180);
|
||||
particleSystem.setSpeedVar(50);
|
||||
|
||||
// emitter position
|
||||
particleSystem.setPosition(cc.p(s.width / 2, 100));
|
||||
particleSystem.setPosVar(cc.p(s.width / 2, 0));
|
||||
|
||||
// life of particles
|
||||
particleSystem.setLife(2.0);
|
||||
particleSystem.setLifeVar(1);
|
||||
|
||||
// emits per frame
|
||||
particleSystem.setEmissionRate(particleSystem.getTotalParticles() / particleSystem.getLife());
|
||||
|
||||
// color of particles
|
||||
var startColor = new cc.Color4F(0.5, 0.5, 0.5, 1.0);
|
||||
particleSystem.setStartColor(startColor);
|
||||
|
||||
var startColorVar = new cc.Color4F(0.5, 0.5, 0.5, 1.0);
|
||||
particleSystem.setStartColorVar(startColorVar);
|
||||
|
||||
var endColor = new cc.Color4F(0.1, 0.1, 0.1, 0.2);
|
||||
particleSystem.setEndColor(endColor);
|
||||
|
||||
var endColorVar = new cc.Color4F(0.1, 0.1, 0.1, 0.2);
|
||||
particleSystem.setEndColorVar(endColorVar);
|
||||
|
||||
// size, in pixels
|
||||
particleSystem.setEndSize(64.0);
|
||||
particleSystem.setStartSize(64.0);
|
||||
particleSystem.setEndSizeVar(0);
|
||||
particleSystem.setStartSizeVar(0);
|
||||
|
||||
// additive
|
||||
particleSystem.setBlendAdditive(false);
|
||||
}
|
||||
});
|
||||
|
||||
function runParticleTest() {
|
||||
var scene = new ParticlePerformTest1;
|
||||
scene.initWithSubTest(1, PARTICLE_NODES_INCREASE);
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
}
|
|
@ -0,0 +1,576 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
var MAX_SPRITES = 1000;
|
||||
var SPRITES_INCREASE = 50;
|
||||
|
||||
var TAG_INFO_LAYER = 1;
|
||||
var TAG_MAIN_LAYER = 2;
|
||||
var TAG_SPRITE_MENU_LAYER = (MAX_SPRITES + 1000);
|
||||
|
||||
var s_nSpriteCurCase = 0;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SubTest
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var SubTest = cc.Class.extend({
|
||||
_subtestNumber:null,
|
||||
_batchNode:null,
|
||||
_parent:null,
|
||||
removeByTag:function (tag) {
|
||||
switch (this._subtestNumber) {
|
||||
case 1:
|
||||
case 4:
|
||||
case 7:
|
||||
this._parent.removeChildByTag(tag + 100, true);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
case 8:
|
||||
case 9:
|
||||
this._batchNode.removeChildAtIndex(tag, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
createSpriteWithTag:function (tag) {
|
||||
// create
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_RGBA8888);
|
||||
|
||||
var sprite = null;
|
||||
switch (this._subtestNumber) {
|
||||
case 1:
|
||||
{
|
||||
sprite = cc.Sprite.create("Images/grossinis_sister1.png");
|
||||
this._parent.addChild(sprite, 0, tag + 100);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3:
|
||||
{
|
||||
sprite = cc.Sprite.createWithTexture(this._batchNode.getTexture(), cc.rect(0, 0, 52, 139));
|
||||
this._batchNode.addChild(sprite, 0, tag + 100);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
var idx = parseInt(cc.RANDOM_0_1() * 14) + 1;
|
||||
idx = idx < 10 ? "0" + idx : idx.toString();
|
||||
var str = "Images/grossini_dance_" + idx + ".png";
|
||||
sprite = cc.Sprite.create(str);
|
||||
this._parent.addChild(sprite, 0, tag + 100);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
case 6:
|
||||
{
|
||||
var idx = 0 | (cc.RANDOM_0_1() * 14);
|
||||
var x = (idx % 5) * 85;
|
||||
var y = (0 | (idx / 5)) * 121;
|
||||
sprite = cc.Sprite.createWithTexture(this._batchNode.getTexture(), cc.rect(x, y, 85, 121));
|
||||
this._batchNode.addChild(sprite, 0, tag + 100);
|
||||
break;
|
||||
}
|
||||
|
||||
case 7:
|
||||
{
|
||||
var y, x;
|
||||
var r = 0 | (cc.RANDOM_0_1() * 64);
|
||||
|
||||
y = parseInt(r / 8);
|
||||
x = parseInt(r % 8);
|
||||
|
||||
var str = "Images/sprites_test/sprite-" + x + "-" + y + ".png";
|
||||
sprite = cc.Sprite.create(str);
|
||||
this._parent.addChild(sprite, 0, tag + 100);
|
||||
break;
|
||||
}
|
||||
|
||||
case 8:
|
||||
case 9:
|
||||
{
|
||||
var y, x;
|
||||
var r = 0 | (cc.RANDOM_0_1() * 64);
|
||||
|
||||
y = (0 | (r / 8)) * 32;
|
||||
x = (r % 8) * 32;
|
||||
sprite = cc.Sprite.createWithTexture(this._batchNode.getTexture(), cc.rect(x, y, 32, 32));
|
||||
this._batchNode.addChild(sprite, 0, tag + 100);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_DEFAULT);
|
||||
|
||||
return sprite;
|
||||
},
|
||||
initWithSubTest:function (subTest, p) {
|
||||
this._subtestNumber = subTest;
|
||||
this._parent = p;
|
||||
this._batchNode = null;
|
||||
/*
|
||||
* Tests:
|
||||
* 1: 1 (32-bit) PNG sprite of 52 x 139
|
||||
* 2: 1 (32-bit) PNG Batch Node using 1 sprite of 52 x 139
|
||||
* 3: 1 (16-bit) PNG Batch Node using 1 sprite of 52 x 139
|
||||
* 4: 1 (4-bit) PVRTC Batch Node using 1 sprite of 52 x 139
|
||||
|
||||
* 5: 14 (32-bit) PNG sprites of 85 x 121 each
|
||||
* 6: 14 (32-bit) PNG Batch Node of 85 x 121 each
|
||||
* 7: 14 (16-bit) PNG Batch Node of 85 x 121 each
|
||||
* 8: 14 (4-bit) PVRTC Batch Node of 85 x 121 each
|
||||
|
||||
* 9: 64 (32-bit) sprites of 32 x 32 each
|
||||
*10: 64 (32-bit) PNG Batch Node of 32 x 32 each
|
||||
*11: 64 (16-bit) PNG Batch Node of 32 x 32 each
|
||||
*12: 64 (4-bit) PVRTC Batch Node of 32 x 32 each
|
||||
*/
|
||||
|
||||
// purge textures
|
||||
log("initWithSubTest 01");
|
||||
var mgr = cc.TextureCache.getInstance();
|
||||
log("initWithSubTest 02");
|
||||
// [mgr removeAllTextures];
|
||||
mgr.removeTexture(mgr.addImage("Images/grossinis_sister1.png"));
|
||||
mgr.removeTexture(mgr.addImage("Images/grossini_dance_atlas.png"));
|
||||
mgr.removeTexture(mgr.addImage("Images/spritesheet1.png"));
|
||||
log("initWithSubTest 03");
|
||||
switch (this._subtestNumber) {
|
||||
case 1:
|
||||
case 4:
|
||||
case 7:
|
||||
break;
|
||||
///
|
||||
case 2:
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_RGBA8888);
|
||||
this._batchNode = cc.SpriteBatchNode.create("Images/grossinis_sister1.png", 100);
|
||||
p.addChild(this._batchNode, 0);
|
||||
break;
|
||||
case 3:
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_RGBA4444);
|
||||
this._batchNode = cc.SpriteBatchNode.create("Images/grossinis_sister1.png", 100);
|
||||
p.addChild(this._batchNode, 0);
|
||||
break;
|
||||
|
||||
///
|
||||
case 5:
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_RGBA8888);
|
||||
this._batchNode = cc.SpriteBatchNode.create("Images/grossini_dance_atlas.png", 100);
|
||||
p.addChild(this._batchNode, 0);
|
||||
break;
|
||||
case 6:
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_RGBA4444);
|
||||
this._batchNode = cc.SpriteBatchNode.create("Images/grossini_dance_atlas.png", 100);
|
||||
p.addChild(this._batchNode, 0);
|
||||
break;
|
||||
|
||||
///
|
||||
case 8:
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_RGBA8888);
|
||||
this._batchNode = cc.SpriteBatchNode.create("Images/spritesheet1.png", 100);
|
||||
p.addChild(this._batchNode, 0);
|
||||
break;
|
||||
case 9:
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_RGBA4444);
|
||||
this._batchNode = cc.SpriteBatchNode.create("Images/spritesheet1.png", 100);
|
||||
p.addChild(this._batchNode, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
log("initWithSubTest 04");
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_DEFAULT);
|
||||
log("initWithSubTest 05");
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SpriteMenuLayer
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var SpriteMenuLayer = PerformBasicLayer.extend({
|
||||
_maxCases:7,
|
||||
showCurrentTest:function () {
|
||||
var scene = null;
|
||||
var preScene = this.getParent();
|
||||
var subTest = preScene.getSubTestNum();
|
||||
var nodes = preScene.getNodesNum();
|
||||
|
||||
switch (this._curCase) {
|
||||
case 0:
|
||||
scene = new SpritePerformTest1();
|
||||
break;
|
||||
case 1:
|
||||
scene = new SpritePerformTest2();
|
||||
break;
|
||||
case 2:
|
||||
scene = new SpritePerformTest3();
|
||||
break;
|
||||
case 3:
|
||||
scene = new SpritePerformTest4();
|
||||
break;
|
||||
case 4:
|
||||
scene = new SpritePerformTest5();
|
||||
break;
|
||||
case 5:
|
||||
scene = new SpritePerformTest6();
|
||||
break;
|
||||
case 6:
|
||||
scene = new SpritePerformTest7();
|
||||
break;
|
||||
}
|
||||
s_nSpriteCurCase = this._curCase;
|
||||
|
||||
if (scene) {
|
||||
scene.initWithSubTest(subTest, nodes);
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SpriteMainScene
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var SpriteMainScene = cc.Scene.extend({
|
||||
_lastRenderedCount:null,
|
||||
_quantityNodes:null,
|
||||
_subTest:null,
|
||||
_subtestNumber:1,
|
||||
|
||||
ctor:function () {
|
||||
var parent = new cc.Scene();
|
||||
__associateObjWithNative(this, parent);
|
||||
this.init();
|
||||
},
|
||||
|
||||
title:function () {
|
||||
return "No title";
|
||||
},
|
||||
initWithSubTest:function (asubtest, nodes) {
|
||||
this._subtestNumber = asubtest;
|
||||
this._subTest = new SubTest();
|
||||
this._subTest.initWithSubTest(asubtest, this);
|
||||
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
|
||||
this._lastRenderedCount = 0;
|
||||
this._quantityNodes = 0;
|
||||
|
||||
// add title label
|
||||
var label = cc.LabelTTF.create(this.title(), "Arial", 40);
|
||||
this.addChild(label, 1);
|
||||
label.setPosition(cc.p(s.width / 2, s.height - 32));
|
||||
label.setColor(cc.c3b(255, 255, 40));
|
||||
|
||||
cc.MenuItemFont.setFontSize(65);
|
||||
var decrease = cc.MenuItemFont.create(" - ", this, this.onDecrease);
|
||||
decrease.setColor(cc.c3b(0, 200, 20));
|
||||
var increase = cc.MenuItemFont.create(" + ", this, this.onIncrease);
|
||||
increase.setColor(cc.c3b(0, 200, 20));
|
||||
|
||||
var menu = cc.Menu.create(decrease, increase);
|
||||
menu.alignItemsHorizontally();
|
||||
|
||||
menu.setPosition(cc.p(s.width / 2, s.height - 65));
|
||||
this.addChild(menu, 1);
|
||||
|
||||
var infoLabel = cc.LabelTTF.create("0 nodes", "Marker Felt", 30);
|
||||
infoLabel.setColor(cc.c3b(0, 200, 20));
|
||||
infoLabel.setPosition(cc.p(s.width / 2, s.height - 90));
|
||||
this.addChild(infoLabel, 1, TAG_INFO_LAYER);
|
||||
|
||||
// add menu
|
||||
var menu = new SpriteMenuLayer(true, 7, s_nSpriteCurCase);
|
||||
this.addChild(menu, 1, TAG_SPRITE_MENU_LAYER);
|
||||
|
||||
// Sub Tests
|
||||
cc.MenuItemFont.setFontSize(32);
|
||||
var subMenu = cc.Menu.create();
|
||||
for (var i = 1; i <= 9; ++i) {
|
||||
var text = i.toString();
|
||||
var itemFont = cc.MenuItemFont.create(text, this, this.testNCallback);
|
||||
itemFont.setTag(i);
|
||||
subMenu.addChild(itemFont, 10);
|
||||
|
||||
if (i <= 3)
|
||||
itemFont.setColor(cc.c3b(200, 20, 20));
|
||||
else if (i <= 6)
|
||||
itemFont.setColor(cc.c3b(0, 200, 20));
|
||||
else
|
||||
itemFont.setColor(cc.c3b(0, 20, 200));
|
||||
}
|
||||
|
||||
subMenu.alignItemsHorizontally();
|
||||
subMenu.setPosition(cc.p(s.width / 2, 80));
|
||||
this.addChild(subMenu, 2);
|
||||
|
||||
while (this._quantityNodes < nodes) {
|
||||
this.onIncrease(this);
|
||||
}
|
||||
},
|
||||
updateNodes:function () {
|
||||
if (this._quantityNodes != this._lastRenderedCount) {
|
||||
var infoLabel = this.getChildByTag(TAG_INFO_LAYER);
|
||||
var str = this._quantityNodes + " nodes";
|
||||
infoLabel.setString(str);
|
||||
|
||||
this._lastRenderedCount = this._quantityNodes;
|
||||
}
|
||||
},
|
||||
testNCallback:function (sender) {
|
||||
this._subtestNumber = sender.getTag();
|
||||
var menu = this.getChildByTag(TAG_SPRITE_MENU_LAYER);
|
||||
menu.restartCallback(sender);
|
||||
},
|
||||
onIncrease:function (sender) {
|
||||
if (this._quantityNodes >= MAX_SPRITES)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < SPRITES_INCREASE; i++) {
|
||||
var sprite = this._subTest.createSpriteWithTag(this._quantityNodes);
|
||||
this.doTest(sprite);
|
||||
this._quantityNodes++;
|
||||
}
|
||||
|
||||
this.updateNodes();
|
||||
},
|
||||
onDecrease:function (sender) {
|
||||
if (this._quantityNodes <= 0)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < SPRITES_INCREASE; i++) {
|
||||
this._quantityNodes--;
|
||||
this._subTest.removeByTag(this._quantityNodes);
|
||||
}
|
||||
|
||||
this.updateNodes();
|
||||
},
|
||||
|
||||
doTest:function (sprite) {
|
||||
|
||||
},
|
||||
|
||||
getSubTestNum:function () {
|
||||
return this._subtestNumber
|
||||
},
|
||||
getNodesNum:function () {
|
||||
return this._quantityNodes
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// For test functions
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
function performanceActions(sprite) {
|
||||
var size = cc.Director.getInstance().getWinSize();
|
||||
sprite.setPosition(cc.p(parseInt(Math.random() * size.width), parseInt(Math.random() * size.height)));
|
||||
|
||||
var period = 0.5 + (Math.random() * 1000) / 500.0;
|
||||
var rot = cc.RotateBy.create(period, 360.0 * cc.RANDOM_0_1());
|
||||
var rot_back = rot.reverse();
|
||||
var permanentRotation = cc.RepeatForever.create(cc.Sequence.create(rot, rot_back));
|
||||
sprite.runAction(permanentRotation);
|
||||
|
||||
var growDuration = 0.5 + (Math.random() * 1000) / 500.0;
|
||||
var grow = cc.ScaleBy.create(growDuration, 0.5, 0.5);
|
||||
var permanentScaleLoop = cc.RepeatForever.create(cc.Sequence.create(grow, grow.reverse()));
|
||||
sprite.runAction(permanentScaleLoop);
|
||||
}
|
||||
|
||||
function performanceActions20(sprite) {
|
||||
var size = cc.Director.getInstance().getWinSize();
|
||||
if (cc.RANDOM_0_1() < 0.2)
|
||||
sprite.setPosition(cc.p(parseInt(Math.random() * size.width), parseInt(Math.random() * size.height)));
|
||||
else
|
||||
sprite.setPosition(cc.p(-1000, -1000));
|
||||
|
||||
var period = 0.5 + (Math.random() * 1000) / 500.0;
|
||||
var rot = cc.RotateBy.create(period, 360.0 * cc.RANDOM_0_1());
|
||||
var rot_back = rot.reverse();
|
||||
var permanentRotation = cc.RepeatForever.create(cc.Sequence.create(rot, rot_back));
|
||||
sprite.runAction(permanentRotation);
|
||||
|
||||
var growDuration = 0.5 + (Math.random() * 1000) / 500.0;
|
||||
var grow = cc.ScaleBy.create(growDuration, 0.5, 0.5);
|
||||
var permanentScaleLoop = cc.RepeatForever.create(cc.Sequence._actionOneTwo(grow, grow.reverse()));
|
||||
sprite.runAction(permanentScaleLoop);
|
||||
}
|
||||
|
||||
function performanceRotationScale(sprite) {
|
||||
var size = cc.Director.getInstance().getWinSize();
|
||||
sprite.setPosition(cc.p(parseInt(Math.random() * size.width), parseInt(Math.random() * size.height)));
|
||||
sprite.setRotation(cc.RANDOM_0_1() * 360);
|
||||
sprite.setScale(cc.RANDOM_0_1() * 2);
|
||||
}
|
||||
|
||||
function performancePosition(sprite) {
|
||||
var size = cc.Director.getInstance().getWinSize();
|
||||
log("performancePosition 01");
|
||||
sprite.setPosition(cc.p(parseInt(Math.random() * size.width), parseInt(Math.random() * size.height)));
|
||||
log("performancePosition 02");
|
||||
}
|
||||
|
||||
function performanceout20(sprite) {
|
||||
var size = cc.Director.getInstance().getWinSize();
|
||||
|
||||
if (cc.RANDOM_0_1() < 0.2)
|
||||
sprite.setPosition(cc.p(parseInt(Math.random() * size.width), parseInt(Math.random() * size.height)));
|
||||
else
|
||||
sprite.setPosition(cc.p(-1000, -1000));
|
||||
}
|
||||
|
||||
function performanceOut100(sprite) {
|
||||
sprite.setPosition(cc.p(-1000, -1000));
|
||||
}
|
||||
|
||||
function performanceScale(sprite) {
|
||||
var size = cc.Director.getInstance().getWinSize();
|
||||
sprite.setPosition(cc.p(parseInt(Math.random() * size.width), parseInt(Math.random() * size.height)));
|
||||
sprite.setScale(cc.RANDOM_0_1() * 100 / 50);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SpritePerformTest1
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var SpritePerformTest1 = SpriteMainScene.extend({
|
||||
doTest:function (sprite) {
|
||||
performancePosition(sprite);
|
||||
},
|
||||
title:function () {
|
||||
return "A (" + this._subtestNumber + ") position";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SpritePerformTest2
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var SpritePerformTest2 = SpriteMainScene.extend({
|
||||
doTest:function (sprite) {
|
||||
performanceScale(sprite);
|
||||
},
|
||||
title:function () {
|
||||
return "B (" + this._subtestNumber + ") scale";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SpritePerformTest3
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var SpritePerformTest3 = SpriteMainScene.extend({
|
||||
doTest:function (sprite) {
|
||||
performanceRotationScale(sprite);
|
||||
},
|
||||
title:function () {
|
||||
return "C (" + this._subtestNumber + ") scale + rot";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SpritePerformTest4
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var SpritePerformTest4 = SpriteMainScene.extend({
|
||||
doTest:function (sprite) {
|
||||
performanceOut100(sprite);
|
||||
},
|
||||
title:function () {
|
||||
return "D (" + this._subtestNumber + ") 100% out";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SpritePerformTest5
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var SpritePerformTest5 = SpriteMainScene.extend({
|
||||
doTest:function (sprite) {
|
||||
performanceout20(sprite);
|
||||
},
|
||||
title:function () {
|
||||
return "E (" + this._subtestNumber + ") 80% out";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SpritePerformTest6
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var SpritePerformTest6 = SpriteMainScene.extend({
|
||||
doTest:function (sprite) {
|
||||
performanceActions(sprite);
|
||||
},
|
||||
title:function () {
|
||||
return "F (" + this._subtestNumber + ") actions";
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SpritePerformTest7
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var SpritePerformTest7 = SpriteMainScene.extend({
|
||||
doTest:function (sprite) {
|
||||
performanceActions20(sprite);
|
||||
},
|
||||
title:function () {
|
||||
return "G (" + this._subtestNumber + ") actions 80% out";
|
||||
}
|
||||
});
|
||||
|
||||
function runSpriteTest() {
|
||||
log("runSpriteTest 01");
|
||||
var scene = new SpritePerformTest1;
|
||||
log("runSpriteTest 02");
|
||||
scene.initWithSubTest(1, 50);
|
||||
log("runSpriteTest 03");
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
log("runSpriteTest 04");
|
||||
}
|
|
@ -0,0 +1,188 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
require("js/PerformanceTest/testResource.js");
|
||||
require("js/PerformanceTest/testbasic.js");
|
||||
|
||||
/*
|
||||
require("js/PerformanceTest/PerformanceParticleTest.js");
|
||||
require("js/PerformanceTest/PerformanceTextureTest.js");
|
||||
*/
|
||||
|
||||
var ITEM_TAG_BASIC = 1000;
|
||||
var nCurCase = 0;
|
||||
|
||||
var PerformanceTests = [
|
||||
"PerformanceNodeChildrenTest",
|
||||
"PerformanceParticleTest",
|
||||
"PerformanceSpriteTest",
|
||||
"PerformanceTextureTest",
|
||||
"PerformanceTouchesTest"
|
||||
];
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// PerformanceMainLayer
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var PerformanceMainLayer = cc.Layer.extend({
|
||||
ctor:function () {
|
||||
var parent = new cc.Layer();
|
||||
__associateObjWithNative(this, parent);
|
||||
this.init();
|
||||
},
|
||||
|
||||
onEnter:function () {
|
||||
//this._super();
|
||||
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
|
||||
var menu = cc.Menu.create();
|
||||
menu.setPosition(cc.POINT_ZERO);
|
||||
cc.MenuItemFont.setFontName("Arial");
|
||||
cc.MenuItemFont.setFontSize(24);
|
||||
|
||||
for (var i = 0; i < PerformanceTests.length; i++) {
|
||||
var pItem = cc.MenuItemFont.create(PerformanceTests[i], this, this.menuCallback);
|
||||
pItem.setPosition(cc.p(s.width / 2, s.height - (i + 1) * LINE_SPACE));
|
||||
menu.addChild(pItem, ITEM_TAG_BASIC + i);
|
||||
}
|
||||
|
||||
this.addChild(menu);
|
||||
},
|
||||
menuCallback:function (sender) {
|
||||
var index = sender.getZOrder() - ITEM_TAG_BASIC;
|
||||
|
||||
// create the test scene and run it
|
||||
switch (index) {
|
||||
case 0:
|
||||
require("js/PerformanceTest/PerformanceNodeChildrenTest.js");
|
||||
runNodeChildrenTest();
|
||||
break;
|
||||
case 1:
|
||||
//runParticleTest();
|
||||
break;
|
||||
case 2:
|
||||
require("js/PerformanceTest/PerformanceSpriteTest.js");
|
||||
runSpriteTest();
|
||||
break;
|
||||
case 3:
|
||||
//runTextureTest();
|
||||
break;
|
||||
case 4:
|
||||
//runTouchesTest();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// PerformBasicLayer
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var PerformBasicLayer = cc.Layer.extend({
|
||||
_controlMenuVisible:true,
|
||||
_maxCases:1,
|
||||
_curCase:0,
|
||||
ctor:function () {
|
||||
this._curCase = nCurCase;
|
||||
var parent = new cc.Layer();
|
||||
__associateObjWithNative(this, parent);
|
||||
this.init();
|
||||
},
|
||||
onEnter:function () {
|
||||
// this._super();
|
||||
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
|
||||
cc.MenuItemFont.setFontName("Arial");
|
||||
cc.MenuItemFont.setFontSize(24);
|
||||
var mainItem = cc.MenuItemFont.create("Back", this, this.toMainLayer);
|
||||
mainItem.setPosition(cc.p(s.width - 50, 25));
|
||||
var menu = cc.Menu.create(mainItem);
|
||||
menu.setPosition(cc.POINT_ZERO);
|
||||
|
||||
if (this._controlMenuVisible) {
|
||||
var item1 = cc.MenuItemImage.create(s_pathB1, s_pathB2, this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create(s_pathR1, s_pathR2, this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create(s_pathF1, s_pathF2, this, this.nextCallback);
|
||||
item1.setPosition(cc.p(s.width / 2 - 100, 30));
|
||||
item2.setPosition(cc.p(s.width / 2, 30));
|
||||
item3.setPosition(cc.p(s.width / 2 + 100, 30));
|
||||
|
||||
menu.addChild(item1, ITEM_TAG_BASIC);
|
||||
menu.addChild(item2, ITEM_TAG_BASIC);
|
||||
menu.addChild(item3, ITEM_TAG_BASIC);
|
||||
}
|
||||
this.addChild(menu);
|
||||
},
|
||||
restartCallback:function (sender) {
|
||||
this.showCurrentTest();
|
||||
},
|
||||
nextCallback:function (sender) {
|
||||
this._curCase++;
|
||||
this._curCase = this._curCase % this._maxCases;
|
||||
nCurCase = this._curCase;
|
||||
this.showCurrentTest();
|
||||
},
|
||||
backCallback:function (sender) {
|
||||
this._curCase--;
|
||||
if (this._curCase < 0) {
|
||||
this._curCase += this._maxCases;
|
||||
}
|
||||
nCurCase = this._curCase;
|
||||
this.showCurrentTest();
|
||||
},
|
||||
showCurrentTest:function (sender) {
|
||||
},
|
||||
toMainLayer:function (sender) {
|
||||
var scene = new PerformanceTestScene();
|
||||
scene.runThisTest();
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// PerformanceTestScene
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
var PerformanceTestScene = TestScene.extend({
|
||||
runThisTest:function () {
|
||||
var layer = new PerformanceMainLayer();
|
||||
this.addChild(layer);
|
||||
cc.Director.getInstance().replaceScene(this);
|
||||
}
|
||||
});
|
||||
|
||||
function runPerformanceTest() {
|
||||
var scene = new PerformanceTestScene();
|
||||
scene.runThisTest();
|
||||
}
|
||||
|
||||
runPerformanceTest();
|
|
@ -0,0 +1,171 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
var s_nTexCurCase = 0;
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// TextureMenuLayer
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var TextureMenuLayer = PerformBasicLayer.extend({
|
||||
showCurrentTest:function () {
|
||||
var scene = null;
|
||||
switch (this._curCase) {
|
||||
case 0:
|
||||
scene = TextureTest.scene();
|
||||
break;
|
||||
}
|
||||
s_nTexCurCase = this._curCase;
|
||||
|
||||
if (scene) {
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
}
|
||||
},
|
||||
|
||||
onEnter:function () {
|
||||
this._super();
|
||||
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
|
||||
// Title
|
||||
var label = cc.LabelTTF.create(this.title(), "Arial", 40);
|
||||
this.addChild(label, 1);
|
||||
label.setPosition(cc.p(s.width / 2, s.height - 32));
|
||||
label.setColor(cc.c3b(255, 255, 40));
|
||||
|
||||
// Subtitle
|
||||
var strSubTitle = this.subtitle();
|
||||
if (strSubTitle.length) {
|
||||
var l = cc.LabelTTF.create(strSubTitle, "Thonburi", 16);
|
||||
this.addChild(l, 1);
|
||||
l.setPosition(cc.p(s.width / 2, s.height - 80));
|
||||
}
|
||||
|
||||
this.performTests();
|
||||
},
|
||||
title:function () {
|
||||
return "no title";
|
||||
},
|
||||
subtitle:function () {
|
||||
return "no subtitle";
|
||||
},
|
||||
performTests:function () {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// TextureTest
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var TextureTest = TextureMenuLayer.extend({
|
||||
performTests:function () {
|
||||
cc.log("--------");
|
||||
cc.log("--- PNG 128x128 ---");
|
||||
this.performTestsPNG("res/Images/test_image.png");
|
||||
|
||||
cc.log("--- PNG 512x512 ---");
|
||||
this.performTestsPNG("res/Images/texture512x512.png");
|
||||
|
||||
cc.log("EMPTY IMAGE");
|
||||
cc.log("--- PNG 1024x1024 ---");
|
||||
this.performTestsPNG("res/Images/texture1024x1024.png");
|
||||
|
||||
cc.log("LANDSCAPE IMAGE");
|
||||
cc.log("--- PNG 1024x1024 ---");
|
||||
this.performTestsPNG("res/Images/landscape-1024x1024.png");
|
||||
},
|
||||
title:function () {
|
||||
return "Texture Performance Test";
|
||||
},
|
||||
subtitle:function () {
|
||||
return "See console for results";
|
||||
},
|
||||
performTestsPNG:function (filename) {
|
||||
var now = cc.timeval();
|
||||
var texture;
|
||||
var cache = cc.TextureCache.getInstance();
|
||||
|
||||
cc.log("RGBA 8888");
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888);
|
||||
var now = cc.Time.gettimeofdayCocos2d();
|
||||
texture = cache.addImage(filename);
|
||||
if (texture)
|
||||
cc.log(" ms:" + calculateDeltaTime(now));
|
||||
else
|
||||
cc.log(" ERROR");
|
||||
cache.removeTexture(texture);
|
||||
|
||||
cc.log("RGBA 4444");
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444);
|
||||
var now = cc.Time.gettimeofdayCocos2d();
|
||||
texture = cache.addImage(filename);
|
||||
if (texture)
|
||||
cc.log(" ms:" + calculateDeltaTime(now));
|
||||
else
|
||||
cc.log(" ERROR");
|
||||
cache.removeTexture(texture);
|
||||
|
||||
cc.log("RGBA 5551");
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_2D_PIXEL_FORMAT_RGB5A1);
|
||||
var now = cc.Time.gettimeofdayCocos2d();
|
||||
texture = cache.addImage(filename);
|
||||
if (texture)
|
||||
cc.log(" ms:" + calculateDeltaTime(now));
|
||||
else
|
||||
cc.log(" ERROR");
|
||||
cache.removeTexture(texture);
|
||||
|
||||
cc.log("RGB 565");
|
||||
cc.Texture2D.setDefaultAlphaPixelFormat(cc.TEXTURE_2D_PIXEL_FORMAT_RGB565);
|
||||
var now = cc.Time.gettimeofdayCocos2d();
|
||||
texture = cache.addImage(filename);
|
||||
if (texture)
|
||||
cc.log(" ms:" + calculateDeltaTime(now));
|
||||
else
|
||||
cc.log(" ERROR");
|
||||
cache.removeTexture(texture);
|
||||
}
|
||||
});
|
||||
|
||||
TextureTest.scene = function () {
|
||||
var scene = cc.Scene.create();
|
||||
var layer = new TextureTest(false, 1, s_nTexCurCase);
|
||||
scene.addChild(layer);
|
||||
return scene;
|
||||
};
|
||||
function runTextureTest() {
|
||||
s_nTexCurCase = 0;
|
||||
var scene = TextureTest.scene();
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
}
|
||||
|
||||
function calculateDeltaTime(lastUpdate) {
|
||||
var now = cc.Time.gettimeofdayCocos2d();
|
||||
var dt = (now.tv_sec - lastUpdate.tv_sec) + (now.tv_usec - lastUpdate.tv_usec) / 1000000.0;
|
||||
return dt;
|
||||
}
|
|
@ -0,0 +1,162 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
var s_nTouchCurCase = 0;
|
||||
|
||||
var TouchesMainScene = PerformBasicLayer.extend({
|
||||
_maxCases:2,
|
||||
_plabel:null,
|
||||
_numberOfTouchesB:0,
|
||||
_numberOfTouchesM:0,
|
||||
_numberOfTouchesE:0,
|
||||
_numberOfTouchesC:0,
|
||||
_elapsedTime:null,
|
||||
showCurrentTest:function () {
|
||||
var layer = null;
|
||||
switch (this._curCase) {
|
||||
case 0:
|
||||
layer = new TouchesPerformTest1(true, 2, this._curCase);
|
||||
break;
|
||||
case 1:
|
||||
layer = new TouchesPerformTest2(true, 2, this._curCase);
|
||||
break;
|
||||
}
|
||||
s_nTouchCurCase = this._curCase;
|
||||
|
||||
if (layer) {
|
||||
var scene = cc.Scene.create();
|
||||
scene.addChild(layer);
|
||||
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
}
|
||||
},
|
||||
onEnter:function () {
|
||||
this._super();
|
||||
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
|
||||
// add title
|
||||
var label = cc.LabelTTF.create(this.title(), "Arial", 32);
|
||||
this.addChild(label, 1);
|
||||
label.setPosition(cc.p(s.width / 2, s.height - 50));
|
||||
|
||||
this.scheduleUpdate();
|
||||
|
||||
this._plabel = cc.LabelTTF.create("00.0", "Arial", 16);
|
||||
this._plabel.setPosition(cc.p(s.width / 2, s.height / 2));
|
||||
this.addChild(this._plabel);
|
||||
|
||||
this._elapsedTime = 0;
|
||||
this._numberOfTouchesB = this._numberOfTouchesM = this._numberOfTouchesE = this._numberOfTouchesC = 0;
|
||||
},
|
||||
title:function () {
|
||||
return "No title";
|
||||
},
|
||||
update:function (dt) {
|
||||
this._elapsedTime += dt;
|
||||
|
||||
if (this._elapsedTime > 1.0) {
|
||||
var frameRateB = (this._numberOfTouchesB / this._elapsedTime).toFixed(1);
|
||||
var frameRateM = (this._numberOfTouchesM / this._elapsedTime).toFixed(1);
|
||||
var frameRateE = (this._numberOfTouchesE / this._elapsedTime).toFixed(1);
|
||||
var frameRateC = (this._numberOfTouchesC / this._elapsedTime).toFixed(1);
|
||||
this._elapsedTime = 0;
|
||||
this._numberOfTouchesB = this._numberOfTouchesM = this._numberOfTouchesE = this._numberOfTouchesC = 0;
|
||||
|
||||
var str = frameRateB + " " + frameRateM + " " + frameRateE + " " + frameRateC;
|
||||
this._plabel.setString(str);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// TouchesPerformTest1
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var TouchesPerformTest1 = TouchesMainScene.extend({
|
||||
onEnter:function () {
|
||||
this._super();
|
||||
this.setTouchEnabled(true);
|
||||
},
|
||||
title:function () {
|
||||
return "Targeted touches";
|
||||
},
|
||||
registerWithTouchDispatcher:function () {
|
||||
cc.Director.getInstance().getTouchDispatcher().addTargetedDelegate(this, 0, true);
|
||||
},
|
||||
onTouchBegan:function (touch, event) {
|
||||
this._numberOfTouchesB++;
|
||||
return true;
|
||||
},
|
||||
onTouchMoved:function (touch, event) {
|
||||
this._numberOfTouchesM++;
|
||||
},
|
||||
onTouchEnded:function (touch, event) {
|
||||
this._numberOfTouchesE++;
|
||||
},
|
||||
onTouchCancelled:function (touch, event) {
|
||||
this._numberOfTouchesC++;
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// TouchesPerformTest2
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
var TouchesPerformTest2 = TouchesMainScene.extend({
|
||||
onEnter:function () {
|
||||
this._super();
|
||||
this.setTouchEnabled(true);
|
||||
},
|
||||
title:function () {
|
||||
return "Standard touches";
|
||||
},
|
||||
registerWithTouchDispatcher:function () {
|
||||
cc.Director.getInstance().getTouchDispatcher().addStandardDelegate(this, 0);
|
||||
},
|
||||
|
||||
onTouchesBegan:function (touches, event) {
|
||||
this._numberOfTouchesB += touches.length;
|
||||
},
|
||||
onTouchesMoved:function (touches, event) {
|
||||
this._numberOfTouchesM += touches.length;
|
||||
},
|
||||
onTouchesEnded:function (touches, event) {
|
||||
this._numberOfTouchesE += touches.length;
|
||||
},
|
||||
onTouchesCancelled:function (touches, event) {
|
||||
this._numberOfTouchesC += touches.length;
|
||||
}
|
||||
});
|
||||
|
||||
function runTouchesTest() {
|
||||
s_nTouchCurCase = 0;
|
||||
var scene = cc.Scene.create();
|
||||
var layer = new TouchesPerformTest1(true, 2, s_nTouchCurCase);
|
||||
scene.addChild(layer);
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
}
|
|
@ -0,0 +1,322 @@
|
|||
var s_pathGrossini = "Images/grossini.png";
|
||||
var s_pathSister1 = "Images/grossinis_sister1.png";
|
||||
var s_pathSister2 = "Images/grossinis_sister2.png";
|
||||
var s_pathB1 = "Images/b1.png";
|
||||
var s_pathB2 = "Images/b2.png";
|
||||
var s_pathR1 = "Images/r1.png";
|
||||
var s_pathR2 = "Images/r2.png";
|
||||
var s_pathF1 = "Images/f1.png";
|
||||
var s_pathF2 = "Images/f2.png";
|
||||
var s_pathBlock = "Images/blocks.png";
|
||||
var s_back = "Images/background.png";
|
||||
var s_back1 = "Images/background1.png";
|
||||
var s_back2 = "Images/background2.png";
|
||||
var s_back3 = "Images/background3.png";
|
||||
var s_stars1 = "Images/stars.png";
|
||||
var s_stars2 = "Images/stars2.png";
|
||||
var s_fire = "Images/fire.png";
|
||||
var s_snow = "Images/snow.png";
|
||||
var s_streak = "Images/streak.png";
|
||||
var s_playNormal = "Images/btn-play-normal.png";
|
||||
var s_playSelect = "Images/btn-play-selected.png";
|
||||
var s_aboutNormal = "Images/btn-about-normal.png";
|
||||
var s_aboutSelect = "Images/btn-about-selected.png";
|
||||
var s_highNormal = "Images/btn-highscores-normal.png";
|
||||
var s_highSelect = "Images/btn-highscores-selected.png";
|
||||
var s_ball = "Images/ball.png";
|
||||
var s_paddle = "Images/paddle.png";
|
||||
var s_pathClose = "Images/close.png";
|
||||
var s_menuItem = "Images/menuitemsprite.png";
|
||||
var s_shapeModeMenuItem = "Images/shapemode.png";
|
||||
var s_textureModeMenuItem = "Images/texturemode.png";
|
||||
var s_MovementMenuItem = "Images/movement.png";
|
||||
var s_sendScore = "Images/SendScoreButton.png";
|
||||
var s_pressSendScore = "Images/SendScoreButtonPressed.png";
|
||||
var s_power = "Images/powered.png";
|
||||
var s_atlasTest = "Images/atlastest.png";
|
||||
var s_stars2Grayscale = "Images/stars2-grayscale.png";
|
||||
var s_starsGrayscale = "Images/stars-grayscale.png";
|
||||
var s_grossini_dance_atlas = "Images/grossini_dance_atlas.png";
|
||||
var s_piece = "Images/piece.png";
|
||||
var s_grossini_dance_atlas_mono = "Images/grossini_dance_atlas-mono.png";
|
||||
|
||||
var s_grossini = "animations/grossini.png";
|
||||
var s_grossini_gray = "animations/grossini_gray.png";
|
||||
var s_grossini_blue = "animations/grossini_blue.png";
|
||||
var s_grossini_aliases = "animations/grossini-aliases.png";
|
||||
var s_dragon_animation = "animations/dragon_animation.png";
|
||||
var s_ghosts = "animations/ghosts.png";
|
||||
var s_grossini_family = "animations/grossini_family.png";
|
||||
|
||||
var s_boilingFoamPlist = "Images/BoilingFoam.plist";
|
||||
var s_grossiniPlist = "animations/grossini.plist";
|
||||
var s_grossini_grayPlist = "animations/grossini_gray.plist";
|
||||
var s_grossini_bluePlist = "animations/grossini_blue.plist";
|
||||
var s_grossini_aliasesPlist = "animations/grossini-aliases.plist";
|
||||
var s_ghostsPlist = "animations/ghosts.plist";
|
||||
var s_grossini_familyPlist = "animations/grossini_family.plist";
|
||||
var s_animations2Plist = "animations/animations-2.plist";
|
||||
var s_animationsPlist = "animations/animations.plist";
|
||||
|
||||
var s_helloWorld = "Images/HelloWorld.png";
|
||||
var s_grossiniDance01 = "Images/grossini_dance_01.png";
|
||||
var s_grossiniDance02 = "Images/grossini_dance_02.png";
|
||||
var s_grossiniDance03 = "Images/grossini_dance_03.png";
|
||||
var s_grossiniDance04 = "Images/grossini_dance_04.png";
|
||||
var s_grossiniDance05 = "Images/grossini_dance_05.png";
|
||||
var s_grossiniDance06 = "Images/grossini_dance_06.png";
|
||||
var s_grossiniDance07 = "Images/grossini_dance_07.png";
|
||||
var s_grossiniDance08 = "Images/grossini_dance_08.png";
|
||||
var s_grossiniDance09 = "Images/grossini_dance_09.png";
|
||||
var s_grossiniDance10 = "Images/grossini_dance_10.png";
|
||||
var s_grossiniDance11 = "Images/grossini_dance_11.png";
|
||||
var s_grossiniDance12 = "Images/grossini_dance_12.png";
|
||||
var s_grossiniDance13 = "Images/grossini_dance_13.png";
|
||||
var s_grossiniDance14 = "Images/grossini_dance_14.png";
|
||||
|
||||
var s_arrows = "Images/arrows.png";
|
||||
var s_arrowsBar = "Images/arrowsBar.png";
|
||||
var s_arrows_hd = "Images/arrows-hd.png";
|
||||
var s_arrowsBar_hd = "Images/arrowsBar-hd.png";
|
||||
|
||||
// tilemaps resource
|
||||
var s_tilesPng = "TileMaps/tiles.png";
|
||||
var s_levelMapTga = "TileMaps/levelmap.tga";
|
||||
var s_fixedOrthoTest2Png = "TileMaps/fixed-ortho-test2.png";
|
||||
var s_hexaTilesPng = "TileMaps/hexa-tiles.png";
|
||||
var s_isoTestPng = "TileMaps/iso-test.png";
|
||||
var s_isoTest2Png = "TileMaps/iso-test2.png";
|
||||
var s_isoPng = "TileMaps/iso.png";
|
||||
var s_orthoTest1BwPng = "TileMaps/ortho-test1_bw.png";
|
||||
var s_orthoTest1Png = "TileMaps/ortho-test1.png";
|
||||
var s_tilesHdPng = "TileMaps/tiles-hd.png";
|
||||
var s_tmwDesertSpacingHdPng = "TileMaps/tmw_desert_spacing-hd.png";
|
||||
var s_tmwDesertSpacingPng = "TileMaps/tmw_desert_spacing.png";
|
||||
var s_fnTuffyBoldItalicCharmapPng = "fonts/tuffy_bold_italic-charmap.png";
|
||||
var s_fpsImages = "fonts/fps_images.png";
|
||||
|
||||
var s_bitmapFontTest = "fonts/bitmapFontTest.png";
|
||||
var s_bitmapFontTest2 = "fonts/bitmapFontTest2.png";
|
||||
var s_bitmapFontTest3 = "fonts/bitmapFontTest3.png";
|
||||
var s_bitmapFontTest4 = "fonts/bitmapFontTest4.png";
|
||||
var s_bitmapFontTest5 = "fonts/bitmapFontTest5.png";
|
||||
var s_konqa32 = "fonts/konqa32.png";
|
||||
var s_konqa32_hd = "fonts/konqa32-hd.png";
|
||||
var s_bitmapFontChinese = "fonts/bitmapFontChinese.png";
|
||||
var s_arial16 = "fonts/arial16.png";
|
||||
var s_larabie_16 = "fonts/larabie-16.png";
|
||||
var s_larabie_16_hd = "fonts/larabie-16-hd.png";
|
||||
var s_futura48 = "fonts/futura-48.png";
|
||||
var s_arial_unicode_26 = "fonts/arial-unicode-26.png";
|
||||
|
||||
var s_bitmapFontTest_fnt = "fonts/bitmapFontTest.fnt";
|
||||
var s_bitmapFontTest2_fnt = "fonts/bitmapFontTest2.fnt";
|
||||
var s_bitmapFontTest3_fnt = "fonts/bitmapFontTest3.fnt";
|
||||
var s_bitmapFontTest4_fnt = "fonts/bitmapFontTest4.fnt";
|
||||
var s_bitmapFontTest5_fnt = "fonts/bitmapFontTest5.fnt";
|
||||
var s_konqa32_fnt = "fonts/konqa32.fnt";
|
||||
var s_konqa32_hd_fnt = "fonts/konqa32-hd.fnt";
|
||||
var s_bitmapFontChinese_fnt = "fonts/bitmapFontChinese.fnt";
|
||||
var s_arial16_fnt = "fonts/arial16.fnt";
|
||||
var s_futura48_fnt = "fonts/futura-48.fnt";
|
||||
var s_helvetica32_fnt = "fonts/helvetica-32.fnt";
|
||||
var s_geneva32_fnt = "fonts/geneva-32.fnt";
|
||||
var s_arial_unicode_26_fnt = "fonts/arial-unicode-26.fnt";
|
||||
var s_markerFelt_fnt = "fonts/markerFelt.fnt";
|
||||
var s_markerFelt_hd_fnt = "fonts/markerFelt-hd.fnt";
|
||||
|
||||
var s_larabie_16_plist = "fonts/larabie-16.plist";
|
||||
var s_larabie_16_hd_plist = "fonts/larabie-16-hd.plist";
|
||||
var s_tuffy_bold_italic_charmap = "fonts/tuffy_bold_italic-charmap.plist";
|
||||
var s_tuffy_bold_italic_charmap_hd = "fonts/tuffy_bold_italic-charmap-hd.plist";
|
||||
|
||||
var s_particles = "Images/particles.png";
|
||||
var s_particles_hd = "Images/particles-hd.png";
|
||||
|
||||
var g_ressources = [
|
||||
//image ressources
|
||||
{type:"image", src:s_particles},
|
||||
{type:"image", src:s_particles_hd},
|
||||
|
||||
{type:"image", src:s_pathGrossini},
|
||||
{type:"image", src:s_fnTuffyBoldItalicCharmapPng},
|
||||
{type:"image", src:s_fpsImages},
|
||||
{type:"image", src:s_pathSister1},
|
||||
{type:"image", src:s_pathSister2},
|
||||
{type:"image", src:s_pathB1},
|
||||
{type:"image", src:s_pathB2},
|
||||
{type:"image", src:s_pathR1},
|
||||
{type:"image", src:s_pathR2},
|
||||
{type:"image", src:s_pathF1},
|
||||
{type:"image", src:s_pathF2},
|
||||
{type:"image", src:s_pathBlock},
|
||||
{type:"image", src:s_back},
|
||||
{type:"image", src:s_back1},
|
||||
{type:"image", src:s_back2},
|
||||
{type:"image", src:s_back3},
|
||||
{type:"image", src:s_stars1},
|
||||
{type:"image", src:s_stars2},
|
||||
{type:"image", src:s_fire},
|
||||
{type:"image", src:s_snow},
|
||||
{type:"image", src:s_playNormal},
|
||||
{type:"image", src:s_playSelect},
|
||||
{type:"image", src:s_aboutNormal},
|
||||
{type:"image", src:s_aboutSelect},
|
||||
{type:"image", src:s_highNormal},
|
||||
{type:"image", src:s_highSelect},
|
||||
{type:"image", src:s_ball},
|
||||
{type:"image", src:s_paddle},
|
||||
{type:"image", src:s_pathClose},
|
||||
{type:"image", src:s_menuItem},
|
||||
{type:"image", src:s_shapeModeMenuItem},
|
||||
{type:"image", src:s_textureModeMenuItem},
|
||||
{type:"image", src:s_MovementMenuItem},
|
||||
{type:"image", src:s_sendScore},
|
||||
{type:"image", src:s_pressSendScore},
|
||||
{type:"image", src:s_power},
|
||||
{type:"image", src:s_atlasTest},
|
||||
{type:"image", src:s_tilesPng},
|
||||
{type:"image", src:s_streak},
|
||||
{type:"image", src:s_starsGrayscale},
|
||||
{type:"image", src:s_stars2Grayscale},
|
||||
{type:"image", src:s_piece},
|
||||
{type:"image", src:s_grossini_dance_atlas_mono},
|
||||
|
||||
{type:"image", src:s_fixedOrthoTest2Png},
|
||||
{type:"image", src:s_hexaTilesPng},
|
||||
{type:"image", src:s_isoTestPng},
|
||||
{type:"image", src:s_isoTest2Png},
|
||||
{type:"image", src:s_isoPng},
|
||||
{type:"image", src:s_orthoTest1BwPng},
|
||||
{type:"image", src:s_orthoTest1Png},
|
||||
{type:"image", src:s_tilesHdPng},
|
||||
{type:"image", src:s_tmwDesertSpacingHdPng},
|
||||
{type:"image", src:s_tmwDesertSpacingPng},
|
||||
{type:"image", src:s_grossini},
|
||||
{type:"image", src:s_grossini_gray},
|
||||
{type:"image", src:s_grossini_blue},
|
||||
{type:"image", src:s_grossini_dance_atlas},
|
||||
{type:"image", src:s_grossini_aliases},
|
||||
{type:"image", src:s_dragon_animation},
|
||||
{type:"image", src:s_ghosts},
|
||||
{type:"image", src:s_grossini_family},
|
||||
|
||||
{type:"image", src:s_helloWorld},
|
||||
{type:"image", src:s_grossiniDance01},
|
||||
{type:"image", src:s_grossiniDance02},
|
||||
{type:"image", src:s_grossiniDance03},
|
||||
{type:"image", src:s_grossiniDance04},
|
||||
{type:"image", src:s_grossiniDance05},
|
||||
{type:"image", src:s_grossiniDance06},
|
||||
{type:"image", src:s_grossiniDance07},
|
||||
{type:"image", src:s_grossiniDance08},
|
||||
{type:"image", src:s_grossiniDance09},
|
||||
{type:"image", src:s_grossiniDance10},
|
||||
{type:"image", src:s_grossiniDance11},
|
||||
{type:"image", src:s_grossiniDance12},
|
||||
{type:"image", src:s_grossiniDance13},
|
||||
{type:"image", src:s_grossiniDance14},
|
||||
|
||||
{type:"image", src:s_bitmapFontTest},
|
||||
{type:"image", src:s_bitmapFontTest2},
|
||||
{type:"image", src:s_bitmapFontTest3},
|
||||
{type:"image", src:s_bitmapFontTest4},
|
||||
{type:"image", src:s_bitmapFontTest5},
|
||||
{type:"image", src:s_konqa32},
|
||||
{type:"image", src:s_konqa32_hd},
|
||||
{type:"image", src:s_bitmapFontChinese},
|
||||
{type:"image", src:s_arial16},
|
||||
{type:"image", src:s_larabie_16},
|
||||
{type:"image", src:s_larabie_16_hd},
|
||||
{type:"image", src:s_futura48},
|
||||
{type:"image", src:s_arial_unicode_26},
|
||||
|
||||
{type:"image", src:s_arrows},
|
||||
{type:"image", src:s_arrowsBar},
|
||||
{type:"image", src:s_arrows_hd},
|
||||
{type:"image", src:s_arrowsBar_hd},
|
||||
|
||||
{type:"plist", src:s_boilingFoamPlist},
|
||||
{type:"plist", src:s_animations2Plist},
|
||||
{type:"plist", src:s_animationsPlist},
|
||||
{type:"plist", src:s_grossiniPlist},
|
||||
{type:"plist", src:s_grossini_grayPlist},
|
||||
{type:"plist", src:s_grossini_bluePlist},
|
||||
{type:"plist", src:s_grossini_aliasesPlist},
|
||||
{type:"plist", src:s_ghostsPlist},
|
||||
{type:"plist", src:s_grossini_familyPlist},
|
||||
|
||||
{type:"plist", src:s_larabie_16_plist},
|
||||
{type:"plist", src:s_larabie_16_hd_plist},
|
||||
{type:"plist", src:s_tuffy_bold_italic_charmap},
|
||||
{type:"plist", src:s_tuffy_bold_italic_charmap_hd},
|
||||
|
||||
//tmx ressources
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test1.tmx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test1.tsx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test2.tmx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test3.tmx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test4.tmx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test4-hd.tmx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test5.tmx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test6.tmx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test6-hd.tmx"},
|
||||
{type:"tmx", src:"TileMaps/hexa-test.tmx"},
|
||||
{type:"tmx", src:"TileMaps/iso-test.tmx"},
|
||||
{type:"tmx", src:"TileMaps/iso-test1.tmx"},
|
||||
{type:"tmx", src:"TileMaps/iso-test2.tmx"},
|
||||
{type:"tmx", src:"TileMaps/iso-test2-uncompressed.tmx"},
|
||||
{type:"tmx", src:"TileMaps/ortho-objects.tmx"},
|
||||
{type:"tmx", src:"TileMaps/iso-test-objectgroup.tmx"},
|
||||
{type:"tmx", src:"TileMaps/iso-test-zorder.tmx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test-zorder.tmx"},
|
||||
{type:"tmx", src:"TileMaps/iso-test-vertexz.tmx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test-vertexz.tmx"},
|
||||
{type:"tmx", src:"TileMaps/iso-test-movelayer.tmx"},
|
||||
{type:"tmx", src:"TileMaps/orthogonal-test-movelayer.tmx"},
|
||||
{type:"tmx", src:"TileMaps/iso-test-bug787.tmx"},
|
||||
{type:"tmx", src:"TileMaps/test-object-layer.tmx"},
|
||||
{type:"tmx", src:"TileMaps/ortho-tile-property.tmx"},
|
||||
{type:"tmx", src:"TileMaps/ortho-rotation-test.tmx"},
|
||||
|
||||
//audio ressources
|
||||
{type:"bgm", src:"background"},
|
||||
{type:"effect", src:"effect2"},
|
||||
|
||||
//tga ressources
|
||||
{type:"tga", src:s_levelMapTga},
|
||||
|
||||
//fnt ressources
|
||||
{type:"fnt", src:s_bitmapFontTest_fnt},
|
||||
{type:"fnt", src:s_bitmapFontTest2_fnt},
|
||||
{type:"fnt", src:s_bitmapFontTest3_fnt},
|
||||
{type:"fnt", src:s_bitmapFontTest4_fnt},
|
||||
{type:"fnt", src:s_bitmapFontTest5_fnt},
|
||||
{type:"fnt", src:s_konqa32_fnt},
|
||||
{type:"fnt", src:s_konqa32_hd_fnt},
|
||||
{type:"fnt", src:s_bitmapFontChinese_fnt},
|
||||
{type:"fnt", src:s_arial16_fnt},
|
||||
{type:"fnt", src:s_futura48_fnt},
|
||||
{type:"fnt", src:s_helvetica32_fnt},
|
||||
{type:"fnt", src:s_geneva32_fnt},
|
||||
{type:"fnt", src:s_arial_unicode_26_fnt},
|
||||
{type:"fnt", src:s_markerFelt_fnt},
|
||||
{type:"fnt", src:s_markerFelt_hd_fnt},
|
||||
|
||||
{type:"plist", src:"fonts/strings.xml"},
|
||||
{type:"plist", src:"Particles/BoilingFoam.plist"},
|
||||
{type:"plist", src:"Particles/BurstPipe.plist"},
|
||||
{type:"plist", src:"Particles/Comet.plist"},
|
||||
{type:"plist", src:"Particles/debian.plist"},
|
||||
{type:"plist", src:"Particles/ExplodingRing.plist"},
|
||||
{type:"plist", src:"Particles/Flower.plist"},
|
||||
{type:"plist", src:"Particles/Galaxy.plist"},
|
||||
{type:"plist", src:"Particles/LavaFlow.plist"},
|
||||
{type:"plist", src:"Particles/Phoenix.plist"},
|
||||
{type:"plist", src:"Particles/SmallSun.plist"},
|
||||
{type:"plist", src:"Particles/SpinningPeas.plist"},
|
||||
{type:"plist", src:"Particles/Spiral.plist"},
|
||||
{type:"plist", src:"Particles/SpookyPeas.plist"},
|
||||
{type:"plist", src:"Particles/TestPremultipliedAlpha.plist"},
|
||||
{type:"plist", src:"Particles/Upsidedown.plist"}
|
||||
];
|
|
@ -0,0 +1,330 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
var TestScene = cc.Scene.extend({
|
||||
ctor:function (bPortrait) {
|
||||
//this._super();
|
||||
var parent = new cc.Scene();
|
||||
__associateObjWithNative(this, parent);
|
||||
this.init();
|
||||
},
|
||||
onEnter:function () {
|
||||
//this._super();
|
||||
var label = cc.LabelTTF.create("MainMenu", "Arial", 20);
|
||||
var menuItem = cc.MenuItemLabel.create(label, this, this.MainMenuCallback);
|
||||
|
||||
var menu = cc.Menu.create(menuItem);
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
menu.setPosition(cc.POINT_ZERO);
|
||||
menuItem.setPosition(cc.p(s.width - 50, 25));
|
||||
|
||||
this.addChild(menu, 1);
|
||||
},
|
||||
runThisTest:function () {
|
||||
|
||||
},
|
||||
MainMenuCallback:function () {
|
||||
require("js/main.js");
|
||||
/*
|
||||
var scene = cc.Scene.create();
|
||||
var layer = new TestController();
|
||||
scene.addChild(layer);
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
*/
|
||||
}
|
||||
});
|
||||
//Controller stuff
|
||||
var LINE_SPACE = 40;
|
||||
var s_pathClose = null;
|
||||
var curPos = cc.POINT_ZERO;
|
||||
|
||||
var TestController = cc.Layer.extend({
|
||||
_itemMenu:null,
|
||||
_beginPos:cc.POINT_ZERO,
|
||||
isMouseDown:false,
|
||||
ctor:function () {
|
||||
var parent = new cc.Layer();
|
||||
__associateObjWithNative(this, parent);
|
||||
this.init();
|
||||
|
||||
// add close menu
|
||||
if (!s_pathClose) {
|
||||
s_pathClose = cc.TextureCache.getInstance().textureForKey("CloseNormal.png");
|
||||
}
|
||||
var closeItem = cc.MenuItemImage.create(s_pathClose, s_pathClose, this, this.closeCallback);
|
||||
var menu = cc.Menu.create(closeItem);//pmenu is just a holder for the close button
|
||||
var s = cc.Director.getInstance().getWinSize();
|
||||
menu.setPosition(cc.POINT_ZERO);
|
||||
closeItem.setPosition(cc.p(s.width - 30, s.height - 30));
|
||||
|
||||
// add menu items for tests
|
||||
this._itemMenu = cc.Menu.create();//item menu is where all the label goes, and the one gets scrolled
|
||||
|
||||
for (var i = 0, len = testNames.length; i < len; i++) {
|
||||
var label = cc.LabelTTF.create(testNames[i].title, "Arial", 24);
|
||||
var menuItem = cc.MenuItemLabel.create(label, this, this.menuCallback);
|
||||
this._itemMenu.addChild(menuItem, i + 10000);
|
||||
menuItem.setPosition(cc.p(s.width / 2, (s.height - (i + 1) * LINE_SPACE)));
|
||||
}
|
||||
|
||||
this._itemMenu.setContentSize(cc.size(s.width, (testNames.length + 1) * LINE_SPACE));
|
||||
this._itemMenu.setPosition(curPos);
|
||||
this.setTouchEnabled(true);
|
||||
this.addChild(this._itemMenu);
|
||||
this.addChild(menu, 1);
|
||||
},
|
||||
menuCallback:function (sender) {
|
||||
var idx = sender.getZOrder() - 10000;
|
||||
// get the userdata, it's the index of the menu item clicked
|
||||
// create the test scene and run it
|
||||
var scene = testNames[idx].testScene();
|
||||
if (scene) {
|
||||
scene.runThisTest();
|
||||
}
|
||||
},
|
||||
closeCallback:function () {
|
||||
history.go(-1);
|
||||
},
|
||||
onTouchesBegan:function (touches, event) {
|
||||
if (!this.isMouseDown) {
|
||||
//this._beginPos = cc.p(touches[0].getLocation().x, touches[0].getLocation().y);
|
||||
this._beginPos = touches[0].getLocation().y;
|
||||
}
|
||||
this.isMouseDown = true;
|
||||
},
|
||||
onTouchesMoved:function (touches, event) {
|
||||
if (this.isMouseDown) {
|
||||
var touchLocation = touches[0].getLocation().y;
|
||||
var nMoveY = touchLocation - this._beginPos;
|
||||
curPos = cc.p(this._itemMenu.getPosition().x, this._itemMenu.getPosition().y);
|
||||
|
||||
var nextPos = cc.p(curPos.x, curPos.y + nMoveY);
|
||||
var winSize = cc.Director.getInstance().getWinSize();
|
||||
if (nextPos.y < 0.0) {
|
||||
this._itemMenu.setPosition(cc.POINT_ZERO);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nextPos.y > ((testNames.length + 1) * LINE_SPACE - winSize.height)) {
|
||||
this._itemMenu.setPosition(cc.p(0, ((testNames.length + 1) * LINE_SPACE - winSize.height)));
|
||||
return;
|
||||
}
|
||||
this._itemMenu.setPosition(nextPos);
|
||||
this._beginPos = cc.p(0, touchLocation).y;
|
||||
curPos = nextPos;
|
||||
}
|
||||
},
|
||||
onTouchesEnded:function () {
|
||||
this.isMouseDown = false;
|
||||
}
|
||||
});
|
||||
|
||||
var testNames = [
|
||||
//"Accelerometer",
|
||||
{
|
||||
title:"ActionManagerTest",
|
||||
testScene:function () {
|
||||
return new ActionManagerTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"ActionsTest",
|
||||
testScene:function () {
|
||||
return new ActionsTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"Box2DTest",
|
||||
testScene:function () {
|
||||
return new Box2DTestScene();
|
||||
}
|
||||
},
|
||||
//"Box2dTestBed",
|
||||
//"BugsTest",
|
||||
//"ChipmunkTest",
|
||||
{
|
||||
title:"ClickAndMoveTest",
|
||||
testScene:function () {
|
||||
return new ClickAndMoveTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"CocosDenshionTest",
|
||||
testScene:function () {
|
||||
return new CocosDenshionTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"CocosNodeTest",
|
||||
testScene:function () {
|
||||
return new CocosNodeTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"CurrentLanguageTest",
|
||||
testScene:function () {
|
||||
return new CurrentLanguageTestScene();
|
||||
}
|
||||
},
|
||||
//"CurlTest",
|
||||
{
|
||||
title:"DrawPrimitivesTest",
|
||||
testScene:function () {
|
||||
return new DrawPrimitivesTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"EaseActionsTest",
|
||||
testScene:function () {
|
||||
return new EaseActionsTestScene();
|
||||
}
|
||||
},
|
||||
//"EffectsTest",
|
||||
//"EffectAdvancedTest",
|
||||
//"ExtensionsTest",
|
||||
{
|
||||
title:"FontTest",
|
||||
testScene:function () {
|
||||
return new FontTestScene();
|
||||
}
|
||||
},
|
||||
//"HiResTest",
|
||||
{
|
||||
title:"IntervalTest",
|
||||
testScene:function () {
|
||||
return new IntervalTestScene();
|
||||
}
|
||||
},
|
||||
//"KeyboardTest",
|
||||
{
|
||||
title:"LabelTest",
|
||||
testScene:function () {
|
||||
return new LabelTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"LayerTest",
|
||||
testScene:function () {
|
||||
return new LayerTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"MenuTest",
|
||||
testScene:function () {
|
||||
return new MenuTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"MultiTouchTest",
|
||||
testScene:function () {
|
||||
return new MultiTouchTestScene();
|
||||
}
|
||||
},
|
||||
//"MotionStreakTest",
|
||||
{
|
||||
title:"ParallaxTest",
|
||||
testScene:function () {
|
||||
return new ParallaxTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"ParticleTest",
|
||||
testScene:function () {
|
||||
return new ParticleTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"PerformanceTest",
|
||||
testScene:function () {
|
||||
return new PerformanceTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"ProgressActionsTest",
|
||||
testScene:function () {
|
||||
return new ProgressActionsTestScene();
|
||||
}
|
||||
},
|
||||
//"RenderTextureTest",
|
||||
{
|
||||
title:"RotateWorldTest",
|
||||
testScene:function () {
|
||||
return new RotateWorldTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"SceneTest",
|
||||
testScene:function () {
|
||||
return new SceneTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"SchedulerTest",
|
||||
testScene:function () {
|
||||
return new SchedulerTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"SpriteTest",
|
||||
testScene:function () {
|
||||
return new SpriteTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"TextInputTest",
|
||||
testScene:function () {
|
||||
return new TextInputTestScene();
|
||||
}
|
||||
},
|
||||
//"Texture2DTest",
|
||||
{
|
||||
title:"TextureCacheTest",
|
||||
testScene:function () {
|
||||
return new TextureCacheTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"TileMapTest",
|
||||
testScene:function () {
|
||||
return new TileMapTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"TouchesTest",
|
||||
testScene:function () {
|
||||
return new TouchesTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"TransitionsTest",
|
||||
testScene:function () {
|
||||
return new TransitionsTestScene();
|
||||
}
|
||||
}
|
||||
//"UserDefaultTest",
|
||||
//"ZwoptexTest",
|
||||
];
|
|
@ -127,22 +127,43 @@ cc._g = function( x, y )
|
|||
//
|
||||
// Color
|
||||
//
|
||||
cc._c3 = function( r, g, b )
|
||||
//
|
||||
// Color 3B
|
||||
//
|
||||
cc.c3b = function( r, g, b )
|
||||
{
|
||||
cc._reuse_color3b[0] = r;
|
||||
cc._reuse_color3b[1] = g;
|
||||
cc._reuse_color3b[2] = b;
|
||||
return {r:r, g:g, b:b };
|
||||
};
|
||||
cc._c3b = function( r, g, b )
|
||||
{
|
||||
cc._reuse_color3b.r = r;
|
||||
cc._reuse_color3b.g = g;
|
||||
cc._reuse_color3b.b = b;
|
||||
return cc._reuse_color3b;
|
||||
}
|
||||
};
|
||||
// compatibility
|
||||
cc.c3 = cc.c3b;
|
||||
cc._c3 = cc._c3b;
|
||||
|
||||
cc._c4 = function( r, g, b, a )
|
||||
//
|
||||
// Color 4B
|
||||
//
|
||||
cc.c4b = function( r, g, b, a )
|
||||
{
|
||||
cc._reuse_color4b[0] = r;
|
||||
cc._reuse_color4b[1] = g;
|
||||
cc._reuse_color4b[2] = b;
|
||||
cc._reuse_color4b[3] = a;
|
||||
return {r:r, g:g, b:b, a:a };
|
||||
};
|
||||
cc._c4b = function( r, g, b, a )
|
||||
{
|
||||
cc._reuse_color4b.r = r;
|
||||
cc._reuse_color4b.g = g;
|
||||
cc._reuse_color4b.b = b;
|
||||
cc._reuse_color4b.a = a;
|
||||
return cc._reuse_color4b;
|
||||
}
|
||||
};
|
||||
// compatibility
|
||||
cc.c4 = cc.c4b;
|
||||
cc._c4 = cc._c4b;
|
||||
|
||||
|
||||
//
|
||||
// Size
|
||||
|
@ -204,6 +225,54 @@ cc.pMult = cc.pMult || function (p1, s) {
|
|||
return {x: p1.x * s, y: p1.y * s};
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates dot product of two points.
|
||||
* @param {cc.Point} v1
|
||||
* @param {cc.Point} v2
|
||||
* @return {Number}
|
||||
*/
|
||||
cc.pDot = function (v1, v2) {
|
||||
return v1.x * v2.x + v1.y * v2.y;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the square length of a cc.Point (not calling sqrt() )
|
||||
* @param {cc.Point} v
|
||||
*@return {cc.pDot}
|
||||
*/
|
||||
cc.pLengthSQ = function (v) {
|
||||
return cc.pDot(v, v);
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates distance between point an origin
|
||||
* @param {cc.Point} v
|
||||
* @return {Number}
|
||||
*/
|
||||
cc.pLength = function (v) {
|
||||
return Math.sqrt(cc.pLengthSQ(v));
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the distance between two points
|
||||
* @param {cc.Point} v1
|
||||
* @param {cc.Point} v2
|
||||
* @return {cc.pLength}
|
||||
*/
|
||||
cc.pDistance = function (v1, v2) {
|
||||
return cc.pLength(cc.pSub(v1, v2));
|
||||
};
|
||||
|
||||
/**
|
||||
* returns a random float between 0 and 1
|
||||
* @return {Number}
|
||||
* @function
|
||||
*/
|
||||
cc.RANDOM_0_1 = function () {
|
||||
return Math.random();
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Array: for cocos2d-hmtl5 compatibility
|
||||
//
|
||||
|
@ -329,6 +398,7 @@ cc.Class.extend = function (prop) {
|
|||
};
|
||||
|
||||
cc.Layer.extend = cc.Class.extend;
|
||||
cc.Scene.extend = cc.Class.extend;
|
||||
cc.LayerGradient.extend = cc.Class.extend;
|
||||
cc.Sprite.extend = cc.Class.extend;
|
||||
cc.MenuItemFont.extend = cc.Class.extend;
|
|
@ -151,7 +151,7 @@ MainTest = BaseLayer.extend({
|
|||
var item12 = cc.MenuItemFont.create("Tilemap Tests", this, function() { require("js/test-tilemap.js"); } );
|
||||
var item13 = cc.MenuItemFont.create("CocosDenshion Tests", this, function() { require("js/test-cocosdenshion.js"); } );
|
||||
var item14 = cc.MenuItemFont.create("cocos2d presentation", this, function() { require("js/test-cocos2djs.js"); } );
|
||||
var item14 = cc.MenuItemFont.create("Performance test", this, function() { require("js/test-performance.js"); } );
|
||||
var item14 = cc.MenuItemFont.create("Performance test", this, function() { require("js/PerformanceTest/PerformanceTest.js"); } );
|
||||
|
||||
|
||||
this._menu = cc.Menu.create( item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14 );
|
|
@ -51,7 +51,9 @@ var loadScene = function (sceneIdx)
|
|||
// scene.walkSceneGraph(0);
|
||||
|
||||
director.replaceScene( scene );
|
||||
}
|
||||
__jsc__.dumpRoot();
|
||||
__jsc__.garbageCollect();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
@ -162,9 +164,9 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
}
|
||||
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
|
||||
|
@ -179,9 +181,9 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
this.addChild(menu, 1);
|
||||
|
||||
// Setup Sprites for this:w
|
||||
this._grossini = cc.Sprite.create("grossini.png");
|
||||
this._tamara = cc.Sprite.create("grossinis_sister1.png");
|
||||
this._kathia = cc.Sprite.create("grossinis_sister2.png");
|
||||
this._grossini = cc.Sprite.create("Images/grossini.png");
|
||||
this._tamara = cc.Sprite.create("Images/grossinis_sister1.png");
|
||||
this._kathia = cc.Sprite.create("Images/grossinis_sister2.png");
|
||||
this.addChild(this._grossini, 1);
|
||||
this.addChild(this._tamara, 2);
|
||||
this.addChild(this._kathia, 3);
|
||||
|
@ -579,7 +581,7 @@ var ActionAnimate = BaseLayer.extend({
|
|||
//
|
||||
var animation = cc.Animation.create();
|
||||
for (var i = 1; i < 15; i++) {
|
||||
var frameName = "grossini_dance_" + ((i < 10) ? ("0" + i) : i) + ".png";
|
||||
var frameName = "Images/grossini_dance_" + ((i < 10) ? ("0" + i) : i) + ".png";
|
||||
animation.addSpriteFrameWithFilename(frameName);
|
||||
}
|
||||
animation.setDelayPerUnit(2.8 / 14);
|
||||
|
@ -1295,7 +1297,7 @@ var Issue1305 = BaseLayer.extend({
|
|||
this._super();
|
||||
this.centerSprites(0);
|
||||
|
||||
this._spriteTmp = cc.Sprite.create("grossini.png");
|
||||
this._spriteTmp = cc.Sprite.create("Images/grossini.png");
|
||||
/* c++ can't support block, so we use CCCallFuncN instead.
|
||||
[spriteTmp_ runAction:[CCCallBlockN actionWithBlock:^(CCNode* node) {
|
||||
NSLog(@"This message SHALL ONLY appear when the sprite is added to the scene, NOT BEFORE");
|
||||
|
@ -1335,7 +1337,7 @@ var Issue1305_2 = BaseLayer.extend({
|
|||
this._super();
|
||||
this.centerSprites(0);
|
||||
|
||||
var spr = cc.Sprite.create("grossini.png");
|
||||
var spr = cc.Sprite.create("Images/grossini.png");
|
||||
spr.setPosition(cc.p(200,200));
|
||||
this.addChild(spr);
|
||||
|
||||
|
@ -1379,7 +1381,7 @@ var Issue1288 = BaseLayer.extend({
|
|||
this._super();
|
||||
this.centerSprites(0);
|
||||
|
||||
var spr = cc.Sprite.create("grossini.png");
|
||||
var spr = cc.Sprite.create("Images/grossini.png");
|
||||
spr.setPosition(cc.p(100, 100));
|
||||
this.addChild(spr);
|
||||
|
||||
|
@ -1403,7 +1405,7 @@ var Issue1288_2 = BaseLayer.extend({
|
|||
this._super();
|
||||
this.centerSprites(0);
|
||||
|
||||
var spr = cc.Sprite.create("grossini.png");
|
||||
var spr = cc.Sprite.create("Images/grossini.png");
|
||||
spr.setPosition(cc.p(100, 100));
|
||||
this.addChild(spr);
|
||||
|
||||
|
@ -1423,7 +1425,7 @@ var Issue1327 = BaseLayer.extend({
|
|||
this._super();
|
||||
this.centerSprites(0);
|
||||
|
||||
var spr = cc.Sprite.create("grossini.png");
|
||||
var spr = cc.Sprite.create("Images/grossini.png");
|
||||
spr.setPosition(cc.p(100, 100));
|
||||
this.addChild(spr);
|
||||
|
|
@ -55,9 +55,9 @@ var loadScene = function (sceneIdx)
|
|||
// __jsc__.garbageCollect();
|
||||
}
|
||||
|
||||
var s_pathSister1 = "grossinis_sister1.png";
|
||||
var s_pathSister2 = "grossinis_sister2.png";
|
||||
var s_pathBlock = "blocks.png";
|
||||
var s_pathSister1 = "Images/grossinis_sister1.png";
|
||||
var s_pathSister2 = "Images/grossinis_sister2.png";
|
||||
var s_pathBlock = "Images/blocks.png";
|
||||
var s_grossiniPlist = "animations/grossini.plist";
|
||||
|
||||
//
|
||||
|
@ -126,9 +126,9 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
}
|
||||
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
|
|
@ -188,7 +188,7 @@ ChipmunkSpriteTest.prototype.createPhysicsSprite = function( pos ) {
|
|||
cp.shapeSetFriction( shape, 0.5 );
|
||||
cp.spaceAddShape( this.space, shape );
|
||||
|
||||
var sprite = cc.PhysicsSprite.create("grossini.png");
|
||||
var sprite = cc.ChipmunkSprite.create("grossini.png");
|
||||
sprite.setBody( body );
|
||||
return sprite;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ var ChipmunkCollisionTest = function() {
|
|||
cp.shapeSetCollisionType( shape, collision_type );
|
||||
cp.spaceAddShape( this.space, shape );
|
||||
|
||||
var sprite = cc.PhysicsSprite.create(file);
|
||||
var sprite = cc.ChipmunkSprite.create(file);
|
||||
sprite.setBody( body );
|
||||
return sprite;
|
||||
}
|
|
@ -126,9 +126,9 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
this.addChild( labelbg,9);
|
||||
}
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
|
||||
|
@ -144,9 +144,9 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
this.addChild(menu, 1);
|
||||
|
||||
// Setup Sprites for this:w
|
||||
this._grossini = cc.Sprite.create("grossini.png");
|
||||
this._tamara = cc.Sprite.create("grossinis_sister1.png");
|
||||
this._kathia = cc.Sprite.create("grossinis_sister2.png");
|
||||
this._grossini = cc.Sprite.create("Images/grossini.png");
|
||||
this._tamara = cc.Sprite.create("Images/grossinis_sister1.png");
|
||||
this._kathia = cc.Sprite.create("Images/grossinis_sister2.png");
|
||||
this.addChild(this._grossini, 1);
|
||||
this.addChild(this._tamara, 2);
|
||||
this.addChild(this._kathia, 3);
|
|
@ -55,9 +55,9 @@ var loadScene = function (sceneIdx)
|
|||
// __jsc__.garbageCollect();
|
||||
}
|
||||
|
||||
var s_pathSister1 = "grossinis_sister1.png";
|
||||
var s_pathSister2 = "grossinis_sister2.png";
|
||||
var s_pathBlock = "blocks.png";
|
||||
var s_pathSister1 = "Images/grossinis_sister1.png";
|
||||
var s_pathSister2 = "Images/grossinis_sister2.png";
|
||||
var s_pathBlock = "Images/blocks.png";
|
||||
var s_grossiniPlist = "animations/grossini.plist";
|
||||
|
||||
//
|
||||
|
@ -126,9 +126,9 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
}
|
||||
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
|
||||
|
@ -149,15 +149,15 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
node.runAction( this.getEffect(3) );
|
||||
this.addChild( node );
|
||||
|
||||
var bg = cc.Sprite.create("background3.png");
|
||||
var bg = cc.Sprite.create("Images/background3.png");
|
||||
bg.setPosition( cc._p( winSize.width/2, winSize.height/2) );
|
||||
node.addChild( bg );
|
||||
|
||||
var sister1 = cc.Sprite.create("grossinis_sister1.png");
|
||||
var sister1 = cc.Sprite.create("Images/grossinis_sister1.png");
|
||||
sister1.setPosition( cc._p( winSize.width/3, winSize.height/2 ) );
|
||||
node.addChild( sister1, 1 );
|
||||
|
||||
var sister2 = cc.Sprite.create("grossinis_sister2.png");
|
||||
var sister2 = cc.Sprite.create("Images/grossinis_sister2.png");
|
||||
sister2.setPosition( cc._p( winSize.width*2/3, winSize.height/2 ) );
|
||||
node.addChild( sister2, 1 );
|
||||
|
|
@ -93,11 +93,11 @@ BaseLayer.prototype.onEnter = function() {
|
|||
}
|
||||
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
cc.MenuItemFont.setFontSize( 22 );
|
||||
|
||||
var menu = cc.Menu.create(item1, item2, item3, item4 );
|
||||
|
||||
|
@ -136,12 +136,12 @@ var LabelAtlasTest = function(file) {
|
|||
|
||||
this.initialize = function() {
|
||||
|
||||
this.label1 = cc.LabelAtlas.create("123 Test", "tuffy_bold_italic-charmap.plist");
|
||||
this.label1 = cc.LabelAtlas.create("123 Test", "Fonts/tuffy_bold_italic-charmap.plist");
|
||||
this.addChild( this.label1 );
|
||||
this.label1.setPosition( cc.p(10,100) );
|
||||
this.label1.setOpacity( 200 );
|
||||
|
||||
this.label2 = cc.LabelAtlas.create( "0123456789", "tuffy_bold_italic-charmap.plist" );
|
||||
this.label2 = cc.LabelAtlas.create( "0123456789", "Fonts/tuffy_bold_italic-charmap.plist" );
|
||||
this.addChild( this.label2 );
|
||||
this.label2.setPosition( cc.p(10,200) );
|
||||
this.label2.setOpacity( 32 );
|
||||
|
@ -185,19 +185,19 @@ var BMFontColorTest = function(file) {
|
|||
|
||||
this.initialize = function() {
|
||||
|
||||
var label = cc.LabelBMFont.create("Blue", "bitmapFontTest5.fnt");
|
||||
var label = cc.LabelBMFont.create("Blue", "Fonts/bitmapFontTest5.fnt");
|
||||
this.addChild( label );
|
||||
label.setColor( cc.c3b(0,0,255) );
|
||||
label.setPosition( cc.p( winSize.width/2, 1*winSize.height/4) );
|
||||
label.setAnchorPoint( cc.p(0.5, 0.5) );
|
||||
|
||||
label = cc.LabelBMFont.create("Red", "bitmapFontTest5.fnt");
|
||||
label = cc.LabelBMFont.create("Red", "Fonts/bitmapFontTest5.fnt");
|
||||
this.addChild( label );
|
||||
label.setColor( cc.c3b(255,0,0) );
|
||||
label.setPosition( cc.p( winSize.width/2, 2*winSize.height/4) );
|
||||
label.setAnchorPoint( cc.p(0.5, 0.5) );
|
||||
|
||||
label = cc.LabelBMFont.create("Red", "bitmapFontTest5.fnt");
|
||||
label = cc.LabelBMFont.create("Red", "Fonts/bitmapFontTest5.fnt");
|
||||
this.addChild( label );
|
||||
label.setColor( cc.c3b(0,255,0) );
|
||||
label.setPosition( cc.p( winSize.width/2, 3*winSize.height/4) );
|
|
@ -122,9 +122,9 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
}
|
||||
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
|
||||
|
@ -211,9 +211,9 @@ var MenuItemImageTest = BaseLayer.extend({
|
|||
onEnter:function () {
|
||||
this._super();
|
||||
|
||||
var item1 = cc.MenuItemImage.create("btn-play-normal.png", "btn-play-selected.png" );
|
||||
var item2 = cc.MenuItemImage.create("btn-highscores-normal.png", "btn-highscores-selected.png", this, this.item_cb );
|
||||
var item3 = cc.MenuItemImage.create("btn-about-normal.png", "btn-about-selected.png", this, this.item_cb );
|
||||
var item1 = cc.MenuItemImage.create("Images/btn-play-normal.png", "Images/btn-play-selected.png" );
|
||||
var item2 = cc.MenuItemImage.create("Images/btn-highscores-normal.png", "Images/btn-highscores-selected.png", this, this.item_cb );
|
||||
var item3 = cc.MenuItemImage.create("Images/btn-about-normal.png", "Images/btn-about-selected.png", this, this.item_cb );
|
||||
|
||||
// callback function can be modified in runtime
|
||||
item1.setCallback( this, this.item_cb );
|
||||
|
@ -237,7 +237,7 @@ var MenuItemImageTest = BaseLayer.extend({
|
|||
return "3 items. 3rd should be disabled.";
|
||||
},
|
||||
code:function () {
|
||||
return "item = cc.MenuItemImage.create('normal.png', 'selected.png' , 'disabled.png', this, this.cb )";
|
||||
return "item = cc.MenuItemImage.create('Images/normal.png', 'Images/selected.png' , 'Images/disabled.png', this, this.cb )";
|
||||
},
|
||||
|
||||
// callback
|
||||
|
@ -269,14 +269,14 @@ var MenuItemSpriteTest = BaseLayer.extend({
|
|||
|
||||
// Sprites can't be reused since they are children of MenuItem
|
||||
// If you want to reuse them, use "MenuItemImage" instead
|
||||
var sprite1_1 = cc.Sprite.create("menuitemsprite.png", cc.rect(0, 23*2, 115, 23) );
|
||||
var sprite2_1 = cc.Sprite.create("menuitemsprite.png", cc.rect(0, 23*1, 115, 23) );
|
||||
var sprite1_2 = cc.Sprite.create("menuitemsprite.png", cc.rect(0, 23*2, 115, 23) );
|
||||
var sprite2_2 = cc.Sprite.create("menuitemsprite.png", cc.rect(0, 23*1, 115, 23) );
|
||||
var sprite3_2 = cc.Sprite.create("menuitemsprite.png", cc.rect(0, 23*0, 115, 23) );
|
||||
var sprite1_3 = cc.Sprite.create("menuitemsprite.png", cc.rect(0, 23*2, 115, 23) );
|
||||
var sprite2_3 = cc.Sprite.create("menuitemsprite.png", cc.rect(0, 23*1, 115, 23) );
|
||||
var sprite3_3 = cc.Sprite.create("menuitemsprite.png", cc.rect(0, 23*0, 115, 23) );
|
||||
var sprite1_1 = cc.Sprite.create("Images/menuitemsprite.png", cc.rect(0, 23*2, 115, 23) );
|
||||
var sprite2_1 = cc.Sprite.create("Images/menuitemsprite.png", cc.rect(0, 23*1, 115, 23) );
|
||||
var sprite1_2 = cc.Sprite.create("Images/menuitemsprite.png", cc.rect(0, 23*2, 115, 23) );
|
||||
var sprite2_2 = cc.Sprite.create("Images/menuitemsprite.png", cc.rect(0, 23*1, 115, 23) );
|
||||
var sprite3_2 = cc.Sprite.create("Images/menuitemsprite.png", cc.rect(0, 23*0, 115, 23) );
|
||||
var sprite1_3 = cc.Sprite.create("Images/menuitemsprite.png", cc.rect(0, 23*2, 115, 23) );
|
||||
var sprite2_3 = cc.Sprite.create("Images/menuitemsprite.png", cc.rect(0, 23*1, 115, 23) );
|
||||
var sprite3_3 = cc.Sprite.create("Images/menuitemsprite.png", cc.rect(0, 23*0, 115, 23) );
|
||||
|
||||
var item1 = cc.MenuItemSprite.create(sprite1_1, sprite2_1);
|
||||
var item2 = cc.MenuItemSprite.create(sprite1_2, sprite2_2, sprite3_2, this, this.item_cb);
|
||||
|
@ -335,7 +335,7 @@ var MenuItemLabelTest = BaseLayer.extend({
|
|||
this._super();
|
||||
|
||||
var label1 = cc.LabelTTF.create("This is a LabelTTF item", "Arial", 24 );
|
||||
var label2 = cc.LabelBMFont.create("And this is a LabelBMFont item", "futura-48.fnt" );
|
||||
var label2 = cc.LabelBMFont.create("And this is a LabelBMFont item", "Fonts/futura-48.fnt" );
|
||||
var label3 = cc.LabelTTF.create("Disabled Item", "Arial", 24 );
|
||||
|
||||
var item1 = cc.MenuItemLabel.create(label1);
|
||||
|
@ -393,9 +393,9 @@ var MenuItemToggleTest = BaseLayer.extend({
|
|||
onEnter:function () {
|
||||
this._super();
|
||||
|
||||
var label1 = cc.LabelBMFont.create("Volume Off", "futura-48.fnt" );
|
||||
var label1 = cc.LabelBMFont.create("Volume Off", "Fonts/futura-48.fnt" );
|
||||
var item1 = cc.MenuItemLabel.create(label1);
|
||||
var label2 = cc.LabelBMFont.create("Volume On", "futura-48.fnt" );
|
||||
var label2 = cc.LabelBMFont.create("Volume On", "Fonts/futura-48.fnt" );
|
||||
var item2 = cc.MenuItemLabel.create(label2);
|
||||
|
||||
var itema = cc.MenuItemFont.create("Sound Off");
|
|
@ -123,9 +123,9 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
}
|
||||
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
|
||||
|
@ -158,7 +158,7 @@ ParallaxTest1 = BaseLayer.extend({
|
|||
this._super();
|
||||
|
||||
// Top Layer, a simple image
|
||||
var cocosImage = cc.Sprite.create("powered.png");
|
||||
var cocosImage = cc.Sprite.create("Images/powered.png");
|
||||
// scale the image (optional)
|
||||
cocosImage.setScale(1.5);
|
||||
// change the transform anchor point to 0,0 (optional)
|
||||
|
@ -175,7 +175,7 @@ ParallaxTest1 = BaseLayer.extend({
|
|||
tilemap.getTexture().setAntiAliasTexParameters();
|
||||
|
||||
// background layer: another image
|
||||
var background = cc.Sprite.create("background.png");
|
||||
var background = cc.Sprite.create("Images/background.png");
|
||||
// scale the image (optional)
|
||||
background.setScale(1.5);
|
||||
// change the transform anchor point (optional)
|
||||
|
@ -236,7 +236,7 @@ ParallaxTest2 = BaseLayer.extend({
|
|||
this.setTouchEnabled( true );
|
||||
|
||||
// Top Layer, a simple image
|
||||
var cocosImage = cc.Sprite.create("powered.png");
|
||||
var cocosImage = cc.Sprite.create("Images/powered.png");
|
||||
// scale the image (optional)
|
||||
cocosImage.setScale(1.5);
|
||||
// change the transform anchor point to 0,0 (optional)
|
||||
|
@ -254,7 +254,7 @@ ParallaxTest2 = BaseLayer.extend({
|
|||
|
||||
|
||||
// background layer: another image
|
||||
var background = cc.Sprite.create("background.png");
|
||||
var background = cc.Sprite.create("Images/background.png");
|
||||
// scale the image (optional)
|
||||
background.setScale(1.5);
|
||||
// change the transform anchor point (optional)
|
|
@ -60,12 +60,12 @@ var loadScene = function (sceneIdx)
|
|||
//
|
||||
var TAG_LABEL_ATLAS = 100;
|
||||
|
||||
var s_stars1 = 'stars.png';
|
||||
var s_stars2 = 'stars2.png';
|
||||
var s_starsGrayscale = 'stars-grayscale.png';
|
||||
var s_fire = 'fire.png';
|
||||
var s_smoke = 'smoke.png';
|
||||
var s_snow = 'snow.png';
|
||||
var s_stars1 = 'Images/stars.png';
|
||||
var s_stars2 = 'Images/stars2.png';
|
||||
var s_starsGrayscale = 'Images/stars-grayscale.png';
|
||||
var s_fire = 'Images/fire.png';
|
||||
var s_smoke = 'Images/smoke.png';
|
||||
var s_snow = 'Images/snow.png';
|
||||
|
||||
//
|
||||
// Base Layer
|
||||
|
@ -113,11 +113,11 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
this.addChild(menu, 1);
|
||||
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
cc.MenuItemFont.setFontSize( 22 );
|
||||
|
||||
var menu = cc.Menu.create(item1, item2, item3, item4 );
|
||||
|
||||
|
@ -127,7 +127,7 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
item3.setPosition( cc.p(winSize.width / 2 + 100, 30));
|
||||
item4.setPosition( cc.p(winSize.width - 60, winSize.height - 30 ) );
|
||||
|
||||
this.addChild(menu, 1);
|
||||
this.addChild(menu, 10);
|
||||
|
||||
|
||||
//TODO
|
||||
|
@ -136,7 +136,7 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
labelAtlas.setPosition( cc.p( winSize.width - 66, 50));
|
||||
|
||||
// moving background
|
||||
this._background = cc.Sprite.create("background3.png");
|
||||
this._background = cc.Sprite.create("Images/background3.png");
|
||||
this.addChild(this._background, 5);
|
||||
this._background.setPosition(cc.p(winSize.width / 2, winSize.height - 180));
|
||||
|
||||
|
@ -161,7 +161,7 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
onEnter:function () {
|
||||
// don't call super_.this()
|
||||
var pLabel = this.getChildByTag(1000);
|
||||
pLabel.setString(this.title());
|
||||
//cjh pLabel.setString(this.title());
|
||||
},
|
||||
title:function () {
|
||||
return "No title";
|
||||
|
@ -202,7 +202,9 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
var pos = cc.p( 0, 0 );
|
||||
if (this._background)
|
||||
pos = this._background.convertToWorldSpace( cc.p(0,0) );
|
||||
this._emitter.setPosition(cc.pSub(location, pos));
|
||||
if (this._emitter) {
|
||||
this._emitter.setPosition(cc.pSub(location, pos));
|
||||
}
|
||||
},
|
||||
|
||||
onMouseDown : function( event ) {
|
||||
|
@ -698,8 +700,8 @@ var ParallaxParticle = BaseLayer.extend({
|
|||
var p = cc.ParallaxNode.create();
|
||||
this.addChild(p, 5);
|
||||
|
||||
var p1 = cc.Sprite.create("background3.png");
|
||||
var p2 = cc.Sprite.create("background3.png");
|
||||
var p1 = cc.Sprite.create("Images/background3.png");
|
||||
var p2 = cc.Sprite.create("Images/background3.png");
|
||||
|
||||
p.addChild(p1, 1, cc.p(0.5, 1), cc.p(0, 250));
|
||||
p.addChild(p2, 2, cc.p(1.5, 1), cc.p(0, 50));
|
||||
|
@ -1066,7 +1068,7 @@ var Issue870 = BaseLayer.extend({
|
|||
this._background = null;
|
||||
|
||||
var system = cc.ParticleSystem.create( "Particles/SpinningPeas.plist" );
|
||||
system.setTextureWithRect(cc.TextureCache.getInstance().addImage("particles.png"), cc.rect(0, 0, 32, 32));
|
||||
system.setTextureWithRect(cc.TextureCache.getInstance().addImage("Images/particles.png"), cc.rect(0, 0, 32, 32));
|
||||
this.addChild(system, 10);
|
||||
this._emitter = system;
|
||||
|
|
@ -55,9 +55,9 @@ var loadScene = function (sceneIdx)
|
|||
// __jsc__.garbageCollect();
|
||||
}
|
||||
|
||||
var s_pathSister1 = "grossinis_sister1.png";
|
||||
var s_pathSister2 = "grossinis_sister2.png";
|
||||
var s_pathBlock = "blocks.png";
|
||||
var s_pathSister1 = "Images/grossinis_sister1.png";
|
||||
var s_pathSister2 = "Images/grossinis_sister2.png";
|
||||
var s_pathBlock = "Images/blocks.png";
|
||||
var s_grossiniPlist = "animations/grossini.plist";
|
||||
|
||||
//
|
||||
|
@ -126,9 +126,9 @@ var BaseLayer = cc.LayerGradient.extend({
|
|||
}
|
||||
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
|
||||
|
@ -164,7 +164,7 @@ var RenderTextureSave = BaseLayer.extend({
|
|||
else if( platform.substring(0,6) == 'mobile' )
|
||||
this.setTouchEnabled( true );
|
||||
|
||||
this._brush = cc.Sprite.create("fire.png");
|
||||
this._brush = cc.Sprite.create("Images/fire.png");
|
||||
this._brush.retain();
|
||||
|
||||
this._brush.setColor( cc.RED );
|
|
@ -93,11 +93,11 @@ BaseLayer.prototype.onEnter = function() {
|
|||
}
|
||||
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
cc.MenuItemFont.setFontSize( 22 );
|
||||
|
||||
var menu = cc.Menu.create(item1, item2, item3, item4 );
|
||||
|
||||
|
@ -178,7 +178,7 @@ SpriteTouchTest.prototype.createSprite = function( pos ) {
|
|||
var x = Math.floor(idx%5) * 85;
|
||||
var y = Math.floor(idx/5) * 121;
|
||||
|
||||
var sprite = cc.Sprite.create("grossini_dance_atlas.png", cc.rect(x,y,85,121) );
|
||||
var sprite = cc.Sprite.create("Images/grossini_dance_atlas.png", cc.rect(x,y,85,121) );
|
||||
sprite.setPosition( pos );
|
||||
|
||||
var rand = Math.random();
|
||||
|
@ -213,7 +213,7 @@ var SpriteBatchTouchTest = function() {
|
|||
goog.base(this);
|
||||
|
||||
this.initialize = function() {
|
||||
this.batch = cc.SpriteBatchNode.create("grossini_dance_atlas.png", 50 );
|
||||
this.batch = cc.SpriteBatchNode.create("Images/grossini_dance_atlas.png", 50 );
|
||||
this.addChild( this.batch );
|
||||
|
||||
var platform = __getPlatform();
|
||||
|
@ -354,10 +354,10 @@ var SpriteAnchorPoint = function() {
|
|||
|
||||
this.initialize = function() {
|
||||
for(var i=0;i<3;i++) {
|
||||
var sprite = cc.Sprite.create("grossini_dance_atlas.png", cc.rect(85*i, 121*1, 85, 121) );
|
||||
var sprite = cc.Sprite.create("Images/grossini_dance_atlas.png", cc.rect(85*i, 121*1, 85, 121) );
|
||||
sprite.setPosition( cc.p( winSize.width/4*(i+1), winSize.height/2) );
|
||||
|
||||
var point = cc.Sprite.create( "r1.png" );
|
||||
var point = cc.Sprite.create( "Images/r1.png" );
|
||||
point.setScale( 0.25 );
|
||||
point.setPosition( sprite.getPosition() );
|
||||
this.addChild( point, 10 );
|
||||
|
@ -402,12 +402,12 @@ var SpriteBatchAnchorPoint = function() {
|
|||
goog.base(this);
|
||||
|
||||
this.initialize = function() {
|
||||
var batch = cc.SpriteBatchNode.create( "grossini_dance_atlas.png" );
|
||||
var batch = cc.SpriteBatchNode.create( "Images/grossini_dance_atlas.png" );
|
||||
for(var i=0;i<3;i++) {
|
||||
var sprite = cc.Sprite.create("grossini_dance_atlas.png", cc.rect(85*i, 121*1, 85, 121) );
|
||||
var sprite = cc.Sprite.create("Images/grossini_dance_atlas.png", cc.rect(85*i, 121*1, 85, 121) );
|
||||
sprite.setPosition( cc.p( winSize.width/4*(i+1), winSize.height/2) );
|
||||
|
||||
var point = cc.Sprite.create( "r1.png" );
|
||||
var point = cc.Sprite.create( "Images/r1.png" );
|
||||
point.setScale( 0.25 );
|
||||
point.setPosition( sprite.getPosition() );
|
||||
this.addChild( point, 10 );
|
||||
|
@ -458,10 +458,10 @@ var SpriteOffsetAnchorFlip = function() {
|
|||
cache.addSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray.png");
|
||||
|
||||
for(var i=0;i<3;i++) {
|
||||
var sprite = cc.Sprite.create("grossini_dance_atlas.png", cc.rect(85*i, 121*1, 85, 121) );
|
||||
var sprite = cc.Sprite.create("Images/grossini_dance_atlas.png", cc.rect(85*i, 121*1, 85, 121) );
|
||||
sprite.setPosition( cc.p( winSize.width/4*(i+1), winSize.height/2) );
|
||||
|
||||
var point = cc.Sprite.create( "r1.png" );
|
||||
var point = cc.Sprite.create( "Images/r1.png" );
|
||||
point.setScale( 0.25 );
|
||||
point.setPosition( sprite.getPosition() );
|
||||
this.addChild( point, 10 );
|
||||
|
@ -535,7 +535,7 @@ var SpriteBatchOffsetAnchorFlip = function() {
|
|||
var sprite = cc.Sprite.createWithSpriteFrameName("grossini_dance_01.png");
|
||||
sprite.setPosition( cc.p( winSize.width/4*(i+1), winSize.height/2) );
|
||||
|
||||
var point = cc.Sprite.create( "r1.png" );
|
||||
var point = cc.Sprite.create( "Images/r1.png" );
|
||||
point.setScale( 0.25 );
|
||||
point.setPosition( sprite.getPosition() );
|
||||
this.addChild( point, 10 );
|
||||
|
@ -601,14 +601,14 @@ var SpriteColorOpacity = function() {
|
|||
goog.base(this);
|
||||
|
||||
this.initialize = function() {
|
||||
var sprite1 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 0, 121 * 1, 85, 121));
|
||||
var sprite2 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 1, 121 * 1, 85, 121));
|
||||
var sprite3 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 2, 121 * 1, 85, 121));
|
||||
var sprite4 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 3, 121 * 1, 85, 121));
|
||||
var sprite5 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 0, 121 * 1, 85, 121));
|
||||
var sprite6 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 1, 121 * 1, 85, 121));
|
||||
var sprite7 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 2, 121 * 1, 85, 121));
|
||||
var sprite8 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 3, 121 * 1, 85, 121));
|
||||
var sprite1 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 0, 121 * 1, 85, 121));
|
||||
var sprite2 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 1, 121 * 1, 85, 121));
|
||||
var sprite3 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 2, 121 * 1, 85, 121));
|
||||
var sprite4 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 3, 121 * 1, 85, 121));
|
||||
var sprite5 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 0, 121 * 1, 85, 121));
|
||||
var sprite6 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 1, 121 * 1, 85, 121));
|
||||
var sprite7 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 2, 121 * 1, 85, 121));
|
||||
var sprite8 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 3, 121 * 1, 85, 121));
|
||||
|
||||
sprite1.setPosition(cc.p((winSize.width / 5) * 1, (winSize.height / 3) * 1));
|
||||
sprite2.setPosition(cc.p((winSize.width / 5) * 2, (winSize.height / 3) * 1));
|
||||
|
@ -677,15 +677,15 @@ var SpriteBatchColorOpacity = function() {
|
|||
goog.base(this);
|
||||
|
||||
this.initialize = function() {
|
||||
var batch = cc.SpriteBatchNode.create('grossini_dance_atlas.png', 10);
|
||||
var sprite1 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 0, 121 * 1, 85, 121));
|
||||
var sprite2 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 1, 121 * 1, 85, 121));
|
||||
var sprite3 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 2, 121 * 1, 85, 121));
|
||||
var sprite4 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 3, 121 * 1, 85, 121));
|
||||
var sprite5 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 0, 121 * 1, 85, 121));
|
||||
var sprite6 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 1, 121 * 1, 85, 121));
|
||||
var sprite7 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 2, 121 * 1, 85, 121));
|
||||
var sprite8 = cc.Sprite.create('grossini_dance_atlas.png', cc.rect(85 * 3, 121 * 1, 85, 121));
|
||||
var batch = cc.SpriteBatchNode.create('Images/grossini_dance_atlas.png', 10);
|
||||
var sprite1 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 0, 121 * 1, 85, 121));
|
||||
var sprite2 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 1, 121 * 1, 85, 121));
|
||||
var sprite3 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 2, 121 * 1, 85, 121));
|
||||
var sprite4 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 3, 121 * 1, 85, 121));
|
||||
var sprite5 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 0, 121 * 1, 85, 121));
|
||||
var sprite6 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 1, 121 * 1, 85, 121));
|
||||
var sprite7 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 2, 121 * 1, 85, 121));
|
||||
var sprite8 = cc.Sprite.create('Images/grossini_dance_atlas.png', cc.rect(85 * 3, 121 * 1, 85, 121));
|
||||
|
||||
sprite1.setPosition(cc.p((winSize.width / 5) * 1, (winSize.height / 3) * 1));
|
||||
sprite2.setPosition(cc.p((winSize.width / 5) * 2, (winSize.height / 3) * 1));
|
|
@ -133,11 +133,11 @@ var BaseLayer = cc.Layer.extend({
|
|||
}
|
||||
|
||||
// Menu
|
||||
var item1 = cc.MenuItemImage.create("b1.png", "b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("r1.png", "r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("f1.png", "f2.png", this, this.nextCallback);
|
||||
var item1 = cc.MenuItemImage.create("Images/b1.png", "Images/b2.png", this, this.backCallback);
|
||||
var item2 = cc.MenuItemImage.create("Images/r1.png", "Images/r2.png", this, this.restartCallback);
|
||||
var item3 = cc.MenuItemImage.create("Images/f1.png", "Images/f2.png", this, this.nextCallback);
|
||||
var item4 = cc.MenuItemFont.create("back", this, function() { require("js/main.js"); } );
|
||||
item4.setFontSize( 22 );
|
||||
cc.MenuItemFont.setFontSize( 22 );
|
||||
|
||||
var menu = cc.Menu.create(item1, item2, item3, item4 );
|
||||
|
||||
|
@ -815,7 +815,7 @@ var TMXIsoZorder = BaseLayer.extend({
|
|||
var s = map.getContentSize();
|
||||
map.setPosition(cc.p(-s.width / 2, 0));
|
||||
|
||||
this.tamara = cc.Sprite.create("grossinis_sister1.png");
|
||||
this.tamara = cc.Sprite.create("Images/grossinis_sister1.png");
|
||||
map.addChild(this.tamara, map.getChildren().length);
|
||||
|
||||
// move map to the center of the screen
|
||||
|
@ -875,7 +875,7 @@ var TMXOrthoZorder = BaseLayer.extend({
|
|||
|
||||
var s = map.getContentSize();
|
||||
|
||||
this.tamara = cc.Sprite.create("grossinis_sister1.png");
|
||||
this.tamara = cc.Sprite.create("Images/grossinis_sister1.png");
|
||||
map.addChild(this.tamara, map.getChildren().length, TAG_TILE_MAP);
|
||||
this.tamara.setAnchorPoint(cc.p(0.5, 0));
|
||||
|
Loading…
Reference in New Issue