How to do a progression bar with CEGUI ?
Moderators: CEGUI MVP, CEGUI Team
How to do a progression bar with CEGUI ?
Hello,
Does somebody know how to make a progression bar from a picture ?
I mean, I have a graphical bar, and I want to display part of it only, and it will change gradually and programmatically at runtime.
Should I luse a simple CEGUI::StaticImage (how ?) or there is a more suitable component for that ?
Thank you,
Vincent
Does somebody know how to make a progression bar from a picture ?
I mean, I have a graphical bar, and I want to display part of it only, and it will change gradually and programmatically at runtime.
Should I luse a simple CEGUI::StaticImage (how ?) or there is a more suitable component for that ?
Thank you,
Vincent
For the 2005 year, I will not complain anymore about open source projects.
Re: How to do a progression bar with CEGUI ?
Lol, I just found a file named "CEGUIProgressBar.h"
Perhaps it is doing what I want ..
Perhaps it is doing what I want ..
For the 2005 year, I will not complain anymore about open source projects.
Re: How to do a progression bar with CEGUI ?
Finally, the progress bar doesn't do what I need (my bar is a vertical bar), so I found the solution in the StaticImage :
To avoid the picture to be streched while resizing the componant, I am using the vertical formating :
<pre>
m_pEnergyBar->setVerticalFormatting(StaticImage::VertFormatting::BottomAligned);
</pre>
It was that simple
To avoid the picture to be streched while resizing the componant, I am using the vertical formating :
<pre>
m_pEnergyBar->setVerticalFormatting(StaticImage::VertFormatting::BottomAligned);
</pre>
It was that simple
For the 2005 year, I will not complain anymore about open source projects.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: How to do a progression bar with CEGUI ?
Yeah, this would have been my suggestion here, since the current 'looks' can't do what you needed without some modification.
With the approach you've taken you just need to adjust the position and/or size of the StaticImage so that the image it draws gets clipped as required to give the illusion of the progress graphic expanding / retracting.
CE.
With the approach you've taken you just need to adjust the position and/or size of the StaticImage so that the image it draws gets clipped as required to give the illusion of the progress graphic expanding / retracting.
CE.
- Assidragon
- Just popping in
- Posts: 6
- Joined: Sun Jan 16, 2005 02:24
- Location: Hungary
- Contact:
Re: How to do a progression bar with CEGUI ?
Well, it has been answered, but I thought I'd just post the other possible way to make it, in case someone would ever like to try it out another way:
This thing just resets the image of the staticImage, and then sets the staticimage window to the appropiate size. I just like this way because it allows me to have bars that grow towards the left side of the screen, not only to the right.
Code: Select all
staticImageset->undefineImage((utf8*)imagename);
staticImageset->defineImage((utf8*)imagename,
Point(0.0f, 0.0f),
Size(originaltex_x * ratiox, originaltex_y * ratioy),
Point(0.0f,0.0f));
window->setSize(Size(original_windowx * ratiox, original_windowy * ratioy));
This thing just resets the image of the staticImage, and then sets the staticimage window to the appropiate size. I just like this way because it allows me to have bars that grow towards the left side of the screen, not only to the right.
Sorry to bring up an old topic guys, however I'm trying not to create un-neccassary threads.
Basically As mentioned above a few years ago by someone else, A Progress bar from an image is what I want.
I've got 2 images from 2 different image sets currently.
The first one I'm calling an overlay i.e. the one at the front.
The second one I'm calling background. i.e. the one behind.
Both images are the same except from some diffeing colours.
Basically I want to remove chunks of the overlay image to show the background image in accordance with a float value.
I'm currently using CEGUI version 0.5, mainly because when I implement 0.6 many many problems occur and I don't want to mess around for another 6 hours re coding my gui manager.
If there is an easy fix for this in the latest version I am happy to update to it if there is an "easy" wqay of implementing this.
Any help would be appreciated.
Basically As mentioned above a few years ago by someone else, A Progress bar from an image is what I want.
I've got 2 images from 2 different image sets currently.
The first one I'm calling an overlay i.e. the one at the front.
The second one I'm calling background. i.e. the one behind.
Both images are the same except from some diffeing colours.
Basically I want to remove chunks of the overlay image to show the background image in accordance with a float value.
I'm currently using CEGUI version 0.5, mainly because when I implement 0.6 many many problems occur and I don't want to mess around for another 6 hours re coding my gui manager.
If there is an easy fix for this in the latest version I am happy to update to it if there is an "easy" wqay of implementing this.
Any help would be appreciated.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
I've looked into this a little...
I'm not sure what 'version' the original issue was raised against. Having looked into the intended implementation for the existing versions (including 0.5.x) this should actually be possible, and the fact that it isn't is a bug (the code that is supposed to calculate the clipping rectangle for the progress imagery is instead affecting the area rectangle used for rendering the imagery itself.
It's an easy fix (if you want a patch against 0.5.x code, you'll have to ask), though since it appears to be a long standing bug, I have to now evaluate the impact of fixing the issue.
CE.
I'm not sure what 'version' the original issue was raised against. Having looked into the intended implementation for the existing versions (including 0.5.x) this should actually be possible, and the fact that it isn't is a bug (the code that is supposed to calculate the clipping rectangle for the progress imagery is instead affecting the area rectangle used for rendering the imagery itself.
It's an easy fix (if you want a patch against 0.5.x code, you'll have to ask), though since it appears to be a long standing bug, I have to now evaluate the impact of fixing the issue.
CE.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
No, not really
What I'm saying is that the CEGUI ProgressBar widget should do what you want, and in fact, is set up so that it very easily does what you want - that is, it can draw one image (or set of images) as a background, and then uses another image (or set of images) as a foreground that is drawn over the top of the background. The foreground image is clipped according to the current progress, and so obscures some parts of the background, while other parts show though.
This all works 'out of the box' as it were (with appropriate looknfeel definitions), except that prior to my fix, the clipping part was not working as expected; rather than drawing the foreground image full size and clipping it, it would instead scale the imagery to fit into the clipping region (which for some instances is useful and what you want, but not in most(?) cases).
I have fixed this in branches/v0-6, and yes, to get the fix you'd need to modify the CEGUI code and rebuild.
I feel that it's unlikely you'd need to mess around with StaticImages, I can't recall the exact state of things back in Feb 2005, though I'm 99% certain the the original issue related to the 'old' way of rendering, in which the general setup was hard-coded and not easily modified, unlike today where you can hack around on some XML and away you go!
CE.
What I'm saying is that the CEGUI ProgressBar widget should do what you want, and in fact, is set up so that it very easily does what you want - that is, it can draw one image (or set of images) as a background, and then uses another image (or set of images) as a foreground that is drawn over the top of the background. The foreground image is clipped according to the current progress, and so obscures some parts of the background, while other parts show though.
This all works 'out of the box' as it were (with appropriate looknfeel definitions), except that prior to my fix, the clipping part was not working as expected; rather than drawing the foreground image full size and clipping it, it would instead scale the imagery to fit into the clipping region (which for some instances is useful and what you want, but not in most(?) cases).
I have fixed this in branches/v0-6, and yes, to get the fix you'd need to modify the CEGUI code and rebuild.
I feel that it's unlikely you'd need to mess around with StaticImages, I can't recall the exact state of things back in Feb 2005, though I'm 99% certain the the original issue related to the 'old' way of rendering, in which the general setup was hard-coded and not easily modified, unlike today where you can hack around on some XML and away you go!
CE.
ahh okay, updating to version 0.6 then...
and messing with progress bar again..
so get one of the lazy animators I'm working with to draw some art for it and work from there you say.
goodo.
Cheers
oh and I think I'll stay around on these forums for a while. who knows if I need help or can give any.
Well back to work... ahh webcomics.. I mean coding
and messing with progress bar again..
so get one of the lazy animators I'm working with to draw some art for it and work from there you say.
goodo.
Cheers
oh and I think I'll stay around on these forums for a while. who knows if I need help or can give any.
Well back to work... ahh webcomics.. I mean coding
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
If you want the version that has the clipping fix you'll need the code from SVN in cegui_mk2/branches/v0-6 - the code in this branch can largely be considered 'stable' as it's where all the maintenance releases are made from. Currently there is no released version that has this fix at present (since it was only fixed yesterday - though the fix will be in the next release, be that 0.6.2 or 0.7.0).
If you do not require the fix (depending on your imagery arrangement, you may not, then 0.5.x should still work the same as the unfixed 0.6.x version.
CE.
If you do not require the fix (depending on your imagery arrangement, you may not, then 0.5.x should still work the same as the unfixed 0.6.x version.
CE.
[solved]
I've worked out a deal with the project manager and a couple of animators so that we no longer need to use the method mentioned earlier.
We've simply placed an overlay with transparent points in it whilst having a resizing block of solid colour behind it. not as effcient as I'd like, however it's simple.
Many thanks.
Consider this problem solved
We've simply placed an overlay with transparent points in it whilst having a resizing block of solid colour behind it. not as effcient as I'd like, however it's simple.
Many thanks.
Consider this problem solved
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 1 guest