最近,我刚开始学coco2d-x 我会写我的学习经验来 首先TestCppproject有许多例子文件夹,而在这些文件夹以外的其他文件 。我首先研究这些文件:

controller.h/cpp:管理方案,所有演示样品菜单      

AppDelegate.h/cpp:程序控制类

tests.h:实例总头文件       

testBasic.h/cpp:演示样例场景基类

testResource.h:文件资源名称

VisibleRect.h/cpp:屏幕大小

接下来我将一一分析以上的文件

1.AppDelegate.h/cpp:

AppDelegate.h

  1. class AppDelegate : private cocos2d::CCApplication
  2. {
  3. public:
  4. AppDelegate();
  5. virtual ~AppDelegate();
  6. virtual bool applicationDidFinishLaunching();//实现CCDirector和CCScene的初始化。假设失败则终止
  7. virtual void applicationDidEnterBackground();//函数被调用时。应用进入后台
  8. virtual void applicationWillEnterForeground();//函数被调用是,应用显示在前台
  9. };

AppDelegate.cpp

  1. #include "AppDelegate.h"
  2.  
  3. #include "cocos2d.h"
  4. #include "controller.h"
  5. #include "SimpleAudioEngine.h"
  6. #include "cocos-ext.h"
  7.  
  8. USING_NS_CC;
  9. using namespace CocosDenshion;
  10.  
  11. AppDelegate::AppDelegate()
  12. {
  13. }
  14.  
  15. AppDelegate::~AppDelegate()
  16. {
  17. // SimpleAudioEngine::end();
  18. cocos2d::extension::CCArmatureDataManager::purge();//清空数据
  19. }
  20.  
  21. bool AppDelegate::applicationDidFinishLaunching()
  22. {
  23. // As an example, load config file
  24. // XXX: This should be loaded before the Director is initialized,
  25. // XXX: but at this point, the director is already initialized
  26. CCConfiguration::sharedConfiguration()->loadConfigFile("configs/config-example.plist");//载入配置文件
  27.  
  28. // initialize director
  29. CCDirector *pDirector = CCDirector::sharedDirector();//获得导演对象
  30. pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());//设置OpenGL视窗
  31.  
  32. CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();//获取屏幕大小
  33.  
  34. CCSize designSize = CCSizeMake(480, 320);//设置设计分辨率大小
  35.  
  36. CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();//使用文件资源
  37. std::vector<std::string> searchPaths;//声明一个string类型的向量
  38.  
  39. if (screenSize.height > 320) //下面都是设置屏幕分辨率。这个是高分辨率
  40. {
  41. CCSize resourceSize = CCSizeMake(960, 640);//设置资源分辨率大小
  42. searchPaths.push_back("hd");
  43. searchPaths.push_back("hd/scenetest");
  44. pDirector->setContentScaleFactor(resourceSize.height/designSize.height);//设置屏幕比例系数
  45. }
  46. else//低分辨率
  47. {
  48. searchPaths.push_back("scenetest");
  49. }
  50. pFileUtils->setSearchPaths(searchPaths);
  51.  
  52. #if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
  53. CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionShowAll);
  54. #else
  55. CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);
  56. #endif
  57.  
  58. CCScene * pScene = CCScene::create();//创建场景
  59. CCLayer * pLayer = new TestController();//创建层
  60. pLayer->autorelease();//使用内存管理器自己主动回收
  61.  
  62. pScene->addChild(pLayer);//将层加入进场景中
  63. pDirector->runWithScene(pScene);//执行创建的场景
  64.  
  65. return true;
  66. }
  67.  
  68. // This function will be called when the app is inactive. When comes a phone call,it's be invoked too
  69. void AppDelegate::applicationDidEnterBackground()//当应用进入后台是被调用
  70. {
  71. CCDirector::sharedDirector()->stopAnimation();
  72. SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
  73. SimpleAudioEngine::sharedEngine()->pauseAllEffects();
  74. }
  75.  
  76. // this function will be called when the app is active again
  77. void AppDelegate::applicationWillEnterForeground()//应用显示在前台
  78. {
  79. CCDirector::sharedDirector()->startAnimation();
  80. SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
  81. SimpleAudioEngine::sharedEngine()->resumeAllEffects();
  82. }

2.testBase.h/cpp  

testBase.h:

  1. #ifndef _TEST_BASIC_H_
  2. #define _TEST_BASIC_H_
  3.  
  4. #include "cocos2d.h"
  5. #include "VisibleRect.h"
  6.  
  7. USING_NS_CC;
  8. using namespace std;
  9.  
  10. class TestScene : public CCScene
  11. {
  12. public:
  13. TestScene(bool bPortrait = false);//设置标志是否实例化TestScene
  14. virtual void onEnter();//场景被载入时被调用
  15.  
  16. virtual void runThisTest() = 0;//用于执行场景
  17.  
  18. // The CallBack for back to the main menu scene
  19. virtual void MainMenuCallback(CCObject* pSender);//回调MainMenuCallback()返回主界面
  20. };
  21.  
  22. typedef CCLayer* (*NEWTESTFUNC)();//定义NEWTESTFUNC()指针函数为CCLayer
  23. #define TESTLAYER_CREATE_FUNC(className) \ //定义定义createclassName()函数为TESTAYER_CREATE_FUNC
  24. static CCLayer* create##className() \ //返回className()
  25. { return new className(); }
  26.  
  27. #define CF(className) create##className //定义createclassName为CF(classname)
  28.  
  29. #endif

testBase.cpp

  1. #include "testBasic.h"
  2. #include "controller.h"
  3.  
  4. TestScene::TestScene(bool bPortrait)//构造函数
  5. {
  6.  
  7. CCScene::init();
  8. }
  9.  
  10. void TestScene::onEnter()//场景载入时的函数
  11. {
  12. CCScene::onEnter();
  13.  
  14. //add the menu item for back to main menu
  15. //#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
  16. // CCLabelBMFont* label = CCLabelBMFont::create("MainMenu", "fonts/arial16.fnt");
  17. //#else
  18. CCLabelTTF* label = CCLabelTTF::create("MainMenu", "Arial", 20);//显示一个文字标签
  19. //#endif
  20. CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(TestScene::MainMenuCallback)); //添加一个菜单标签 并添加了回调函数
  21.  
  22. CCMenu* pMenu =CCMenu::create(pMenuItem, NULL);//将菜单标签添加菜单中
  23.  
  24. pMenu->setPosition( CCPointZero );
  25. pMenuItem->setPosition( ccp( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
  26.  
  27. addChild(pMenu, 1); //将菜单添加场景中
  28. }
  29.  
  30. void TestScene::MainMenuCallback(CCObject* pSender)
  31. {
  32. CCScene* pScene = CCScene::create(); //新创建一个场景
  33. CCLayer* pLayer = new TestController();//实例化一个主菜单的层
  34. pLayer->autorelease();
  35.  
  36. pScene->addChild(pLayer);
  37. CCDirector::sharedDirector()->replaceScene(pScene);//用主菜单的场景和层用以替换之前的场景
  38. }

3.controller.h/cpp

controller.h

  1. #ifndef _CONTROLLER_H_
  2. #define _CONTROLLER_H_
  3.  
  4. #include "cocos2d.h"
  5.  
  6. USING_NS_CC;
  7.  
  8. class TestController : public CCLayer
  9. {
  10. public:
  11. TestController();
  12. ~TestController();
  13.  
  14. void menuCallback(CCObject * pSender); //菜单项响应回调函数
  15. void closeCallback(CCObject * pSender); //关闭程序回调函数
  16.  
  17. virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);//按下触点响应函数
  18. virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);//按下状态移动触点响应函数
  19.  
  20. private:
  21. CCPoint m_tBeginPos;//按下状态移动触点的開始位置
  22. CCMenu* m_pItemMenu;//主菜单
  23. };
  24.  
  25. #endif

controller.cpp

  1. #include "controller.h"
  2. #include "testResource.h"
  3. #include "tests.h"
  4.  
  5. #define LINE_SPACE 40//菜单项的行间距
  6.  
  7. static CCPoint s_tCurPos = CCPointZero;//触点位置变量,初始化为左下角位置
  8.  
  9. static TestScene* CreateTestScene(int nIdx)//创建演示样例的场景
  10. {
  11. CCDirector::sharedDirector()->purgeCachedData();//清除缓存数据
  12.  
  13. TestScene* pScene = NULL;//定义TestScene指针用于接收创建的演示样例场景
  14.  
  15. switch (nIdx) //依据索引来创建对应的演示样例场景
  16. {
  17. case TEST_ACTIONS:
  18. pScene = new ActionsTestScene(); break;//动画处理
  19. case TEST_TRANSITIONS:
  20. pScene = new TransitionsTestScene(); break;//场景切换
  21. case TEST_PROGRESS_ACTIONS: pScene = new ProgressActionsTestScene(); break;//进度动画
  22. case TEST_EFFECTS: pScene = new EffectTestScene(); break;//特效
  23. case TEST_CLICK_AND_MOVE: pScene = new ClickAndMoveTestScene(); break;//拖动測试
  24. case TEST_ROTATE_WORLD: pScene = new RotateWorldTestScene(); break;//旋转
  25. case TEST_PARTICLE: pScene = new ParticleTestScene(); break;//粒子系统
  26. case TEST_EASE_ACTIONS: pScene = new ActionsEaseTestScene(); break;//多样化
  27. case TEST_MOTION_STREAK: pScene = new MotionStreakTestScene(); break;//拖尾动画
  28. case TEST_DRAW_PRIMITIVES: pScene = new DrawPrimitivesTestScene(); break;//基本图形
  29. case TEST_COCOSNODE: pScene = new CocosNodeTestScene(); break;//节点
  30. case TEST_TOUCHES: pScene = new PongScene(); break;//触屏
  31. case TEST_MENU: pScene = new MenuTestScene(); break;//菜单
  32. case TEST_ACTION_MANAGER: pScene = new ActionManagerTestScene(); break;//动画管理
  33. case TEST_LAYER: pScene = new LayerTestScene(); break;//层測试
  34. case TEST_SCENE: pScene = new SceneTestScene(); break;//场景測试
  35. case TEST_PARALLAX: pScene = new ParallaxTestScene(); break;//视角測试
  36. case TEST_TILE_MAP: pScene = new TileMapTestScene(); break;//瓦片地图
  37. case TEST_INTERVAL: pScene = new IntervalTestScene(); break;//时间
  38. case TEST_LABEL: pScene = new AtlasTestScene(); break;//文字标签
  39. case TEST_TEXT_INPUT: pScene = new TextInputTestScene(); break;//文本输入
  40. case TEST_SPRITE: pScene = new SpriteTestScene(); break;//精灵
  41. case TEST_SCHEDULER: pScene = new SchedulerTestScene(); break;//预处理器
  42. case TEST_RENDERTEXTURE: pScene = new RenderTextureScene(); break;//渲染纹理
  43. case TEST_TEXTURE2D: pScene = new TextureTestScene(); break;//纹理
  44. #if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
  45. case TEST_CHIPMUNK: pScene = new ChipmunkAccelTouchTestScene(); break;
  46. #endif
  47. case TEST_BOX2D: pScene = new Box2DTestScene(); break;//Box2D物理引擎
  48. case TEST_BOX2DBED: pScene = new Box2dTestBedScene(); break;//物体的固定于连接
  49. case TEST_EFFECT_ADVANCE: pScene = new EffectAdvanceScene(); break;//高级效果
  50. case TEST_ACCELEROMRTER: pScene = new AccelerometerTestScene(); break;//加速计
  51. #if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA)
  52. case TEST_KEYPAD: pScene = new KeypadTestScene(); break;//键盘处理
  53. #endif
  54. case TEST_COCOSDENSHION: pScene = new CocosDenshionTestScene(); break;//声效控制
  55. case TEST_PERFORMANCE: pScene = new PerformanceTestScene(); break;//性能測试
  56. case TEST_ZWOPTEX: pScene = new ZwoptexTestScene(); break;// bada don't support libcurl
  57. #if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA && CC_TARGET_PLATFORM != CC_PLATFORM_NACL && CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE && CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPTEN)
  58. case TEST_CURL:#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8)
  59. pScene = new CurlTestScene(); break;//网络通信
  60. #else CCMessageBox("CurlTest not yet implemented.","Alert"); break;
  61. #endif
  62. #endif
  63. case TEST_USERDEFAULT: pScene = new UserDefaultTestScene(); break;//用户日志保存
  64. case TEST_BUGS: pScene = new BugsTestScene(); break;//Bug演示样例
  65. case TEST_FONTS: pScene = new FontTestScene(); break;//字体
  66. case TEST_CURRENT_LANGUAGE:
  67. pScene = new CurrentLanguageTestScene(); break;//当前语言
  68. #if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
  69. case TEST_TEXTURECACHE: pScene = new TextureCacheTestScene(); break;
  70. #endif
  71. case TEST_EXTENSIONS: pScene = new ExtensionsTestScene(); break;
  72. case TEST_SHADER:
  73. #if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8)
  74. pScene = new ShaderTestScene();//着色器
  75. #else
  76. CCMessageBox("ShaderTest not yet implemented.","Alert");
  77. #endif break; case TEST_MUTITOUCH: pScene = new MutiTouchTestScene();//多点触控
  78. break;#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
  79. case TEST_CLIPPINGNODE: pScene = new ClippingNodeTestScene(); break;
  80. #endif
  81. case TEST_FILEUTILS:
  82. pScene = new FileUtilsTestScene(); break;
  83. case TEST_SPINE:
  84. pScene = new SpineTestScene(); break;
  85. case TEST_TEXTUREPACKER_ENCRYPTION:
  86. pScene = new TextureAtlasEncryptionTestScene(); break;
  87. case TEST_DATAVISTOR:
  88. pScene = new DataVisitorTestScene(); break;
  89. case TEST_CONFIGURATION:pScene = new ConfigurationTestScene();break;
  90. default: break;
  91. }
  92. return pScene;
  93. }
  94. TestController::TestController()//构造函数用于初始化场景
  95. : m_tBeginPos(CCPointZero)
  96. { //加入了一个关闭菜单按钮回调closeCallback()函数
  97.  
  98. CCMenuItemImage *pCloseItem = CCMenuItemImage::create(s_pPathClose, s_pPathClose, this, menu_selector(TestController::closeCallback) );
  99. CCMenu* pMenu =CCMenu::create(pCloseItem, NULL);//将关闭项加入到主菜单
  100. pMenu->setPosition( CCPointZero );//设置菜单位置
  101. pCloseItem->setPosition(ccp( VisibleRect::right().x - 30, VisibleRect::top().y - 30)); // add menu items for tests
  102. m_pItemMenu = CCMenu::create(); //新建菜单项,全部演示样例都在这里
  103. for (int i = 0; i < TESTS_COUNT; ++i)
  104. {
  105. // #if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
  106. // CCLabelBMFont* label = CCLabelBMFont::create(g_aTestNames[i].c_str(), "fonts/arial16.fnt");
  107. //#else
  108. CCLabelTTF* label = CCLabelTTF::create(g_aTestNames[i].c_str(), "Arial", 24);//将字符串转换为字符常量//
  109. #endif
  110. CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(TestController::menuCallback));
  111. m_pItemMenu->addChild(pMenuItem, i + 10000);//将菜单项加入主菜单。以i+10000为Z轴
  112. pMenuItem->setPosition( ccp( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) )); }
  113. m_pItemMenu->setContentSize(CCSizeMake(VisibleRect::getVisibleRect().size.width, (TESTS_COUNT + 1) * (LINE_SPACE))); //总共的演示样例菜单尺寸
  114. m_pItemMenu->setPosition(s_tCurPos); addChild(m_pItemMenu);//加入演示样例菜单 setTouchEnabled(true);//开启触屏 addChild(pMenu, 1);//加入关闭项
  115. }
  116. TestController::~TestController(){}
  117. void TestController::menuCallback(CCObject * pSender){
  118. // get the userdata, it's the index of the menu item clicked
  119. CCMenuItem* pMenuItem = (CCMenuItem *)(pSender); int nIdx = pMenuItem->getZOrder() - 10000;//得出当前的演示样例菜单项索引
  120. // create the test scene and run it
  121. TestScene* pScene = CreateTestScene(nIdx);//创建菜单
  122. if (pScene)//假设激活了当前场景
  123. {
  124. pScene->runThisTest();//执行当前场景
  125. pScene->release(); }}
  126. void TestController::closeCallback(CCObject * pSender){
  127. #if(CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)CCMessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert");
  128. #else
  129. CCDirector::sharedDirector()->end();//退出程序
  130. #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
  131. exit(0);
  132. #endif
  133. #endif
  134. }
  135. void TestController::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)//触点按下时的响应
  136. { CCSetIterator it = pTouches->begin(); //获取第一个触点位置
  137. CCTouch* touch = (CCTouch*)(*it);
  138. m_tBeginPos = touch->getLocation(); //将第一个触点的位置坐标保存到m_tBeginPos中
  139. }
  140. void TestController::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
  141. { CCSetIterator it = pTouches->begin();
  142. CCTouch* touch = (CCTouch*)(*it);
  143. CCPoint touchLocation = touch->getLocation(); //获取第一个触点位置的坐标
  144. float nMoveY = touchLocation.y - m_tBeginPos.y; //取得这个位置与之前的位置的纵坐标上的偏移
  145. CCPoint curPos = m_pItemMenu->getPosition(); //当前菜单的位置坐标
  146. CCPoint nextPos = ccp(curPos.x, curPos.y + nMoveY);//菜单也移动与触点移动一样的偏移量
  147. if (nextPos.y < 0.0f) { m_pItemMenu->setPosition(CCPointZero); //假设下一点超出了屏幕的坐标范围则菜单项不变
  148. return;
  149. }
  150. if (nextPos.y > ((TESTS_COUNT + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))
  151. { m_pItemMenu->setPosition(ccp(0, ((TESTS_COUNT + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)));
  152. return;
  153. }
  154. m_pItemMenu->setPosition(nextPos); //更新当前的菜单项的位置
  155. m_tBeginPos = touchLocation;//更新当前位置坐标
  156. s_tCurPos = nextPos;}

4.VisibleRect.h/cpp

VisibleRect.cpp

  1. #include "VisibleRect.h" //这个类主要是配合设置屏幕分辨率来用的
  2.  
  3. CCRect VisibleRect::s_visibleRect;
  4.  
  5. void VisibleRect::lazyInit()
  6. {
  7. if (s_visibleRect.size.width == 0.0f && s_visibleRect.size.height == 0.0f)
  8. {
  9. CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();//获取EGLView视图
  10. s_visibleRect.origin = pEGLView->getVisibleOrigin();//得到视图起点
  11. s_visibleRect.size = pEGLView->getVisibleSize(); //得到可见矩形尺寸
  12. }
  13. }
  14.  
  15. CCRect VisibleRect::getVisibleRect() //设置可见矩形的位置尺寸的
  16. {
  17. lazyInit();
  18. return CCRectMake(s_visibleRect.origin.x, s_visibleRect.origin.y, s_visibleRect.size.width, s_visibleRect.size.height);
  19. }
  20.  
  21. CCPoint VisibleRect::left() //下面是获取可见矩形9点坐标
  22. {
  23. lazyInit();
  24. return ccp(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height/2);
  25. }
  26.  
  27. CCPoint VisibleRect::right()
  28. {
  29. lazyInit();
  30. return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height/2);
  31. }
  32.  
  33. CCPoint VisibleRect::top()
  34. {
  35. lazyInit();
  36. return ccp(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height);
  37. }
  38.  
  39. CCPoint VisibleRect::bottom()
  40. {
  41. lazyInit();
  42. return ccp(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y);
  43. }
  44.  
  45. CCPoint VisibleRect::center()
  46. {
  47. lazyInit();
  48. return ccp(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height/2);
  49. }
  50.  
  51. CCPoint VisibleRect::leftTop()
  52. {
  53. lazyInit();
  54. return ccp(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height);
  55. }
  56.  
  57. CCPoint VisibleRect::rightTop()
  58. {
  59. lazyInit();
  60. return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height);
  61. }
  62.  
  63. CCPoint VisibleRect::leftBottom()
  64. {
  65. lazyInit();
  66. return s_visibleRect.origin;
  67. }
  68.  
  69. CCPoint VisibleRect::rightBottom()
  70. {
  71. lazyInit();
  72. return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y);
  73. }

最终完成的事情  。 我是个新手  。那里是没有希望的大神指点权, 如果一个问题可能是一个问题,我长线。

cocos2d-x的TestCpp分析的更多相关文章

  1. cocos2D(三)---- 第一cocos2d的程序代码分析

    在第一讲中已经新建了第一个cocos2d程序,执行效果例如以下: 在这讲中我们来分析下里面的代码,了解cocos2d的工作原理,看看屏幕上的这个"Hello World"是怎样显示 ...

  2. 三、第一个cocos2d程序的代码分析

    http://blog.csdn.net/q199109106q/article/details/8591706 在第一讲中已经新建了第一个cocos2d程序,运行效果如下: 在这讲中我们来分析下里面 ...

  3. 游戏编程算法与技巧 Game Programming Algorithms and Techniques (Sanjay Madhav 著)

    http://gamealgorithms.net 第1章 游戏编程概述 (已看) 第2章 2D图形 (已看) 第3章 游戏中的线性代数 (已看) 第4章 3D图形 (已看) 第5章 游戏输入 (已看 ...

  4. Cocos2d-x学习笔记(17)(TestCpp源代码分析-1)

    TestCpp源代码基于Cocos2d-x2.1.3版本号,部分资源来自红孩儿的游戏编程之路CSDN博客地址http://blog.csdn.net/honghaier/article/details ...

  5. cocos2d游戏界面卡住声音正常播放的问题分析

    cocos2d游戏界面卡住声音正常播放的问题分析 从目前已知的情况看,出现这种情况只可能是设备的内存不够导致的. 从代码上来说内存不够时会调用AppController的“- (void)applic ...

  6. Cocos2D v3.4.9粒子效果不能显示的原因分析及解决办法

    大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请多提意见,如果觉得不错请多多支持点赞.谢谢! hopy ;) 在游戏App中为了衬托气氛我们往往使用一些特殊的图形效果,粒子 ...

  7. Cocos2d-x学习笔记(18)(TestCpp源代码分析-2)

    本章主要讲controller.h/cpp文件的分析,该文件主要用于演示样例场景管理类TestController,用于显示全部演示样例的菜单. //controller.cpp #include & ...

  8. 【Cocos2d TestCpp实例模仿一】-- ActionsTest

    转载请注明出处:http://blog.csdn.net/oyangyufu/article/details/25252539 CCActionInterval(持续性动作) 位置性变化动作以To结束 ...

  9. Cocos2d-x学习笔记(19)(TestCpp源代码分析-3)

    本章主要介绍testBasic.h/cpp,这两个文件主要用于返回主场景界面. //testBasic.h #ifndef _TEST_BASIC_H_ #define _TEST_BASIC_H_ ...

随机推荐

  1. [6] 算法路 - 双向冒泡排序的Shaker

    Shaker序列 –算法 1. 气泡排序的双向进行,先让气泡排序由左向右进行.再来让气泡排序由右往左进行,如此完毕一次排序的动作 2. 使用left与right两个旗标来记录左右两端已排序的元素位置. ...

  2. LeetCode 48 Anagrams

    Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be ...

  3. .NET反编译之Reflector

    .NET反编译之Reflector 这几日由于公司需要, 看了些.NET反编译技巧,特地和大家分享下 .NET反编译工具很多,Reflector是其中一个很优秀的工具,所以就用它来进行反编译工作了.今 ...

  4. Android使用HttpClient方法和易错问题

    HttpClient为Android开发人员提供了跟简洁的操作Http网络连接的方法,在连接过程中也有两种方式,get和post,先看一下怎样实现的 默认是get方式 //先将參数放入List,再对參 ...

  5. Java Web整合开发(4) -- JSP

    JSP脚本中的9个内置对象: application:    javax.servlet.ServletContext config:          javax.servlet.ServletCo ...

  6. android 拍照注意问题

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, reqCode) ...

  7. handlebar的一些用法——个人使用总结

    handlebar的一些用法 概述与介绍 Handlebars 是 JavaScript 一个语义模板库,通过对view和data的分离来快速构建Web模板.它采用"Logic-less t ...

  8. Oracle 数据库 有用的sql语句

    ; SELECT to_date('2014-12-01', 'yyyy-mm-dd') + numtodsinterval(rownum , 'day') FROM DUAL CONNECT BY ...

  9. HDU 4901 The Romantic Hero(二维dp)

    题目大意:给你n个数字,然后分成两份,前边的一份里面的元素进行异或,后面的一份里面的元素进行与.分的时候依照给的先后数序取数,后面的里面的全部的元素的下标一定比前面的大.问你有多上种放元素的方法能够使 ...

  10. Asp.Net+Easyui实现重大CRUD

    今天周四称,这应该给自己一个休息,好好休息休息,但无奈自己IT这是痴迷.甘心的想加加班把目标功能实现,功夫不负有心人.经过6个小时的鏖战,我最终成功了. 在此和大家分享下成果,希望大家给个赞. 我的目 ...