I made it! Thanks!
How I can call a javascript function from native code ? Thanks!
localhost:~ wangjingjing$ sudo port install python27 py27-yaml py27-cheetah
Password:
sudo: port: command not found
why?
port is a package manager for Mac only, assuming youāre using mac you need to install macports http://macports.org, otherwise use your systems package manager to install the dependencies
Thank you very much!
Not sure if anyone else is seeing this but it seems that you can only run testjavascript and even the template cocos2dx_js projects on your device if you turn on GCC 4.2 compiler support. Is this intentional? I A/B tested this with the cocos2d_js project and it doesnāt run on the device at all and errors on startup with this message:
dyld: vm_protect(0x00001000, 0x0099A000, false, 0x07) failed, result=2 for segment __TEXT in /var/mobile/Applications/0D02643D-AE8D-47A6-B675-D08CD7D526EF/testhello.app/testhello
Regarding my last post, you can fix this by either changing your project to be GCC 4.2 (which causes other issues, especially with being able to use some new Obj-C features such as literals) or you can move the javascript library and bindings into their own static lib compiled using GCC 4.2 and then link that in.
**ā¦. Generating bindings for target spidermonkey
ā¦. ā¦. Processing section sqlite
Exception ctypes.ArgumentError: āargument 1: <type āexceptions.AttributeErrorā>: āTranslationUnitā object has no attribute āas_parameterāā in <bound method TranslationUnit.del of <clang.cindex.TranslationUnit object at 0x10a0999d0>> ignored
why?**
guangwen chen wrote:
ā¦. Generating bindings for target spidermonkey
>
ā¦. ā¦. Processing section sqlite
>
>
Exception ctypes.ArgumentError: āargument 1: <type āexceptions.AttributeErrorā>: āTranslationUnitā object has no attribute āas_parameterāā in <bound method TranslationUnit.del of <clang.cindex.TranslationUnit object at 0x10a0999d0>> ignored
>
>
why?
Try using std::string instead of CCString. Also, can you post your code in gist or some other place where it can be easily reviewed? I think I only got part of your code in my email, but when looking here at the forum thereās nothing
Thanks!
Rolando
in your sqlite.ini, headers field may be wrong.
Try to check if paths are right and variables well written
try to replace this
>headers = s/cocos2dx/platform/CCPlatformConfig.h (cocosdir)s/cocos2dx/include/cocos2d.h s/sqlite/sqlite/MySqlite.h
with this
>headers = (cocosdir)s/cocos2dx/platform/CCPlatformConfig.h (cocosdir)s/cocos2dx/include/cocos2d.h (the_directory_path_variable_of_your_project)s/sqlite/sqlite/MySqlite.h
Thanks for your warmhearted help, The questions was solved.
How to write the .ini file in order to binding the c file(not c++) by the cxx-generator?
In order to get started with Javascript Bindings (Cocos2d-X), I wrote a simple class with just one private integer & itās setter & getter method. I wrote this class in Cpp and used ātojsā to generate the javascript bindings. Now the output is a bit scary as I have got one cpp, one hpp and one js file with a lot of code in the c++ filesā¦ (I said scary as I am unable to say what the c++ code is doingā¦)
Can anybody help me in understanding how I can use the javascript bindings for this simple class. I just want to create a javascript object of this simple class, set the value of the integer variable and then read it using the bindingsā¦
I have attached the generated filesā¦
*ā¦. Generating bindings for target spidermonkey
ā¦. ā¦. Processing section testandroid
Exception ctypes.ArgumentError: āargument 1: <type āexceptions.AttributeErrorā>: āTranslationUnitā object has no attribute āas_parameterāā in <bound method TranslationUnit.del of <clang.cindex.TranslationUnit object at 0x106189d10>> ignored
Please why? Iām testing the āsimple-testā, native example.
In the last version it works fine and now I canāt generate my bindings.
Iām using the current version: cocos2d-2.1rc0-x-2.1.3
SOLVED:
changes in userconf.ini
-cxxgeneratordir=/path/to/cxx-generator
+cxxgeneratordir=/path/to/bindings-generator