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

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

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

Post by sashapont » Sat Jun 09, 2018 2:34 pm

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: 2668
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 » Sat Jun 09, 2018 5:55 pm

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: 87
Joined: Thu Aug 03, 2017 2:49 pm

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

Post by sashapont » Sat Jun 09, 2018 11:19 pm

And what can I do?

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

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

Post by bitRocky » Sun Jun 10, 2018 12:13 am

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: 87
Joined: Thu Aug 03, 2017 2:49 pm

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

Post by sashapont » Sun Jun 10, 2018 11:40 am

Is not work :(

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

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

Post by bitRocky » Sun Jun 10, 2018 1:02 pm

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: 87
Joined: Thu Aug 03, 2017 2:49 pm

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

Post by sashapont » Mon Jun 11, 2018 9:55 am

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

When I write line

@REQUIRE "RapaGUI"

it is not work IN ANDROID

User avatar
airsoftsoftwair
Posts: 2668
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 » Wed Jun 13, 2018 5:16 pm

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