From d2dd57d4124a494b26a6ae244fcd71335803478c Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Mon, 14 Apr 2014 11:45:06 +0800 Subject: [PATCH] change indention to space and remove comment code --- .../NewRendererTest/NewRendererTest.cpp | 32 ++++++++----------- .../Classes/NewRendererTest/NewRendererTest.h | 2 +- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp index 94c42396e2..312100f39d 100644 --- a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp +++ b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp @@ -488,37 +488,33 @@ NewCullingTest::NewCullingTest() addChild(sprite2); auto listener = EventListenerTouchOneByOne::create(); - listener->setSwallowTouches(true); + listener->setSwallowTouches(true); - listener->onTouchBegan = CC_CALLBACK_2(NewCullingTest::onTouchBegan, this); - listener->onTouchMoved = CC_CALLBACK_2(NewCullingTest::onTouchMoved, this); + listener->onTouchBegan = CC_CALLBACK_2(NewCullingTest::onTouchBegan, this); + listener->onTouchMoved = CC_CALLBACK_2(NewCullingTest::onTouchMoved, this); - _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); } bool NewCullingTest::onTouchBegan(Touch* touch, Event *event) { - auto pos = touch->getLocation(); - _lastPos = pos; - return true; + auto pos = touch->getLocation(); + _lastPos = pos; + return true; } void NewCullingTest::onTouchMoved(Touch* touch, Event *event) -{ - //Point pos = touch->getLocationInView(); //ªÒ»°¥•√˛Œª÷√ - //pos = Director::getInstance()->convertToGL(pos);//◊¯±Í◊™ªª - //setPosition(pos); +{ + auto pos = touch->getLocation(); - auto pos = touch->getLocation(); + auto offset = pos - _lastPos; - auto offset = pos - _lastPos; + auto layerPos = getPosition(); + auto newPos = layerPos + offset; - auto layerPos = getPosition(); - auto newPos = layerPos + offset; - - setPosition(newPos); - _lastPos = pos; + setPosition(newPos); + _lastPos = pos; } NewCullingTest::~NewCullingTest() diff --git a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h index 686b5f43b9..ddafaf97c2 100644 --- a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h +++ b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h @@ -130,7 +130,7 @@ protected: NewCullingTest(); virtual ~NewCullingTest(); bool onTouchBegan(Touch* touch, Event *event); - void onTouchMoved(Touch* touch, Event *event); + void onTouchMoved(Touch* touch, Event *event); Point _lastPos; };