Page 1 of 1
Can I turn off RAPAGUI in middle of program?
Posted: Fri Jan 17, 2025 1:15 pm
by Bugala
I ran into new problem with RAPAGUI. Appears that as long as I have "
@REQUIRE "RapaGUI" my program not only runs much slower, but it also reacts to mouse clicks very slow. Can easily take more than a second for it to react to mouseclicks.
If I simply remove the Require RapaGUI part from my code, it works no problem at all.
And to clarify, idea was that I used RapaGUI to let user choose the screenmode, but even by skipping this RapaGUI part completely and opening predefined screenmode, still this @REGUIRE "RapaGUI" line causes problem.
Therefore I wonder if I can let user first choose the screenmode, and then completely close RapaGUI. Currently I am using
moai.FreeApp() but that doesn't help avoid the problem.
Re: Can I turn off RAPAGUI in middle of program?
Posted: Fri Jan 17, 2025 8:39 pm
by Bugala
Here is an example code to demonstrate the problem:
Code: Select all
EscapeQuit(True)
@REQUIRE "RapaGUI"
Function draw()
Box(100, 100, 100, 100, color)
EndFunction
color=#RED
SetInterval(1, draw, 50)
CreateDisplay(0, {Width=1920, Height=1080, Title = "Rogue Football Cardgame", Sizeable=False, borderless=True, smoothscale=True, Mode="Windowed", monitor=1})
OpenDisplay(0)
MakeButton(1, #SIMPLEBUTTON, 100, 100, 100, 100, {OnMouseDown=Function()
C=1-C
If C=0 Then color=#RED
If C=1 Then color=#BLUE
EndFunction})
Repeat
WaitEvent
Forever
Without
@REQUIRE "RapaGUI" program is fully responsive, with the line, it clearly is less responsive.
Tested with HW 10, Windows 11
Re: Can I turn off RAPAGUI in middle of program?
Posted: Sat Jan 18, 2025 9:26 am
by Bugala
To add bit more explanation.
Unresponsiveness can be tested by repeatedly clicking on the box. It is supposed to change between red and blue each time you click inside the rectangle area.
With the RAPAGui line, the first one-two clicks seem to happen with normal speed, after that it slows down reacting to clicks. Also, if you keep a break clicking, then the next click happens instant again, after which it slows down responding again.
Re: Can I turn off RAPAGUI in middle of program?
Posted: Sat Jan 18, 2025 3:32 pm
by Flinx
I know these problems. Look at andreas' answer
here, though it is meant for Linux.
And to see the reason, insert a
above your main loop, and compare the drawing speed:
Code: Select all
Function draw()
ResetTimer(1)
Box(100, 100, 100, 100, color)
DebugPrint(GetTimer(1))
EndFunction
Here (on an older Windows machine) the
Box() needs 22-30 ms when using RapaGUI, without RapaGUI it needs fewer than 1 ms.
Re: Can I turn off RAPAGUI in middle of program?
Posted: Sun Jan 19, 2025 2:01 pm
by Bugala
Thanks.
Although not the answer I was hoping for, this at least tells me I have to figure out some other solution than RapaGUI for my problem, since RapaGUI wont work.
Re: Can I turn off RAPAGUI in middle of program?
Posted: Fri Jan 24, 2025 10:27 pm
by airsoftsoftwair
On Windows/macOS/Linux it's not possible to turn off RapaGUI. Once you
@REQUIRE RapaGUI all display-related stuff will run through RapaGUI since on those platforms it's not possible for Hollywood's inbuilt display handler to co-exist with RapaGUI.
On Amiga & compatibles things are different. On Amiga RapaGUI doesn't even replace Hollywood's inbuilt display handler because thanks to the ingenuity of Exec signal and message handling it's perfectly possible to seamlessly integrate RapaGUI with Hollywood's inbuilt display handler so on Amiga systems you also won't have the problem that drawing will be slower once RapaGUI is active because Hollywood's inbuilt display handler will still be used.
On Windows/macOS/Linux that's not possible so using RapaGUI will completely replace Hollywood's inbuilt display handler by a custom RapaGUI one which can be much slower (and also doesn't support everything Hollywood's inbuilt display handler supports). E.g. Hollywood's inbuilt display handler on Windows uses Direct2D for accelerated drawing. RapaGUI can't do that. So using RapaGUI really isn't a good idea if you care about raw drawing performance.
Re: Can I turn off RAPAGUI in middle of program?
Posted: Sat Jan 25, 2025 2:17 pm
by Bugala
Thanks for clarifying and confirming that. Unfortunately RapaGUI doesnt work as the solution to my problem, for it had been handy otherwise.