Page 1 of 1

Horizontal Progress Bar. [SOLVED]

Posted: Fri Jul 25, 2008 03:46
by ara
So, we got a Vertical Progress Bar working as an Ammo Bar in our project, and then I was asked for a horizontal (is it z outside of American English too?) Bar So I proceded to copy my already working Progress Bar, remove the <Property name="VerticalProgress" value="True"/> and change the image used. put it in the layout and gave it to the programmers.

It proceeded not to work. It was always shown as full.

So we put the Property line back in. and it worked. changed the value to "False". didnt work.

We then set it to ReversedProgress and left it (so we have a working indicator) and it worked but we want it to go left to right if possible.

the widget looknfeel looks as such.

Code: Select all

    <WidgetLook name="bbUI/HUD/HeatBar">
        <Property name="ReversedProgress" value="True"/>
        <NamedArea name="ProgressArea">
            <Area>
                <Dim type="LeftEdge">
                    <AbsoluteDim value="0"/>
                </Dim>
                <Dim type="TopEdge">
                    <AbsoluteDim value="0" />
                </Dim>
                <Dim type="Width">
                    <UnifiedDim scale="1" type="Width"/>
                </Dim>
                <Dim type="Height">
                    <UnifiedDim scale="1" type="Height"/>
                </Dim>
            </Area>
        </NamedArea>
        <ImagerySection name="bg">
            <ImageryComponent>
                <Area>
                    <Dim type="LeftEdge">
                        <AbsoluteDim value="0"/>
                    </Dim>
                    <Dim type="TopEdge">
                        <AbsoluteDim value="0" />
                    </Dim>
                    <Dim type="Width">
                        <UnifiedDim scale="1" type="Width"/>
                    </Dim>
                    <Dim type="Height">
                        <UnifiedDim scale="1" type="Height"/>
                    </Dim>
                </Area>
                <Image imageset="bbHUD"
                    image="HeatBarBG"
                    />
                <VertFormat type="TopAligned"/>
                <HorzFormat type="CenterAligned"/>
            </ImageryComponent>
        </ImagerySection>
        <ImagerySection name="fg">
            <ImageryComponent>
                <Area>
                    <Dim type="LeftEdge">
                        <AbsoluteDim value="0"/>
                    </Dim>
                    <Dim type="TopEdge">
                        <AbsoluteDim value="0" />
                    </Dim>
                    <Dim type="Width">
                        <UnifiedDim scale="1" type="Width"/>
                    </Dim>
                    <Dim type="Height">
                        <UnifiedDim scale="1" type="Height"/>
                    </Dim>
                </Area>
                <Image imageset="bbHUD"
                    image="HeatBarFG"
                    />
                <VertFormat type="TopAligned"/>
                <HorzFormat type="CenterAligned"/>
            </ImageryComponent>
        </ImagerySection>

        <StateImagery name="Enabled">
            <Layer>
                <Section section="bg"/>
            </Layer>
        </StateImagery>
        <StateImagery name="Disabled"/>
        <StateImagery name="EnabledProgress">
            <Layer>
                <Section section="fg"/>
            </Layer>
        </StateImagery>
        <StateImagery name="DisabledProgress"/>
    </WidgetLook>


unfortunately I am unable to say which version the project is using and i dont have a working build to produce a log. (and the layouteditor one wouldnt give you quite the right info.)
i can say that the copyright line in the comment headers of CEGUI.h says 2006.....

oh wait.

CEGUIVersion.h

Code: Select all

//////////////////////////////////////////////////////////////////////////
// Define CEGUI version
//////////////////////////////////////////////////////////////////////////
#define CEGUI_VERSION_MAJOR 0
#define CEGUI_VERSION_MINOR 5
#define CEGUI_VERSION_PATCH 1


so what? 0.5.1?

anyway. thanks in advance.

Re: Horizontal Progress Bar.

Posted: Fri Jul 25, 2008 08:58
by CrazyEddie
ara wrote:...I was asked for a horizontal (is it z outside of American English too?)

Yeah, it is. Though it's Centre and not Center - which I think is at least part of your issue ;)

So, seriously: The alignment values are misspelled as "CenterAligned" and should be "CentreAligned".

Another thing to consider is that in a horizontal progress bar, having an image centre aligned on the horizontal axis will cause the image to move around as opposed to some other effect; this may be what you intended, thought I'd mention it incase it wasn't.

In order to get the left->right working you should remove the ReversedProgress property (should be more functional with the alignment name fix).

HTH

CE.

Posted: Sat Jul 26, 2008 02:35
by ara
lol. thanks. go me and my spelling.

so i go substitue Center/Centre over all of my looknfeel files and get 119 substitutions over 119 lines.

i dont think ill be spelling it center again.

ill try the new file on monday and post the results.

and thanks for the advice. ill see what it looks like and go from there.

EDIT: Thanks for the help. it was indeed my spelling.

you were also correct about my not wanting a centre alignment. what i was after was actually RightAligned.

Posted: Tue Jul 29, 2008 08:35
by CrazyEddie
Cool :)

One last 'new' thing I have to mention. A recently discovered (and fixed) bug will possibly change the behaviour of the progress bar imagery in future releases - the effect is highly dependent upon exactly how you have things arranged. The <=0.6.1 behaviour can still be achieved however by using the DimOperator in the looknfeel to multiply some part(s) of the progress imagery part(s) by the property "CurrentProgress". If you update at any time and are affected by this change, but are unsure how to get the behaviour you want, someone will be able to provide a more concrete example :)

CE.