marmalade / OpenQuick

Marmalade Open Quick
113 stars 24 forks source link

iOS project missing #1

Open ghost opened 11 years ago

ghost commented 11 years ago

I was able to setup a iOS project with Cocos2d-x, but it does not worked out.

timcloss commented 11 years ago

Hi there Please provide more info on what problems you are having. Compiler errors? Linker errors? Runtime errors? Cheers, Tim

ghost commented 11 years ago

Compilation & Linker worked fine.

Runtime errors !

Problems with file path. I added OpenQuick Lua source files to the Resources/ as a directory. In execution of main.lua sample the Lua runtime could not access the OpenQuick lua files.

Ok, in Cocos2d-x regular Lua you have to add "search path" for the Lua files. Can't see where I have to add this in openquick C++ AppDelegate.cpp?!!

timcloss commented 11 years ago

Ignore anything you know about Cocos2d-x and Lua! OpenQuick does not use Cocos2d-x's existing Lua bindings, or Lua set-up code.

Your iOS project needs to set its root data folder to be one level above your "quicklua" folder. This is, I believe, a setting of the Xcode project. For example, for Windows the Visual Studio project for the "Hello World" sample sets the root data folder to /samples/HelloWorld/proj.win32.

Does that help?

ghost commented 11 years ago

Yes that helps. Thanks.

Will give it a spin later...

sbc100 commented 11 years ago

I think that on some (many?) platforms you may well need/want the call to luaengine->addSearchPath().

cocos2dx has a virtual filesystem that knows how to look for files in one or more locations. lua (even the one the ships with cococs) uses fopen() directly and is unaware of the cocos2dx file paths. If you can set the current working directory to your resource folder then you are ok, but I think a better solution is to modify cocos so that either lua doesn't use fopen directly or is at least made aware of the cococs path list.

That way you can also take advantage of the alternate resource dir system that cocos provides for assets and provide "HD" lua files if you really want to :)