Page 1 of 1

DirectX 9.0c scalable image

Posted: Mon Nov 15, 2010 21:05
by Fra3ture
At the moment I have CEGUI working as a perfectly fine set of buttons that carry out the required actions as and when I need them. Now I'm onto my games main hud.

I'm currently in the process of making a very simple 3D racing game and want a simple bar to increase and decrease when the player accelerates and decelerates respectively. So far I have managed to get a CEGUI window to render an image inside of it like so:

Code: Select all

    <Window Type="TaharezLook/Menubar" Name="Menu/Hud">
               <Property Name="UnifiedPosition" Value="{{0.25,0},{0.25,0}}" />
               <Property Name="UnifiedSize" Value="{{0.5,0},{0.5,0}}" />

         <Window Type="TaharezLook/StaticImage" Name="Menu/HudImage">
            <Property Name="UnifiedPosition" Value="{{0.25,0},{0.25,0}}" />
                     <Property Name="UnifiedSize" Value="{{0.5,0},{0.5,0}}" />
                <Property Name="Image" Value="set:holder image:full_image" />

         </Window>

      <Property Name="Visible" Value="False" />

        </Window>


Now I've tried setting up a variable inside of this code block so that on a button press, the image inside the window gets longer/bigger. How ever, this brought nothing but bugs. I have had a look round the web and the forums but couldn't find anything to help me. Could someone please inform me what I'm doing wrong?

Re: DirectX 9.0c scalable image

Posted: Mon Nov 15, 2010 21:18
by Jamarr
It is hard to diagnose and/or give any definitive suggestions when your only description of the problem is:
Fra3ture wrote:bugs


I will say that most people tend to use the ProgressBar widget, since this already implements the technique you are trying to reproduce. Do note however that there were some bugs related to this widget fixed in some earlier releases (I know of at least one fix in v0.7.1).

Re: DirectX 9.0c scalable image

Posted: Mon Nov 15, 2010 21:22
by Fra3ture
By bugs I meant it didn't work. I assume because I did something wrong. I can't give any further information further to that as I just generally don't know what I did wrong. All I know is, what ever I did, CEGUI didn't like it. So out it came.

I gave you as much information as I could.

Thank you for the tip though.

Re: DirectX 9.0c scalable image

Posted: Mon Nov 15, 2010 21:36
by Jamarr
There is always more information to give. Even the most detailed, anal personalities will leave off seemingly insignificant details only to later realize their significance. Several so called geniuses have proven this throughout history ;)

Saying that something "does not work" implies two things: 1) an assumption by you of what you expect to happen and 2) what actually happened. You provided neither. You could have also provided code snippets of what you tried, and the steps you took to address the issue, so that we could infer what it was you where actually attempting to do.

In any case, I am not trying to ruffle your feathers I am simply trying to help you to help us help you. I would highly suggested reading: What have you tried? as it is quite insightful. Good luck with your project ;)

Re: DirectX 9.0c scalable image

Posted: Tue Nov 16, 2010 14:21
by Fra3ture
Right o. I am currently using a progress bar and I'm trying to get the bar to increase when I click on the left mouse button. My layout code is as follows:

Code: Select all

    <Window Type="TaharezLook/ProgressBar" Name="Menu/Hud">
               <Property Name="UnifiedPosition" Value="{{0.25,0},{0.25,0}}" />
               <Property Name="UnifiedSize" Value="{{0.5,0},{0.5,0}}" />

         <Window Type="TaharezLook/StaticImage" Name="Menu/HudImage">
            <Property Name="UnifiedPosition" Value="{{0.25,0},{0.25,0}}" />
                     <Property Name="UnifiedSize" Value="{{0.5,0},{0.5,0}}" />
                <Property Name="Image" Value="set:holder image:full_image" />
         </Window>

        <Property Name="StepSize" Value="0.1" />
      <Property Name="CurrentProgress" Value="0" />
      <Property Name="Visible" Value="False" />
        </Window>


The code I'm using to click on the mouse is as follows:

Code: Select all

CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);
CEGUI::ProgressBar::setStepSize(0.1f);
      CEGUI::ProgressBar::step();


The mouse button does work as I already have working buttons that flip between my different game states. When I build with the above I get the following error

Error 1 error C2352: 'CEGUI::ProgressBar::step' : illegal call of non-static member function
Error 1 error C2352: 'CEGUI::ProgressBar::setStepSize' : illegal call of non-static member function


What is it that I'm missing here?

Re: DirectX 9.0c scalable image

Posted: Tue Nov 16, 2010 14:28
by Kulik
These certainly aren't bugs. You have to call these methods on an instance instead of calling them as static methods (which they are not). Get the progress bar using WindowManager.

Re: DirectX 9.0c scalable image

Posted: Tue Nov 16, 2010 14:44
by Fra3ture
Is there anything I should set it to? I've tried setFalagardType(ProgressBar) and setPropertity with the same function. But still get the same problem.

My code is as follows:

Code: Select all

WindowManager::getSingleton().getWindow("Menu/Hud")

Re: DirectX 9.0c scalable image

Posted: Tue Nov 16, 2010 14:58
by Jamarr
Some of the samples (CEGUI\Samples) provided with CEGUI demonstrate basic usage of the progress bar widget. For example, the Demo7 project. There are also several pages on the wiki and in the forum discussing how to use the progress bar. Take some time to search these sources, play with the samples, and all will become clear ;)