Creating game view on iOS

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
aloisdeniel
Prole
Posts: 17
Joined: Sat Jan 30, 2016 5:57 pm
Contact:

Creating game view on iOS

Post by aloisdeniel » Mon Dec 12, 2016 8:37 pm

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 !
My LÖVE libraries : pixelatlas, pixelmap

User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Creating game view on iOS

Post by raidho36 » Tue Dec 13, 2016 12:10 am

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.

User avatar
Positive07
Party member
Posts: 1006
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Creating game view on iOS

Post by Positive07 » Tue Dec 13, 2016 12:51 am

Umm, pretty sure that should be

Code: Select all

require "main"
Without the Lua extension
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(Github.com/Positive07)

User avatar
aloisdeniel
Prole
Posts: 17
Joined: Sat Jan 30, 2016 5:57 pm
Contact:

Re: Creating game view on iOS

Post by aloisdeniel » Tue Dec 13, 2016 11:06 pm

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.
My LÖVE libraries : pixelatlas, pixelmap

User avatar
slime
Solid Snayke
Posts: 2899
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Creating game view on iOS

Post by slime » Wed Dec 14, 2016 12:09 am

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

User avatar
aloisdeniel
Prole
Posts: 17
Joined: Sat Jan 30, 2016 5:57 pm
Contact:

Re: Creating game view on iOS

Post by aloisdeniel » Wed Dec 14, 2016 6:30 pm

It seems very interesting, thanks slime!

I'll dig into this code and let you know if I achieved what I want! :)
My LÖVE libraries : pixelatlas, pixelmap

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests