Page 1 of 1
Build app with Rapa gui and without it from one source file
Posted: Sat Jun 09, 2018 2:34 pm
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
Re: Build app with Rapa gui and without it from one source file
Posted: Sat Jun 09, 2018 5:55 pm
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
Re: Build app with Rapa gui and without it from one source file
Posted: Sat Jun 09, 2018 11:19 pm
by sashapont
And what can I do?
Re: Build app with Rapa gui and without it from one source file
Posted: Sun Jun 10, 2018 12:13 am
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
Re: Build app with Rapa gui and without it from one source file
Posted: Sun Jun 10, 2018 11:40 am
by sashapont
Is not work
Re: Build app with Rapa gui and without it from one source file
Posted: Sun Jun 10, 2018 1:02 pm
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
Re: Build app with Rapa gui and without it from one source file
Posted: Mon Jun 11, 2018 9:55 am
by sashapont
LoadPlugin("RapaGUI") is not work for display plugins
When I write line
@REQUIRE "RapaGUI"
it is not work IN ANDROID
Re: Build app with Rapa gui and without it from one source file
Posted: Wed Jun 13, 2018 5:16 pm
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.