Questions about LÖVE and iOS

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
bio1712
Citizen
Posts: 72
Joined: Wed Aug 19, 2015 4:13 pm
Location: Italy

Questions about LÖVE and iOS

Post by bio1712 »

Hello all.

I'm wondering some questions about the iOS project.

-Why the source is divided into 2 projects (love and liblove) ?

-How can these projects communicate?

-Where the LÖVE view is initialized?

And the most important:
-Is it possible to integrate some iOS native object with LÖVE? (Not directly in the game.love, but maybe modifying the xcodeproj, adding some subViews to the initial viewController)


Thank you.
bio1712
Citizen
Posts: 72
Joined: Wed Aug 19, 2015 4:13 pm
Location: Italy

Re: Questions about LÖVE and iOS

Post by bio1712 »

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

Re: Questions about LÖVE and iOS

Post by Positive07 »

I don't know that many issues working on iOS, but I'm rather sure that slime can help. Try contacting him directly or go to the irc he is usually there and you will have faster feedback
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
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Questions about LÖVE and iOS

Post by raidho36 »

I can only give solid answer to the last one -yes you can- because I've seen someone else doing it.

The love part can be thought as a basic shell that runs the app, and liblove part as a collection of LÖVE modules and scripts. To draw an analogy, love is a thin .exe and liblove is a bulk .dll that comes with it. They "communicate" using native application binary interface, that's nothing you should worry about though.

LÖVE is built on top of SDL, which handles things like window creation and user input. So it just tells SDL to create a window and that's the whole story. The rest is up to SDL.
bio1712
Citizen
Posts: 72
Joined: Wed Aug 19, 2015 4:13 pm
Location: Italy

Re: Questions about LÖVE and iOS

Post by bio1712 »

Positive07 wrote:I don't know that many issues working on iOS, but I'm rather sure that slime can help. Try contacting him directly or go to the irc he is usually there and you will have faster feedback
Great idea, thanks
raidho36 wrote:I can only give solid answer to the last one -yes you can- because I've seen someone else doing it.

The love part can be thought as a basic shell that runs the app, and liblove part as a collection of LÖVE modules and scripts. To draw an analogy, love is a thin .exe and liblove is a bulk .dll that comes with it. They "communicate" using native application binary interface, that's nothing you should worry about though.

LÖVE is built on top of SDL, which handles things like window creation and user input. So it just tells SDL to create a window and that's the whole story. The rest is up to SDL.
Good explanation, thank you.
Unfortunatly SDL does lots of things (such as the creation of the UIApplication or the creation of the initial view) that I can't find in the code, therefore adding a subView is complicated.
Another thing is that SDL uses its own classes of UIView and UIWindow and in this project there is no AppDelegate.
Today I'll try to create a new UIWindow using SDL as you said.
Thank you
gianmichele
Citizen
Posts: 63
Joined: Tue Jan 14, 2014 11:03 pm

Re: Questions about LÖVE and iOS

Post by gianmichele »

I'm interested as well. @slime?

I had planned to start integrating an Ad service on iOS (vungle or unity ads). My knowledge is limited in this area though so any help to where to start looking in the code would be appreciated.
bio1712
Citizen
Posts: 72
Joined: Wed Aug 19, 2015 4:13 pm
Location: Italy

Re: Questions about LÖVE and iOS

Post by bio1712 »

Update: I have added a new view succesfully. Unfortunatly creating a new window using SDL does not work. The key is to add a subview to the SDL_Window.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Questions about LÖVE and iOS

Post by slime »

Yes, you can add a subview to the SDL window's uiwindow, by using the SDL_GetWindowWMInfo function to obtain a pointer to the UIWindow. The SDL window / UIWindow is destroyed and recreated every time love.window.setMode is called.

'love' and 'liblove' are split up like that in all operating systems – on macOS / Linux / Windows, liblove is a dynamic library which you can use as a Lua module via require if you want. love is just a tiny executable which links to liblove. liblove is statically linked on iOS.

The AppDelegate and almost all platform-specific iOS code is in SDL, although you don't need to modify SDL to modify / add to the uiwindow (see above).
bio1712
Citizen
Posts: 72
Joined: Wed Aug 19, 2015 4:13 pm
Location: Italy

Re: Questions about LÖVE and iOS

Post by bio1712 »

slime wrote:Yes, you can add a subview to the SDL window's uiwindow, by using the SDL_GetWindowWMInfo function to obtain a pointer to the UIWindow. The SDL window / UIWindow is destroyed and recreated every time love.window.setMode is called.

'love' and 'liblove' are split up like that in all operating systems – on macOS / Linux / Windows, liblove is a dynamic library which you can use as a Lua module via require if you want. love is just a tiny executable which links to liblove. liblove is statically linked on iOS.

The AppDelegate and almost all platform-specific iOS code is in SDL, although you don't need to modify SDL to modify / add to the uiwindow (see above).
Now it sounds more clear :)

Since the Window is destroyed every time love.window.setMode is called, have I to recreate my subview every time?

EDIT: how do callbacks work?
Post Reply

Who is online

Users browsing this forum: No registered users and 170 guests