mirror of https://github.com/axmolengine/axmol.git
Remove clickAndMove testcase
This commit is contained in:
parent
2e9e660cbb
commit
f3190206e0
|
@ -31,7 +31,6 @@
|
||||||
"src/TouchesTest/Paddle.js",
|
"src/TouchesTest/Paddle.js",
|
||||||
"src/TouchesTest/TouchesTest.js",
|
"src/TouchesTest/TouchesTest.js",
|
||||||
"src/SchedulerTest/SchedulerTest.js",
|
"src/SchedulerTest/SchedulerTest.js",
|
||||||
"src/ClickAndMoveTest/ClickAndMoveTest.js",
|
|
||||||
"src/MenuTest/MenuTest.js",
|
"src/MenuTest/MenuTest.js",
|
||||||
"src/ActionsTest/ActionsTest.js",
|
"src/ActionsTest/ActionsTest.js",
|
||||||
"src/TileMapTest/TileMapTest.js",
|
"src/TileMapTest/TileMapTest.js",
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2008-2010 Ricardo Quesada
|
|
||||||
Copyright (c) 2011-2012 cocos2d-x.org
|
|
||||||
Copyright (c) 2013-2014 Chukong Technologies 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_SPRITE = 1;
|
|
||||||
|
|
||||||
var ClickAndMoveTestScene = TestScene.extend({
|
|
||||||
runThisTest:function () {
|
|
||||||
var layer = new ClickAndMoveTestLayer();
|
|
||||||
|
|
||||||
this.addChild(layer);
|
|
||||||
director.runScene(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var ClickAndMoveTestLayer = cc.Layer.extend({
|
|
||||||
ctor:function () {
|
|
||||||
|
|
||||||
if(window.sideIndexBar){
|
|
||||||
window.sideIndexBar.changeTest(0, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._super();
|
|
||||||
|
|
||||||
this.init();
|
|
||||||
|
|
||||||
if( 'touches' in cc.sys.capabilities )
|
|
||||||
cc.eventManager.addListener(cc.EventListener.create({
|
|
||||||
event: cc.EventListener.TOUCH_ALL_AT_ONCE,
|
|
||||||
onTouchesEnded:function (touches, event) {
|
|
||||||
if (touches.length <= 0)
|
|
||||||
return;
|
|
||||||
event.getCurrentTarget().moveSprite(touches[0].getLocation());
|
|
||||||
}
|
|
||||||
}), this);
|
|
||||||
else if ('mouse' in cc.sys.capabilities )
|
|
||||||
cc.eventManager.addListener({
|
|
||||||
event: cc.EventListener.MOUSE,
|
|
||||||
onMouseUp: function (event) {
|
|
||||||
event.getCurrentTarget().moveSprite(event.getLocation());
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
var sprite = new cc.Sprite(s_pathGrossini);
|
|
||||||
|
|
||||||
var layer = new cc.LayerColor(cc.color(255, 255, 0, 100));
|
|
||||||
this.addChild(layer, -1);
|
|
||||||
|
|
||||||
this.addChild(sprite, 0, TAG_SPRITE);
|
|
||||||
sprite.x = 20;
|
|
||||||
sprite.y = 150;
|
|
||||||
|
|
||||||
sprite.runAction(cc.jumpTo(4, cc.p(300, 48), 100, 4));
|
|
||||||
|
|
||||||
var fadeIn = cc.fadeIn(1);
|
|
||||||
var fadeOut = cc.fadeOut(1);
|
|
||||||
var forever = cc.sequence(fadeIn, fadeOut).repeatForever();
|
|
||||||
layer.runAction(forever);
|
|
||||||
},
|
|
||||||
|
|
||||||
moveSprite:function(position) {
|
|
||||||
var sprite = this.getChildByTag(TAG_SPRITE);
|
|
||||||
sprite.stopAllActions();
|
|
||||||
sprite.runAction(cc.moveTo(1, position));
|
|
||||||
var o = position.x - sprite.x;
|
|
||||||
var a = position.y - sprite.y;
|
|
||||||
var at = Math.atan(o / a) * 57.29577951; // radians to degrees
|
|
||||||
|
|
||||||
if (a < 0) {
|
|
||||||
if (o < 0)
|
|
||||||
at = 180 + Math.abs(at);
|
|
||||||
else
|
|
||||||
at = 180 - Math.abs(at);
|
|
||||||
}
|
|
||||||
|
|
||||||
sprite.runAction(cc.rotateTo(1, at));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var arrayOfClickMoveTest = [ClickAndMoveTestLayer];
|
|
|
@ -291,15 +291,6 @@ var testNames = [
|
||||||
return new ChipmunkTestScene();
|
return new ChipmunkTestScene();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//"BugsTest",
|
|
||||||
{
|
|
||||||
title:"Click and Move Test",
|
|
||||||
platforms: PLATFORM_ALL,
|
|
||||||
linksrc:"src/ClickAndMoveTest/ClickAndMoveTest.js",
|
|
||||||
testScene:function () {
|
|
||||||
return new ClickAndMoveTestScene();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title:"ClippingNode Test",
|
title:"ClippingNode Test",
|
||||||
platforms: PLATFORM_ALL,
|
platforms: PLATFORM_ALL,
|
||||||
|
|
Loading…
Reference in New Issue