HTML5 Framework/Windows 8 app released

Hi,

You may be interested to know I’ve managed to successful release a Cocos2d HTML5 Framework app in the Windows 8 store.

Thanks Cocos2d team!

Hello Pual

I’m coming here to create a thread about problem using cocos2dx-html5 in windows store app that uses JavaScript and html5 techniques
and now I’m so happy , you did it!

I tried some works with my knowledge to do this But have much problems
can you help me to figure out that?
will you explain how do this great work?

Hi Hamed

Start off with a simple example form the JS samples MS provide. Then add the Cocos2d framework.

The biggest problem I had was how to load the framework. I stated off using cocos2d/platform/jsloader.js which worked when the app was started using Visual Studio but didn’t when run as a Windows 8 Metro package. I ended up just loading the framework and all my other .js files from default.html.

Hope that helps a bit!

the version of downloaded cocos2d-x is “cocos2d-html5-v0.5.0-alpha” and in the root folder exist a zip file that name is “cocos2d”
inside this is nothing about jsloader.js !
same as other paths!
what your version using?

I tried to include all of needed js files of cocos2d in blank windows store app template , but in runtime VS get error like this “Unable to get property ‘setup’ of undefined or null reference” ! and like this about a lot of other functions! in cocos2d.js file :(((

I used 0.5 beta.

As I said I loaded all files needed in default.html

etc

Hamed M wrote:

the version of downloaded cocos2d-x is “cocos2d-html5-v0.5.0-alpha” and in the root folder exist a zip file that name is “cocos2d”
inside this is nothing about jsloader.js !
same as other paths!
what your version using?
>
I tried to include all of needed js files of cocos2d in blank windows store app template , but in runtime VS get error like this “Unable to get property ‘setup’ of undefined or null reference” ! and like this about a lot of other functions! in cocos2d.js file :(((

It is great!

Congratulations, Paul.

I suggest you to packet all your js files to single file, and then you only need to list one file in your HTML file, ;).
Google closure compiler is an useful tool for you. It will also improve the performance and GC.

@Hamed M
There is nots jsloader.js until Alpha 2. I suggest you may use V2.0. It had fixed a lot of bugs.

Shun Lin wrote:

@Hamed M
There is nots jsloader.js until Alpha 2. I suggest you may use V2.0. It had fixed a lot of bugs.

Tnx a lot Shun Lin, I downloaded latest version and find that file :slight_smile:
Now trying to fix engine with VS2012

it is the default.html file:

    Cocos2dX

all the address is correct and I copied all required libs to Solution !

but when Run the app in this line of jsloader.js
var c = d.querySelector('#cocos2d-html5').c;
get this error
JavaScript runtime error: Unable to get property 'c' of undefined or null reference

you know why???

Hamed is you look at jsloader, you can see that it is not required if you are loading your files using default.html. But probably better to use the latest version as Shun Lin says.

Hamed M wrote:

it is the default.html file:
>
[…]
>
all the address is correct and I copied all required libs to Solution !
>
but when Run the app in this line of jsloader.js
var c = d.querySelector('#cocos2d-html5').c;
get this error
JavaScript runtime error: Unable to get property 'c' of undefined or null reference
>
you know why???

Yes that’s Right
My work was silly !
but after Removing the jsloader the resault was a blank black screen :frowning: (just empty Canvas)
plz just if it’s possible, tell me the exact place of js framewares files and the “default.js” text.
I tried any Conditions that came to my mind but not answered!
I’m using “Cocos2d-html5-v2.0” Version and tried to importing “HelloHTML5World” sample into “Blank App” on Visual Studio 2012
TanQ Sooooooooooooooooo much

Paul,

I’d love to see an HelloWorld Windows 8 example myself. I’ve completed the porting of several games to cocos2d html5 but loading the files to make it work in Windows 8 is killing me.

I’m curious the order in which you loaded the script files. (does that even matter?) Nothing I do seems to be working. Even creating one large .js file I’d get the same errors. Most of the errors are things like the cc.config is null or ‘var element’ in the cc.setup function is null, etc. Do you init everything in default.js? Do you still have a main.js?

Thanks,


Mark

Mark Andrade wrote:

Paul,
>
I’d love to see an HelloWorld Windows 8 example myself. I’ve completed the porting of several games to cocos2d html5 but loading the files to make it work in Windows 8 is killing me.
>
I’m curious the order in which you loaded the script files. (does that even matter?) Nothing I do seems to be working. Even creating one large .js file I’d get the same errors. Most of the errors are things like the cc.config is null or ‘var element’ in the cc.setup function is null, etc. Do you init everything in default.js? Do you still have a main.js?
>
Thanks,
>

Mark

I loaded all external .js files in the head of default.html. Cocos2d files first then the app files. I guess they can be packed into a single file.

I used main.js to preload the assets.

They can be packed into single files. Google compiler will be a great tool for you.

You may find some build.xml files in engine, and they may help you to pack the engine files with ant easily.

For example:

  1. Go to “/Cocos2d-html5/cocos2d” directory
  2. Type “ant” and run it in you console

The sigle file of engine will be released in “Cocos2d-html5/lib” directory.

Moreover, all your app files can be packed into a single file together with engine files.
The performance will be improved if you choose advance mode.
Please refer to the build.xml file on /cocos2d-html5/tests/builder.xml in v2.0 or /cocos2d-html5/samples/tests/build.xml in* v2.1*.

It currently a free download if anyone wants to take a look; Leave a nice review! :slight_smile: