From 28eed3c8e0cbd8228c9e0b4b8ff71e12b0ada977 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 4 Dec 2013 17:51:53 +0800 Subject: [PATCH] issue #2790: Reverts HelloWorldScene.cpp. --- .../Cpp/HelloCpp/Classes/HelloWorldScene.cpp | 91 +------------------ 1 file changed, 1 insertion(+), 90 deletions(-) diff --git a/samples/Cpp/HelloCpp/Classes/HelloWorldScene.cpp b/samples/Cpp/HelloCpp/Classes/HelloWorldScene.cpp index eab8247f4a..077a92aa11 100644 --- a/samples/Cpp/HelloCpp/Classes/HelloWorldScene.cpp +++ b/samples/Cpp/HelloCpp/Classes/HelloWorldScene.cpp @@ -2,10 +2,10 @@ #include "AppMacros.h" #include "CCEventListenerTouch.h" -#include "CCVector.h" USING_NS_CC; + Scene* HelloWorld::scene() { // 'scene' is an autorelease object @@ -21,94 +21,9 @@ Scene* HelloWorld::scene() return scene; } -void showSprites(const Vector& sprites) -{ - log("container size = %ld", sprites.count()); - for (auto& sp : sprites) - { - log("sp tag: %d, ref count = %d", sp->getTag(), sp->retainCount()); - } -} - -Vector createAllSprites() -{ - Vector ret; - ret.addObject(Sprite::create()); - ret.addObject(Sprite::create()); - return ret; -} - // on "init" you need to initialize your instance bool HelloWorld::init() { - - Vector container; - - for (int i = 0; i < 10; ++i) - { - auto sp = Sprite::create(); - sp->setTag(i); - container.addObject(sp); - } - -// -// showSprites(container); -// -// Vector containerCopy = container; -// -// showSprites(containerCopy); -// -// containerCopy = container; -// -// showSprites(containerCopy); - -// Vector moveVector(createAllSprites()); -// showSprites(moveVector); -// -// CCLOG("------------- 2 ----------"); -// moveVector = createAllSprites(); -// showSprites(moveVector); -// -// CCLOG("------------- 3 ----------"); -// Vector aaa; -// aaa.addObject(Sprite::create()); -// moveVector = aaa; -// showSprites(moveVector); - - log("size of Vector = %ld", sizeof(Vector)); - - Map map; - map.setObject(Sprite::create(), "1"); - map.setObject(Sprite::create(), "2"); - map.setObject(Sprite::create(), "3"); - - auto showMap = [](const Map& map) - { - for (auto iter = map.begin(); iter != map.end(); ++iter) - { - log("key = %s, value = %p, ref = %d", iter->first.c_str(), iter->second, iter->second ? iter->second->retainCount() : 0); - } - }; - - showMap(map); - -// auto iter = std::find(map.begin(), map.end(), std::string("111")); -// if (iter != map.end()) -// { -// log("found!"); -// } -// else -// { -// log("not found!"); -// } - -// map["111"]; -// log("key[1]=%p", map["1"]); -// log("----------------------"); -// map["11"]->setPosition(Point(100, 100)); - - showMap(map); - ////////////////////////////// // 1. super init first if ( !Layer::init() ) @@ -160,10 +75,6 @@ bool HelloWorld::init() // add the sprite as a child to this layer this->addChild(sprite); - this->getChildren().forEach([](Node* node){ - log("node = %p, name = %s", node, typeid(*node).name()); - }); - return true; }