Start libGDX game from Activity or UIView - How?

Anything libgdx related goes here!

Start libGDX game from Activity or UIView - How?

Postby quietline » Fri May 27, 2016 2:20 am

Not sure exactly how to ask this, but here it goes: Is it possible to program an iOS and Android app such that the LibGDX game portion of an app coexists with a native GUI (in each corresponding app of course) where the game would be launched via a button or something? The case would be where a portion of an app is built elsewhere and has other functionality but will need to load and run the game also.

The question revolves around whether the libGDX architecture is tied to needing to run the app as a whole or if the architecture allows for loading a game when needed. (Or, a third option would be that it is indeed possible, but not necessarily worth the effort.)

If it can be done, does anyone know if there are any code samples for Android and iOS?

QL
quietline
 
Posts: 16
Joined: Thu Sep 03, 2015 2:31 pm

Re: Start libGDX game from Activity or UIView - How?

Postby tenfour04 » Fri May 27, 2016 8:07 pm

Yes. On Android, call initializeForView() instead of initialize(), and it returns a View object that you can incorporate into your layout. Or you can use AndroidFragmentApplication to put a LibGDX game into any activity as a Fragment.

On iOS the game is in a UIViewController. I think you can pull this out and drop it into another view controller, but it's been a long time since I've done anything with iOS, so I'm not sure.
tenfour04
 
Posts: 1191
Joined: Sat Jun 18, 2011 3:24 pm

Re: Start libGDX game from Activity or UIView - How?

Postby ferrisxu » Fri Jun 08, 2018 4:11 pm

plz.help
ferrisxu
 
Posts: 32
Joined: Wed Apr 05, 2017 8:53 am

Re: Start libGDX game from Activity or UIView - How?

Postby aege21 » Fri Jul 13, 2018 10:48 pm

Do you have any example code to do this? Should I create the game to be called in another project or something like that? I'm currently developing an app to handle multiple minigames. So, I want to launch every game from my main activity.
aege21
 
Posts: 1
Joined: Fri Jul 13, 2018 10:37 pm


Return to Libgdx

Who is online

Users browsing this forum: No registered users and 1 guest