Hollywood bridge and double buffer

Discuss GUI programming with the RapaGUI plugin here
Post Reply
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Hollywood bridge and double buffer

Post by lazi »

There is something wrong if RapaGUI has a double buffered Hollywood display.
Here are two minimal examples:

1. Resizes correctly

Code: Select all

@REQUIRE "RapaGUI"
@DISPLAY 1,{Width = 320, Height = 200 }
@BGPIC 1,"logo.png"
@DISPLAY 2,{width = 320, Height = 16, color=$404040}

gui$=[[<?xml version="1.0" encoding="UTF-8"?>
		<application id="test" icon="Slarti.info">
		   <window id="mainwindow"  title="test"  activate="true">

					<vgroup>
						 <hgroup>
							 <hollywood id="timeline" hide="false" display="2" fixwidth="false" fixheight="true"/>
							 <button id="btn_msperpxplus" weight="5">-</button>
							 <button id="btn_msperpxminus" weight="5">+</button>
						 </hgroup>
					</vgroup>

           </window>
        </application>
	 ]]

moai.CreateApp(gui$)

Repeat
	WaitEvent
Forever
Image

2. If you resize it, the Hollywood display trashed with gui gfx. The only difference is the BeginDoubleBuffer() after moai.CreateApp().
@REQUIRE "RapaGUI"
@DISPLAY 1,{Width = 320, Height = 200 }
@BGPIC 1,"logo.png"
@DISPLAY 2,{width = 320, Height = 16, color=$404040}

gui$=[[<?xml version="1.0" encoding="UTF-8"?>
<application id="test" icon="Slarti.info">
<window id="mainwindow" title="test" activate="true">

<vgroup>
<hgroup>
<hollywood id="timeline" hide="false" display="2" fixwidth="false" fixheight="true"/>
<button id="btn_msperpxplus" weight="5">-</button>
<button id="btn_msperpxminus" weight="5">+</button>
</hgroup>
</vgroup>

</window>
</application>
]]

moai.CreateApp(gui$)

SelectDisplay(2)
BeginDoubleBuffer()
SelectDisplay(1)

Repeat
WaitEvent
Forever
Image
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Hollywood bridge and double buffer

Post by airsoftsoftwair »

I'm sorry, but that was a Hollywood bug. Fixed now. As a workaround, just enable autoscaling for this display and everything should work.
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: Hollywood bridge and double buffer

Post by lazi »

When the doublebuffer is not set, resize the window makes the bridged display size change.
When autoscale is enabled, the display size will not change, but the original size is scaled.

How does it work after the fix? Which is the intended way?

I wish that without autoscale, the display's size in pixels will change.

Hope it was understandable :)
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: Hollywood bridge and double buffer

Post by lazi »

The workaround that seems to solve it currently is that the frame drawing part is wrapped inside of a BeginDoubleBuffer() - EndDoubleBuffer() frame.
Tested that it double the time of the loop, but overall can't be seen.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Hollywood bridge and double buffer

Post by airsoftsoftwair »

lazi wrote:When the doublebuffer is not set, resize the window makes the bridged display size change.
When autoscale is enabled, the display size will not change, but the original size is scaled.

How does it work after the fix? Which is the intended way?

I wish that without autoscale, the display's size in pixels will change.
Hmm, right, so my autoscale workaround is not a real fix. The general problem is that Hollywood itself is rather inconsistent here. If you resize a real Hollywood display that is in double-buffering mode, the size of the double-buffer won't change. I don't remember why I implemented it like that in the first place and maybe this should be changed, but that's the way it has been all the way back since Hollywood 2.0. So if you want the double-buffer size to change on a non-autoscaled display, you have to call EndDoubleBuffer() and then BeginDoubleBuffer() again to achieve that whenever the display size changes.

Concerning RapaGUI, you could also call EndDoubleBuffer() and then BeginDoubleBuffer() whenever the size of the embedded display changes. Then it should work.
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: Hollywood bridge and double buffer

Post by lazi »

It will be enough if I can get SizeWindow() event from a RapaGUI bridged window, but I can't find a way for that.
Is there any possibility to know when a RapaGUI window/Area size changes?
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Hollywood bridge and double buffer

Post by airsoftsoftwair »

Are you using multiple Hollywood displays in your RapaGUI window? With a single Hollywood display the "SizeWindow" event should work...
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: Hollywood bridge and double buffer

Post by lazi »

Yes.
And as I recall this is something that we discussed before. Sorry to bring it up again. My memory is short and selective :)
Post Reply