Forum > Lua Binding > Creating Lua bindings--I have some questions about what to do.

Creating Lua bindings--I have some questions about what to do.

By hanoixan Posted 2011-12-20 19:23 Comments 4
hanoixan
  • Posts: 6

Hello, I’m a new user to Cocos2d-x, and I’m interested in writing games in Lua.

I’d like to help complete more Lua bindings for SimpleAudioEngine and Box2D. It looks like people have started this in the past, but became hung up on one thing or another. If I can get this working, how would submissions to the git repo work?

I’ve never used tolua*+ before, but I’ve got it compiled for OSX now, and I’m trying to understand the tool pipeline for generating and using the bindings. I have some questions—
* It looks like ‘ant’ should be used for generating and copying the Cocos2d.pkg. But, SimpleAudioEngine.pkg looks like it has to be generated with a separate command line such as: tolua*+ tSimpleAudioEngineo LuaSimpleAudioEngine.cpp SimpleAudioEngine.pkg, and then copied by hand.
Is this correct? Should it be incorporated into the ant build.xml?

  • The header files for the tolua++ output .cpp files look like they’re generated by hand, and just have to include useful headers and the prototype:
    int tolua*<CLASS>open(lua_State\ toLua_S);
    Is this correct?

  • lua/CocosDenshion_support/LuaSimpleAudioEngine.h uses the idempotent header define LUADENSHION_H, which is probably wrong and should be changed to LUASIMPLEAUDIOENGINE_H, correct?

Again, I’d like to help where I can. I think Cocos2d-x is a really great idea, and it will help me get my own engine running.

Thanks,
Sean

walzer
  • Posts: 1735
  • Location: Xiamen, China

#1 RE: 2011-12-25 06:22

Thanks Sean. Please feel free to improve cocos2d-x and push request to github.com/cocos2d/cocos2d-x repo.

Less is More. Keep Focus.

hanoixan
  • Posts: 6

#2 RE: 2011-12-25 07:26

Walzer, could you answer the questions I have above?

  • It looks like ‘ant’ should be used for generating and copying the Cocos2d.pkg. But, SimpleAudioEngine.pkg looks like it has to be generated with a separate command line such as: tolua++ tSimpleAudioEngineo LuaSimpleAudioEngine.cpp SimpleAudioEngine.pkg, and then copied by hand. Is this correct? Should it be incorporated into the ant build.xml?

**The header files for the tolua++ output .cpp files look like they’re generated by hand, and just have to include useful headers and the prototype:
int tolua*<CLASS>open;
Is this correct?
*
lua/CocosDenshion_support/LuaSimpleAudioEngine.h uses the idempotent header define LUADENSHION_H, which is probably wrong and should be changed to LUASIMPLEAUDIOENGINE_H, correct?

zhangxm
  • Posts: 2082
  • Location: Xiamen, China

#3 RE: 2011-12-26 18:05

Yes, I think we should add build.xml for SimpleAudoEngine.pkg, would you implement it?

hanoixan
  • Posts: 6

#4 RE: 2013-01-23 07:06

Minggo Zhang wrote:

Yes, I think we should add build.xml for SimpleAudoEngine.pkg, would you implement it?

My apologies. I didn’t get a reply when I was working on this stuff and hadn’t checked back, and inevitably moved onto other things. Now I’m back writing a game using the JS bindings though ;)

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps