let you create your games onder linux with qtcreator

Hi;),I have made a template for qtcreator which enabled you develop game under qtcretor on linux liked VS.
Here it is:
https://github.com/FlyingFishBird/cocos2d-x_2_0_4_templete_for_qtcreator.git

And it is different from a project which ported with Qt framework, my template use linux native code.I am using the 2.0.4 version,
and it looks easy to update to a newer one.

Here is the TestCpp project:

You can test it after install my template.

I’m a greenhand and I just want to share it.


24的屏幕截图.png (176.7 KB)


1.png (59.6 KB)


2.png (38.1 KB)


11的屏幕截图.png (85.5 KB)

Looks great, it would be nice to add an option to include the pro.* of the other platforms

great work!

i tried with the 2dx 2.0.4 in debian7 success!

can you upgrade to the latested 2dx? thank you.

  • It uses .qrc, which is useles without Qt port and causes compile error on my system
  • I’ve managed to write all-in-one `**.pri` file for cocos2d-x a few days ago, and going to make pull request to cocos2d-x. It supports cocos2d build on demand using Linux Makefile.
    ** Replace `COCOS2D_ROOT = $$system(echo $COCOS2D_ROOT)` with `isEmpty(COCOS2D_ROOT):COCOS2D_ROOT = $$system(echo $COCOS2D_ROOT)`: in this case user can also pass variable to qmake, as in attachment.

I’ve created pull request which adds file cocos2dx.pri, that contains everything necessary to setup project. It also automatically builds required libraries using makefiles.

You template gave me some new ideas for cocos2dx.pri, thanks for that. And I’m curious, what the reason to link application with static libraries from cocos2d-x distribution? AFAIK distributions have strict policy for that: app should use system library for security reasons, so system CURL should be used instead of precompiled.

Sergey Shambir wrote:

I’ve created pull request which adds file cocos2dx.pri, that contains everything necessary to setup project. It also automatically builds required libraries using makefiles.
>
https://github.com/cocos2d/cocos2d-x/pull/2703
>
You template gave me some new ideas for cocos2dx.pri, thanks for that. And I’m curious, what the reason to link application with static libraries from cocos2d-x distribution? AFAIK distributions have strict policy for that: app should use system library for security reasons, so system CURL should be used instead of precompiled.

I’m new with qtcreator. I’ve tried your way. It compiles fine. But I have problem with resources. I’m building project outside of cocos2d_root. I’m adding resource to project in assets folder, say assets/test.png, then in my .pro

OTHER_FILES += \
    assets/test.png

I’ve tried two ways to use it

    CCSprite* pSprite = CCSprite::create("test.png");
    CCSprite* pSprite = CCSprite::create("assets/test.png");

But I have an error: cocos2d-x debug info [Get data from file(test.png) failed!]
(running and compiling for linux)
What is the proper way to add a resource to project and use it ?

You should set custom resource path in your code - look at CCFileUtils::setResourceDirectory(), or place resources in …/…/…/Resources folder (relative to directory where executable placed) - cocos2d-x uses this path by default.

Thanks for review, I’ve added information about resource folder here: http://www.cocos2d-x.org/projects/cocos2d-x/wiki/QtCreator_project_setup_on_Linux

Sergey Shambir wrote:

I’ve created pull request which adds file cocos2dx.pri, that contains everything necessary to setup project. It also automatically builds required libraries using makefiles.
>
https://github.com/cocos2d/cocos2d-x/pull/2703
>
You template gave me some new ideas for cocos2dx.pri, thanks for that. And I’m curious, what the reason to link application with static libraries from cocos2d-x distribution? AFAIK distributions have strict policy for that: app should use system library for security reasons, so system CURL should be used instead of precompiled.

When I tried to compiled this template at the first time, I got some link errors for the reason of different versions of some external libs. In order to be lazy to linked with static libs. :wink:
Thank you for your reflections of passion, and you make me a happy day !

it’s so great! thank you~~

Please help, I’m getting an error
-1: error: No rule to make target main.cpp', needed bymain.o’. Stop.

@quiet_readonly
Hey my friend , I have made a new template like now released version2.2.x’s style use project_creator.py like others. here is the git hub ,and can you port it to v3.0:https://github.com/FlyingFishBird/cocos2d-x_linux_qt_template

@Defuera aloha my friend , here is the new template worked better and config simpler, may helped :https://github.com/FlyingFishBird/cocos2d-x_linux_qt_template