DirectX 9.0c scalable image

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Fra3ture
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 13, 2010 14:59

DirectX 9.0c scalable image

Postby Fra3ture » Mon Nov 15, 2010 21:05

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?

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: DirectX 9.0c scalable image

Postby Jamarr » Mon Nov 15, 2010 21:18

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).
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

Fra3ture
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 13, 2010 14:59

Re: DirectX 9.0c scalable image

Postby Fra3ture » Mon Nov 15, 2010 21:22

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.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: DirectX 9.0c scalable image

Postby Jamarr » Mon Nov 15, 2010 21:36

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 ;)
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

Fra3ture
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 13, 2010 14:59

Re: DirectX 9.0c scalable image

Postby Fra3ture » Tue Nov 16, 2010 14:21

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?

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: DirectX 9.0c scalable image

Postby Kulik » Tue Nov 16, 2010 14:28

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.

Fra3ture
Just popping in
Just popping in
Posts: 9
Joined: Wed Oct 13, 2010 14:59

Re: DirectX 9.0c scalable image

Postby Fra3ture » Tue Nov 16, 2010 14:44

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")

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: DirectX 9.0c scalable image

Postby Jamarr » Tue Nov 16, 2010 14:58

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 ;)
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 17 guests