Creating staticimage in Runtime
Moderators: CEGUI MVP, CEGUI Team
-
- Just popping in
- Posts: 12
- Joined: Wed Jun 04, 2008 21:24
Creating staticimage in Runtime
I'm making something like a mini-map, with dots representing objects in the world. I need to create StaticImage windows during runtime for each object in the scene. Now the WindowManager class can get me the window, but I can't figure out how to set the image into it. While the XML has the Image property, it isn't showing up in code.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Hi,
You might consider a creating custom widget instead - having lots of little static image windows sound expensive to me
Anyway, to answer your question - you still use the property from code:
HTH
CE.
You might consider a creating custom widget instead - having lots of little static image windows sound expensive to me
Anyway, to answer your question - you still use the property from code:
Code: Select all
myStaticImage->setProperty( "Image", "set:MiniMapObjects image:Whatever" );
HTH
CE.
-
- Just popping in
- Posts: 12
- Joined: Wed Jun 04, 2008 21:24
So far I've yet to get the staticimage to appear. I've debugged through and the size and position are right, but the window won't appear. I must be missing a step in creating it at runtime.
That's basically what I have for the window, but nothing will appear. Even tried adding a font and text.
Code: Select all
CEGUI::Window* contact = CEGUI::WindowManager::getSingleton().createWindow("WaveloreGUI/StaticImage", "GreenBlipIcon");
mGuiWindow->getChild("SceneMapImage")->addChildWindow(contact);
contact->setProperty("Image", "set:GreenBlipImage image:full_image");
contact->setVisible(true);
contact->setMaxSize(CEGUI::UVector2(CEGUI::UDim(1,0), CEGUI::UDim(1,0)));
contact->setWidth(CEGUI::UDim(0, 50));
contact->setHeight(CEGUI::UDim(0, 50));
contact->setPosition(position);
contact->moveToFront();
That's basically what I have for the window, but nothing will appear. Even tried adding a font and text.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
-
- Just popping in
- Posts: 12
- Joined: Wed Jun 04, 2008 21:24
No errors in the log.
I haven't had any issues with StaticImage windows created through XML. This is the only situation. I've tested the imageset and image on other StaticImage windows and had no problems. Tried different sizes and positions. Tried making it a child of the root.
The only thing I can think is the createWindow function isn't working right. I checked the .cpp for the function and noticed that it should call the logger to write that a window was created. That message isn't in the log. I just had to assume that the "type" was a type define in the Scheme, as putting in just "Window" or "StaticImage" caused a crash.
Code: Select all
<FalagardMapping WindowType="WaveloreGUI/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="WaveloreGUI/StaticImage" />
Code: Select all
<WidgetLook name="WaveloreGUI/StaticImage">
<PropertyDefinition name="ImageColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
<PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
<PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
<PropertyDefinition name="VertFormatting" initialValue="Stretched" redrawOnWrite="true" />
<PropertyDefinition name="HorzFormatting" initialValue="Stretched" redrawOnWrite="true" />
<Property name="BackgroundEnabled" value="False" />
<Property name="FrameEnabled" value="False" />
<ImagerySection name="image_withframe">
<ImageryComponent>
<Area>
<Dim type="LeftEdge" >
<ImageDim imageset="WaveloreGUI" image="Border_Left" dimension="Width" />
</Dim>
<Dim type="TopEdge" >
<ImageDim imageset="WaveloreGUI" image="Border_Top" dimension="Height" />
</Dim>
<Dim type="RightEdge" >
<UnifiedDim scale="1" type="RightEdge">
<DimOperator op="Subtract">
<ImageDim imageset="WaveloreGUI" image="Border_Right" dimension="Width" />
</DimOperator>
</UnifiedDim>
</Dim>
<Dim type="BottomEdge" >
<UnifiedDim scale="1" type="BottomEdge">
<DimOperator op="Subtract">
<ImageDim imageset="WaveloreGUI" image="Border_Bottom" dimension="Height" />
</DimOperator>
</UnifiedDim>
</Dim>
</Area>
<ImageProperty name="Image" />
<ColourRectProperty name="ImageColours" />
<VertFormatProperty name="VertFormatting" />
<HorzFormatProperty name="HorzFormatting" />
</ImageryComponent>
</ImagerySection>
<ImagerySection name="image_noframe">
<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>
<ImageProperty name="Image" />
<ColourRectProperty name="ImageColours" />
<VertFormatProperty name="VertFormatting" />
<HorzFormatProperty name="HorzFormatting" />
</ImageryComponent>
</ImagerySection>
<StateImagery name="Enabled" />
<StateImagery name="Disabled" />
<StateImagery name="EnabledFrame">
<Layer>
<Section look="WaveloreGUI/StaticShared" section="frame" />
</Layer>
</StateImagery>
<StateImagery name="DisabledFrame">
<Layer>
<Section look="WaveloreGUI/StaticShared" section="frame" />
</Layer>
</StateImagery>
<StateImagery name="WithFrameEnabledBackground">
<Layer>
<Section look="WaveloreGUI/StaticShared" section="background" />
</Layer>
</StateImagery>
<StateImagery name="WithFrameDisabledBackground">
<Layer>
<Section look="WaveloreGUI/StaticShared" section="background" />
</Layer>
</StateImagery>
<StateImagery name="NoFrameEnabledBackground">
<Layer>
<Section look="WaveloreGUI/StaticShared" section="background_noframe" />
</Layer>
</StateImagery>
<StateImagery name="NoFrameDisabledBackground">
<Layer>
<Section look="WaveloreGUI/StaticShared" section="background_noframe" />
</Layer>
</StateImagery>
<StateImagery name="WithFrameImage">
<Layer>
<Section section="image_withframe" />
</Layer>
</StateImagery>
<StateImagery name="NoFrameImage">
<Layer>
<Section section="image_noframe" />
</Layer>
</StateImagery>
</WidgetLook>
I haven't had any issues with StaticImage windows created through XML. This is the only situation. I've tested the imageset and image on other StaticImage windows and had no problems. Tried different sizes and positions. Tried making it a child of the root.
The only thing I can think is the createWindow function isn't working right. I checked the .cpp for the function and noticed that it should call the logger to write that a window was created. That message isn't in the log. I just had to assume that the "type" was a type define in the Scheme, as putting in just "Window" or "StaticImage" caused a crash.
-
- Just popping in
- Posts: 12
- Joined: Wed Jun 04, 2008 21:24
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Who is online
Users browsing this forum: No registered users and 11 guests