配置:在VS2008平台下,
1,在github上下载最新版,运行“build-win32.bat”脚本。
2,点击内置的helloworld,出错。
3,更新显卡驱动,重新运行。成功。
4,运行“install - templates-msvc.bat”安装VS向导,然后就可以建立项目了。
研究helloworld:
1,打开helloworld的工程,
里面主要是相关的类和主函数。
2,然后又打开helloworld文件夹,
工程的布置就一目了然了。
3,看main.cpp:
#include "main.h" #include "../Classes/AppDelegate.h" #include "CCEGLView.h" USING_NS_CC; int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // create the application instance AppDelegate app; CCEGLView& eglView = CCEGLView::sharedOpenGLView(); eglView.setViewName("Hello World"); eglView.setFrameSize(480, 320); // set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line. // eglView.setDesignResolutionSize(480, 320); return CCApplication::sharedApplication().run(); }
其中AppDelegate是最主要的类,管理着整个应用程序:
基本的实现方式跟opengl都是很像的,所以也不难看懂。
CCEGLView是整个程序的窗口类,应该就类似于glut窗口库子集的那种基本调度的。
然后我就去看了一下几个主类的定义。
cocos2d-x之helloworld,布布扣,bubuko.com
原文:http://blog.csdn.net/modiziri/article/details/22037725