Page 1 of 1

Creating game view on iOS

Posted: Mon Dec 12, 2016 8:37 pm
by aloisdeniel
Hi,

I'm currently developing a little lua editor for iOS, and I would make it possible to launch our LÖVE games directly from within the app. To be able to do this, I must reset the game context and start a new UIViewController that hosts a new game instance with updated code.

Have you any clue on how to achieve such a thing ?

Thanks !

Re: Creating game view on iOS

Posted: Tue Dec 13, 2016 12:10 am
by raidho36
You can try

Code: Select all

require ( "main.lua" )
That'll load the file and if it's a valid main file, that'll overwrite existing game state.

Re: Creating game view on iOS

Posted: Tue Dec 13, 2016 12:51 am
by Positive07
Umm, pretty sure that should be

Code: Select all

require "main"
Without the Lua extension

Re: Creating game view on iOS

Posted: Tue Dec 13, 2016 11:06 pm
by aloisdeniel
Okay thanks guys!

That's a good starting point, but this will not prevent to have a full-screen app with game running at startup. I would like to start the game from my existing iOS app : imagine a button that would trigger the game launch for example.

Re: Creating game view on iOS

Posted: Wed Dec 14, 2016 12:09 am
by slime
LOVE's source already has code to do something like that, you can probably modify it or use it as an example to do what you want:

https://bitbucket.org/rude/love/src/aa7 ... ios.mm-205

It gets run as part of initialization in the C main() before the Lua instance is started:

https://bitbucket.org/rude/love/src/aa7 ... ove.cpp-74

Re: Creating game view on iOS

Posted: Wed Dec 14, 2016 6:30 pm
by aloisdeniel
It seems very interesting, thanks slime!

I'll dig into this code and let you know if I achieved what I want! :)