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 »

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 »

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: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Creating game view on iOS

Post by Positive07 »

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/pablomayobre)
User avatar
aloisdeniel
Prole
Posts: 17
Joined: Sat Jan 30, 2016 5:57 pm
Contact:

Re: Creating game view on iOS

Post 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.
My LÖVE libraries : pixelatlas, pixelmap
User avatar
slime
Solid Snayke
Posts: 3161
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Creating game view on iOS

Post 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
User avatar
aloisdeniel
Prole
Posts: 17
Joined: Sat Jan 30, 2016 5:57 pm
Contact:

Re: Creating game view on iOS

Post by aloisdeniel »

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: Ahrefs [Bot], Amazon [Bot], Semrush [Bot] and 3 guests