Sean D Creating Lua bindings--I have some questions about what to do.
Posts 6
Added by Sean D over 1 year ago

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++ -tSimpleAudioEngine -o 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

Zhe Wang RE: Creating Lua bindings--I have some questions about what to do.
Posts 1642
Location Amoy, China
Added by Zhe Wang over 1 year ago

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

Enjoy Coding, Enjoy Life.

Sean D RE: Creating Lua bindings--I have some questions about what to do.
Posts 6
Added by Sean D over 1 year ago

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++ -tSimpleAudioEngine -o 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?
Minggo Zhang RE: Creating Lua bindings--I have some questions about what to do.
Posts 1641
Added by Minggo Zhang over 1 year ago

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

Sean D RE: Creating Lua bindings--I have some questions about what to do.
Posts 6
Added by Sean D 4 months ago

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 ;)


(1-4/4)