[SOLVED]Progress bar help

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

maori
Just can't stay away
Just can't stay away
Posts: 161
Joined: Tue Sep 23, 2008 13:05
Location: Plumstead , UK

[SOLVED]Progress bar help

Postby maori » Fri Jun 12, 2009 10:04

hi guys

i'am trying to get a prgress bar to go up and down when i use the throttle of a joystick

i,ve managed to get the throttle name to appear ok but cant seem to work out how to make the progress bar work

can someone see where i messed up please

xml layout

Code: Select all

<Window Type="skin/ProgressBar" Name="throttle" >
                    <Property Name="StepSize" Value="0.01" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="CurrentProgress" Value="0" />
                    <Property Name="UnifiedAreaRect" Value="{{0.357247,0},{0.191645,0},{0.607247,0},{0.274619,0}}" />
                </Window>


code

Code: Select all

float Throttle;
ProgressBar* line = static_cast<ProgressBar*>(winMgr.getWindow( "throttle"))->setProgress(Throttle);
         if(Throttle <= 1.0f)
   {
      line->setPosition(CEGUI::Point(0, 1 -Throttle));
   }
   else if(nuiThrottleScale > 1.0f)
   {
      line->setPosition(CEGUI::Point(0, 0));
   }
   else
   {
      line->setPosition(CEGUI::Point(0, 1));
   }


TIA
Last edited by maori on Thu Jul 16, 2009 21:50, edited 1 time in total.
trying to upgrade to 0.8.2 from 0.7.9 :D

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Progress bar help

Postby CrazyEddie » Sun Jun 14, 2009 10:07

Hi,

Your code completely confuses me :)

In order to set the progress, you the the ProgressBar::setProgress function, though in your code you appear to be using 'setPosition' and passing a CEGUI::Point, which does not compile, right? The progress bar use is highly similar to the slider usage, in that you set a progress value of between 0.0 and 1.0 to represent the percentage of progress to show, the direction and behaviour of operation is controlled via the 'vertical' and/or 'reversed' option settings.

The main things you need to consider in doing this are the arrangement of the progress bar(s), and the format of the incoming data from the joystick. Meaning you have to consider how you translate that joystick data into relevant progress values for your progress bar(s) - if that data is already using the same scale, or something like -1.0 to +1.0, then you should be pretty much set - otherwise what you need to do, and how, will depend :)

CE.

maori
Just can't stay away
Just can't stay away
Posts: 161
Joined: Tue Sep 23, 2008 13:05
Location: Plumstead , UK

Re: Progress bar help

Postby maori » Mon Jun 15, 2009 11:42

Thanks CE

i think i understand :oops: will let you now if i can solve it here if not i be back :P
trying to upgrade to 0.8.2 from 0.7.9 :D

maori
Just can't stay away
Just can't stay away
Posts: 161
Joined: Tue Sep 23, 2008 13:05
Location: Plumstead , UK

Re: Progress bar help

Postby maori » Wed Jun 24, 2009 13:17

heya

ok some progress here :P
one prob is when i set

Code: Select all

ProgressBar *m_thottle = static_cast<ProgressBar*>(winMgr.getWindow( "mythrottle"));
    m_throttle->setProperty( "VerticalProgress", "True" );


the bar stays horizontal ??

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Progress bar help

Postby CrazyEddie » Thu Jun 25, 2009 08:58

This setting affects the internal workings of the progress bar rather than the visual appearance (obviously at some point the two are linked, but not in the way you want). What this means is that modifying the the setting will not change a progress bar designed to be horizontal into one that's vertical, or to put it another way, it's a setting intended to be used at the skin definition level rather than the application / layout level.

In order to get a vertical progress bar in a skin / theme that does not already have one, one would need to define a new WidgetLook in the skin, and an appropriate mapping in the scheme.

I think this is the right answer :)

CE.

maori
Just can't stay away
Just can't stay away
Posts: 161
Joined: Tue Sep 23, 2008 13:05
Location: Plumstead , UK

Re: Progress bar help

Postby maori » Fri Jun 26, 2009 10:21

heya CE

Thanks for the answer sir thought it was me doing something silly again :P
trying to upgrade to 0.8.2 from 0.7.9 :D

maori
Just can't stay away
Just can't stay away
Posts: 161
Joined: Tue Sep 23, 2008 13:05
Location: Plumstead , UK

Re: Progress bar help

Postby maori » Mon Jun 29, 2009 10:43

heya

okidoki getting close but image is off and could use some help with the look"n"feel :oops:
at present i have

Code: Select all

               <WidgetLook name="mySkin/VerticalProgressBar">
  <NamedArea name="ProgressArea">
    <Area>
      <Dim type="LeftEdge" >
        <ImageDim imageset="mySkin" image="VerticalProgressBarTop" dimension="Width" />
      </Dim>
      <Dim type="TopEdge" >
        <AbsoluteDim value="0" />
      </Dim>
      <Dim type="RightEdge" >
        <UnifiedDim scale="1" type="RightEdge">
          <DimOperator op="Subtract">
            <ImageDim imageset="mySkin" image="VerticalProgressBarBottom" dimension="Width" />
          </DimOperator>
        </UnifiedDim>
      </Dim>
      <Dim type="Height" >
        <UnifiedDim scale="1" type="Height" />
      </Dim>
    </Area>
  </NamedArea>
  <ImagerySection name="frame">
    <FrameComponent>
      <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 type="LeftEdge" imageset="mySkin" image="VerticalProgressBarTop" />
      <Image type="RightEdge" imageset="mySkin" image="VerticalProgressBarBottom" />
      <Image type="Background" imageset="mySkin" image="VerticalProgressBarMiddle" />
    </FrameComponent>
  </ImagerySection>
  <ImagerySection name="progress_lights" >
    <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="mySkin" image="VerticalProgressHighlight" />
      <VertFormat type="Stretched" />
      <HorzFormat type="Tiled" />
    </ImageryComponent>
  </ImagerySection>
  <StateImagery name="Enabled">
    <Layer>
      <Section section="frame" />
    </Layer>
  </StateImagery>
  <StateImagery name="Disabled">
    <Layer>
      <Section section="frame">
    <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
      </Section>
    </Layer>
  </StateImagery>
  <StateImagery name="EnabledProgress">
    <Layer>
      <Section section="progress_lights" />
    </Layer>
  </StateImagery>
  <StateImagery name="DisabledProgress">
    <Layer>
      <Section section="progress_lights">
        <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
      </Section>
    </Layer>
  </StateImagery>
</WidgetLook>

and this gives me an image like so how can i disable the side parts ?Image all i really need is the parts with the 2 thin blue lines and the middle if that makes sense
Thanks
trying to upgrade to 0.8.2 from 0.7.9 :D

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Progress bar help

Postby CrazyEddie » Tue Jun 30, 2009 09:03

This issue is due to the images you are using in the FrameComponent part of the progress bar frame. See these images here:

Code: Select all

      <Image type="LeftEdge" imageset="mySkin" image="VerticalProgressBarTop" />
      <Image type="RightEdge" imageset="mySkin" image="VerticalProgressBarBottom" />

You're using 'top' and 'bottom' images for 'left' and 'right' respectively, presumably these top and botom images are wider than just the thin lines, which is why you're seeing what you are. What you need to do is replace the use of those particular images with some that are more appropriate.

HTH

CE.

maori
Just can't stay away
Just can't stay away
Posts: 161
Joined: Tue Sep 23, 2008 13:05
Location: Plumstead , UK

Re: Progress bar help

Postby maori » Tue Jun 30, 2009 18:43

Thanks CE
trying to upgrade to 0.8.2 from 0.7.9 :D


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 11 guests