Build app with Rapa gui and without it from one source file

Discuss GUI programming with the RapaGUI plugin here
Post Reply
sashapont
Posts: 144
Joined: Thu Aug 03, 2017 2:49 pm

Build app with Rapa gui and without it from one source file

Post by sashapont »

Is it possible to build app for different platforms with and without Rapafrom one source file?

I try to do this

Code: Select all

@IF #HW_ANDROID
@DISPLAY {Color = #WHITE, Sizeable = True, Width =800,Height =600, ScaleMode=#SCALEMODE_AUTO, ScreenName="Fireplace",Title = "Fireplace", Menu = 1}

@ELSE
@REQUIRE "RapaGUI"
@ENDIF
And it is not show window on android

User avatar
airsoftsoftwair
Posts: 4325
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Build app with Rapa gui and without it from one source file

Post by airsoftsoftwair »

From the doc:
also note that when compiling applets, none of the constants will be set because applets are meant to be completely platform-agnostic

sashapont
Posts: 144
Joined: Thu Aug 03, 2017 2:49 pm

Re: Build app with Rapa gui and without it from one source file

Post by sashapont »

And what can I do?

bitRocky
Posts: 112
Joined: Fri Nov 14, 2014 6:01 pm

Re: Build app with Rapa gui and without it from one source file

Post by bitRocky »

You can use

Code: Select all

v = GetVersion()
IsAndroid = (v.platform = "Android")
And then check the variable "IsAndroid"

Code: Select all

If IsAndroid
   CreateDisplay({Color = #WHITE, Sizeable = True, Width =800,Height =600, ScaleMode=#SCALEMODE_AUTO, ScreenName="Fireplace", Title = "Fireplace", Menu = 1})
Else
   LoadPlugin("RapaGUI")
Endif

sashapont
Posts: 144
Joined: Thu Aug 03, 2017 2:49 pm

Re: Build app with Rapa gui and without it from one source file

Post by sashapont »

Is not work :(

bitRocky
Posts: 112
Joined: Fri Nov 14, 2014 6:01 pm

Re: Build app with Rapa gui and without it from one source file

Post by bitRocky »

Sorry, I forgot something, CreateDisplay() needs as first argument an ID or Nil, you also need to open the display:

Code: Select all

If IsAndroid
   id = CreateDisplay(Nil, {Color = #WHITE, Sizeable = True, Width =800,Height =600, ScaleMode=#SCALEMODE_AUTO, ScreenName="Fireplace", Title = "Fireplace", Menu = 1})
   
   OpenDisplay(id)
Else
   LoadPlugin("RapaGUI")
Endif

sashapont
Posts: 144
Joined: Thu Aug 03, 2017 2:49 pm

Re: Build app with Rapa gui and without it from one source file

Post by sashapont »

LoadPlugin("RapaGUI") is not work for display plugins :(

When I write line

@REQUIRE "RapaGUI"

it is not work IN ANDROID

User avatar
airsoftsoftwair
Posts: 4325
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Build app with Rapa gui and without it from one source file

Post by airsoftsoftwair »

Yes, that's right. LoadPlugin() cannot be used with RapaGUI because RapaGUI needs to be loaded very early because it replaces core components. But you can always define your own constants, e.g.

Code: Select all

@IF #DOANDROID
   @REQUIRE "RapaGUI"
@ELSE
   @DISPLAY {...}
@ENDIF
And then compile like this for Android:

Code: Select all

Hollywood test.hws -compile test.hwa -setconstants DOANDROID=1
And compile without "-setconstants DOANDROID=1" for the other platforms.... should do the trick.

Post Reply