Saturday, October 3, 2015

Snake Game Using Cocos2d-x Javascript Desktop - PART 5

Now that the game coding is done we can use the same code base almost without change for our game desktop version.
To run the main.js file which is the game entry point we need to compile Cocos2d-x RunTime which will load our game.

for this we use:
  1. Visual studio 2013 c++  community version . 
  2. The same code base we created in Snake Game Using Cocos2d-x HTML5 - PART 1 .

1.  Open VC++   then go to FILE -> Open -> Project/Solution . and navigate to where you created the SnakeJS project .  then navigate to deeper directory named:  proj.win32  :
And load the "SnakeJS" VC++ solution project called SnakeJS.sln .|

2. Once we done loading the Cocose2d-x Runtime source code into VC++ we ready to compile it.
we don't need Debug version for this example because for now we are not going to change any c++ source code ,
In VC++ :
  1. in the projects list on the right select our "SnakeJS" project . 
  2. go to the upper tool box there is drop down list with "Debug" selected . change it to "Release"

3. In VC++ which SnakeJS project selected go to and click on : BUILD -> Build SnakeJS
Wait until it is done to compile.

When it is done to compile. you should see in the VC++ bottom Output window  scroll to the end .

7>  4 File(s) copied
7>          1 file(s) copied.
7>          1 file(s) copied.
========== Build: 7 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

4. Now we are ready to start our WindTakeFS game Navigate to :
look for SnakeJS.exe click it to execute the game .

And your game should look like this :

We are ready to build our "SnakeJS" game for iOS the next tutorial :
Snake Game Using Cocos2d-x Javascript iOS- PART 6 

Play the final SnakeJS game:
The SnakeJS source code:


  1. This comment has been removed by the author.

  2. hi after the release build, it displays the black screen, not the snack screen

  3. which device you are using ?
    i tested it only on iOS 8 + web

  4. this is desktop win32 built. not mobile or web

  5. Great so you can debug it maybe, to see what you did wrong.
    See if you have any errors , set prints to output what you are missing

  6. can you upload the "runtime-src" folder to git so that i can try?


Note: Only a member of this blog may post a comment.