Page 1 of 1

BUG? FrameComponent and ProgressBar

Posted: Tue Oct 20, 2009 09:05
by lcy03406
1. In FrameComponent::render_impl(), the clipper is used when rendering the background, but is not used when rendering the other images, the 'frame'.
2. In FalProgressBar::render(), I think progressRect and progressClipper should swap.
Now a ProgressBar which 'progress_light' contains a frame looks strange.

Re: BUG? FrameComponent and ProgressBar

Posted: Tue Oct 20, 2009 10:38
by CrazyEddie
Hi,

Thanks for the info - sounds bug-like; I'll test it out (no fixes 'till after 0.7.1 though).

CE.

Re: BUG? FrameComponent and ProgressBar

Posted: Tue Oct 27, 2009 01:11
by lcy03406
I think over and find there is two kinds of 'FrameComponent in ProgressBar'. Suppose here is a ProgressBar's background

bbbbbbbbbbbb
bbbbbbbbbbbb
bbbbbbbbbbbb

and here is a Frame

xxxxxxxxxxxx
xoooooooooox
xxxxxxxxxxxx

When the progress is 50%,which shound the bar looks like?

xxxxxxbbbbbb
xooooobbbbbb
xxxxxxbbbbbb

or

xxxxxxbbbbbb
xooooxbbbbbb
xxxxxxbbbbbb

I want the second one, but I think the first one is also useful somewhere. Which does CEGUI support? Or both, how to specify them?

Re: BUG? FrameComponent and ProgressBar

Posted: Fri Dec 04, 2009 11:19
by CrazyEddie
Both of these scenarios are possible and what gets drawn and how is controlled in the looknfeel specifications. Basically, the imagery specified under the EnabledProgress and DisabledProgress StateImagery parts is drawn into the area specified in the ProgressArea NamedArea, and - crucially - clipped at a point determined by scaling by the current progress. Since you do not want the clipping, all you need to do is scale the areas for the progress imagery by the current progress (i.e. setting the right edge to coincide with the right edge of the clipping area - thus, the imagery is drawn unclipped).

For example, you might have an imagery section named "progress_imagery", and define it as such:

Code: Select all

        <ImagerySection name="progress_imagery" >
            <FrameComponent>
                <Area>
                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                    <Dim type="Width" >
                        <UnifiedDim scale="1" type="Width">
                            <DimOperator op="Multiply">
                                <PropertyDim name="CurrentProgress" />
                            </DimOperator>
                        </UnifiedDim>
                    </Dim>
                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
                </Area>
                <Image type="TopLeftCorner" imageset="AnImageset" image="FrameTopLeft" />
                <Image type="TopRightCorner" imageset="AnImageset" image="FrameTopRight" />
                <Image type="BottomLeftCorner" imageset="AnImageset" image="FrameBottomLeft" />
                <Image type="BottomRightCorner" imageset="AnImageset" image="FrameBottomRight" />
                <Image type="LeftEdge" imageset="AnImageset" image="FrameLeft" />
                <Image type="TopEdge" imageset="AnImageset" image="FrameTop" />
                <Image type="RightEdge" imageset="AnImageset" image="FrameRight" />
                <Image type="BottomEdge" imageset="AnImageset" image="FrameBottom" />
                <Image type="Background" imageset="AnImageset" image="FrameMiddle" />
            </FrameComponent>
        </ImagerySection>


The important part is where the width is multiplied by the current progress value, here:

Code: Select all

                    <Dim type="Width" >
                        <UnifiedDim scale="1" type="Width">
                            <DimOperator op="Multiply">
                                <PropertyDim name="CurrentProgress" />
                            </DimOperator>
                        </UnifiedDim>
                    </Dim>


HTH

CE.