GLBasic forum

Main forum => GLBasic - en => Topic started by: MrPlow on 2014-Apr-24

Title: Multi Device Management
Post by: MrPlow on 2014-Apr-24
Hi

The answer might just be "use platforminfo command" but I want to check...

If using a game for android and iOS and Desktop what is the best method for managing all when using addons like AndroidExtras etc.?

Is it platforminfo best or have a separate project or something else?

(p.s. can someone repost the gameloop code based on Dewitter loop? Looks like its gone from forum)

Title: Re: Multi Device Management
Post by: hardyx on 2014-Apr-24
I think preprocessor commands is the best solution, because each platform can use the code they needs. You can create different executables with the same project.

Code (glbasic) Select

?IF DEFINED(WIN32) OR DEFINED(LINUX)
    // desktop code...
?ELSEIF DEFINED(IPHONE)
    // Apple code...
?ELSEIF DEFINED(ANDROID)
    // Android code...
?ELSE
    ?ERROR "Not supported platform"
?ENDIF

Title: Re: Multi Device Management
Post by: spacefractal on 2014-Apr-24
and uses functions as well, which can help very much instead using commands directly (as well DEFINED functions), example when doing GameController support.

Title: Re: Multi Device Management
Post by: MrPlow on 2014-Apr-24
Thanks will try this..!
Title: Re: Multi Device Management
Post by: spacefractal on 2014-Apr-25
not sure its fixed in v12, but eailer glbasic version was ANDROID not defined at all. But if its not fixed in this version (not tested), its can been done like this:

?DEFINE ANDROID
?IFDEF WIN32
   ?UNDEF ANDROID
?ENDIF
?IFDEF IPHONE
   ?UNDEF ANDROID
?ENDIF
?IFDEF OSXUNI
   ?UNDEF ANDROID
?ENDIF
?IFDEF WEBOS
   ?UNDEF ANDROID
?ENDIF

Top of your code, if the same issue happens.
Title: Re: Multi Device Management
Post by: MrPlow on 2014-Apr-25
Thanks Spacefractal!
Title: Re: Multi Device Management
Post by: kanonet on 2014-Apr-25
Just tested it: ?IFDEF ANDROID seems to work, so your workaround is not needed spacefractal.
Title: Re: Multi Device Management
Post by: spacefractal on 2014-Apr-25
nice to hear. Its was in "just in case" issue.