文章目录
  1. 1. 参考文章
  2. 2. NEED
  3. 3. PATH
  4. 4. PROJECT
    1. 4.1. CREATE
    2. 4.2. SETTING
    3. 4.3. CODING

参考文章

http://www.cnblogs.com/marisa/p/4141862.html
final

NEED

qt-opensource-windows-x86-msvc2012(http://pan.baidu.com/s/1i4lvpbv)
qt-vs-addin-XX-opensource(http://pan.baidu.com/s/1hqW4lmc)
CocosQtPort(http://pan.baidu.com/s/1dEfxRYp)
vs2012()

PATH

%QT_DIR%\bin

PROJECT

CREATE

cd Cocos_Projcet_Dir
Create QtApplication(Named QtWindow)
Add exist projects libbox2d,libcocos2d,ibSpine.

SETTING

Add Reference libbox2d,libcocos2d,ibSpine.
Output Directory $(SolutionDir)$(Configuration).win32\
Intermediate Directory $(Configuration).win32\
Working Directory $(ProjectDir)..\Resources

C/C++
Add Additional Include Directories
$(ProjectDir)..\cocos2d\external\win32-specific\gles\include\OGLES;$(ProjectDir)..\cocos2d\external\glfw3\include\win32;$(ProjectDir)..\cocos2d\cocos\platform\desktop;$(ProjectDir)..\cocos2d\cocos\platform;$(ProjectDir)..\cocos2d\cocos;$(ProjectDir)..\cocos2d\cocos\editor-support;$(ProjectDir)QtPort\;$(ProjectDir)..;$(ProjectDir)..\Classes;$(ProjectDir)..\cocos2d\extensions;$(ProjectDir)..\cocos2d\external\chipmunk\include\chipmunk;$(ProjectDir)..\cocos2d\external;$(ProjectDir)..\cocos2d\cocos\audio\include;

Add Preprocessor Definitions
_DEBUG
_WINDOWS
_USE_MATH_DEFINES
GL_GLEXT_PROTOTYPES
CC_ENABLE_CHIPMUNK_INTEGRATION=1
COCOS2D_DEBUG=1
_CRT_SECURE_NO_WARNINGS
_SCL_SECURE_NO_WARNINGS
_VARIADIC_MAX=10
_USING_V110SDK71
_UNICODE

Linker
Add Additional Library Directories $(SolutionDir)$(Configuration).win32\
Add Additional Dependencies
opengl32.lib
glew32.lib
libzlib.lib
libpng.lib
libjpeg.lib
libtiff.lib
libwebp.lib
libiconv.lib
glfw3.lib
freetype250.lib
winmm.lib
ws2_32.lib
libchipmunk.lib
libbox2d.lib
libSpine.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib

CODING

1.import QtPort/*
2.Launch QtDesigner
Add QDockWidget into window
Change objectName “sceneWidget”
3.Add Function in QtWindow class files

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void QtWindow::setGLView(QWidget *parent /* = 0 */)
{
_glWidget = parent;

if (_glWidget)
{
ui.sceneWidget->setWidget(_glWidget);
setCentralWidget(ui.sceneWidget);
}


}

void QtWindow::closeEvent(QCloseEvent*)
{
cocos2d::Director::getInstance()->end();
qApp->quit();
}

4.Change main.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "qtwindow.h"
#include <QtWidgets/QApplication>

#include "QtAppDelegate.h"
#include "CCQGLView.h"
#include "cocos2d.h"

int main(int argc, char *argv[])
{

/*QApplication a(argc, argv);
QtWindow w;
w.show();
return a.exec();*/


QtAppDelegate app(argc,argv);
return cocos2d::CCQApplication::getInstance()->run();

}

文章目录
  1. 1. 参考文章
  2. 2. NEED
  3. 3. PATH
  4. 4. PROJECT
    1. 4.1. CREATE
    2. 4.2. SETTING
    3. 4.3. CODING