I need to do what CE suggested in this thread... however I have no idea how to do this.
" I would suggest skinning DefaultWindow using the Falagard/Default window renderer to create a basic label class and replace the static text instances with that, since - unless you want scrollbars and a bunch of other bloat in your labels - this will lighten the load considerably IMO."
viewtopic.php?f=10&t=5229&p=25505&hilit=static+text#p25505
Right now, I create all my windows using the create("") function in C++, I don't usually mess with layouts, looknfeels or schemes.
I tried modifying the existing windows such as WindowsLook/StaticText but it gives errors, I'm guessing i would have to change the CEGUI source code for this method to work.
the reason why I am doing this is for performance reasons, it seems like static text is about 10 times slower to create than a static image. Hopefully I can make them equal.
I am really lost here... maybe someone can give me a list of steps on how to do this?
Heres what I have:
1. Add a new entry to windowslook.looknfeel.
2. Add a new entry to windowslook.scheme and windowslookwidgets.scheme (why is there 2?)
3. Start using it in the code.
I'm using cegui 7.5.
[Solved] Much faster static text widget
Moderators: CEGUI MVP, CEGUI Team
-
- Quite a regular
- Posts: 46
- Joined: Fri Mar 19, 2010 05:31
[Solved] Much faster static text widget
Last edited by ShadowTiger on Tue Aug 02, 2011 23:14, edited 4 times in total.
Re: How do i create a lighter static text widget?
I believe this post covers everything: viewtopic.php?p=22795#p22795
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!
-
- Quite a regular
- Posts: 46
- Joined: Fri Mar 19, 2010 05:31
Re: How do i create a lighter static text widget?
Hey, thanks to Jamarr for the link... great success.
I reduced the load time of my GUI from 1.156 seconds to 0.051 seconds... 95% reduction in load times!!!
That was with 61 Static Text widgets being used (in addition to dozens of image windows).
If you are using a static text widget... I highly recommend you implement this change immediately.
Heres the code to put in your looknfeel, I put in some properties for backwards compatibility. Note that frame enabled and background enabled don't do anything.
Edit: It looks like the spacing is different... trying to fix that now...
VertFormatProperty and HorzFormatProperty are not being used on the window...
to be specific, you can left/right and top/bottom align the text, but you cannot centre align them or word wrap them... making this window almost useless to me.
here is the addition to the .scheme file... pretty basic
I reduced the load time of my GUI from 1.156 seconds to 0.051 seconds... 95% reduction in load times!!!
That was with 61 Static Text widgets being used (in addition to dozens of image windows).
If you are using a static text widget... I highly recommend you implement this change immediately.
Heres the code to put in your looknfeel, I put in some properties for backwards compatibility. Note that frame enabled and background enabled don't do anything.
Edit: It looks like the spacing is different... trying to fix that now...
VertFormatProperty and HorzFormatProperty are not being used on the window...
to be specific, you can left/right and top/bottom align the text, but you cannot centre align them or word wrap them... making this window almost useless to me.
Code: Select all
<!--
***************************************************
WindowsLook/StaticLabel
***************************************************
-->
<WidgetLook name="WindowsLook/StaticLabel">
<PropertyDefinition name="FrameEnabled" initialValue="false" redrawOnWrite="false" />
<PropertyDefinition name="BackgroundEnabled" initialValue="false" redrawOnWrite="false" />
<PropertyDefinition name="TextColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
<PropertyDefinition name="VertFormatting" initialValue="CentreAligned" redrawOnWrite="true" />
<PropertyDefinition name="HorzFormatting" initialValue="CentreAligned" redrawOnWrite="true" />
<ImagerySection name="label">
<TextComponent>
<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>
<VertFormatProperty name="VertFormatting" />
<HorzFormatProperty name="HorzFormatting" />
</TextComponent>
</ImagerySection>
<StateImagery name="Enabled">
<Layer>
<Section section="label">
<ColourRectProperty name="TextColours" />
</Section>
</Layer>
</StateImagery>
<StateImagery name="Disabled">
<Layer>
<Section section="label">
<ColourRectProperty name="TextColours" />
</Section>
</Layer>
</StateImagery>
</WidgetLook>
here is the addition to the .scheme file... pretty basic
Code: Select all
<FalagardMapping WindowType="WindowsLook/StaticLabel" TargetType="DefaultWindow" Renderer="Falagard/Default" LookNFeel="WindowsLook/StaticLabel" />
-
- Quite a regular
- Posts: 46
- Joined: Fri Mar 19, 2010 05:31
Re: [Almost Solved] How to create a lighter static text widg
Does anyone know if the default window renderer will allow me to use Word wrap and and centering of text?
It doesn't seem to work. Also, I tried using a static window renderer and that didn't seem to support this either, and I couldn't get colours to show up but maybe im doing it wrong.
I really feel like I should just modify the cegui library directly at this point since its so difficult to figure out what will work and what wont with the xml.
However I would like to avoid this if possible because it makes upgrading to new version harder. It would also be alot of work figuring out what to change and where.
It doesn't seem to work. Also, I tried using a static window renderer and that didn't seem to support this either, and I couldn't get colours to show up but maybe im doing it wrong.
I really feel like I should just modify the cegui library directly at this point since its so difficult to figure out what will work and what wont with the xml.
However I would like to avoid this if possible because it makes upgrading to new version harder. It would also be alot of work figuring out what to change and where.
Re: [Almost Solved] How to create a lighter static text widg
ShadowTiger wrote:Does anyone know if the default window renderer will allow me to use Word wrap and and centering of text?
It will. See the code in this thread.
-
- Quite a regular
- Posts: 46
- Joined: Fri Mar 19, 2010 05:31
Re: Problem with WordWrap and Centering
I was using stuff like "HorzCentred" and "VertCentred"
Maybe these are deprecated and left for backwards compatibility in the static-text widget... but not for other widgets
switching to "centreAligned" seems to fix this.
Yeah... thanks for pointing out that what I had was correct.
Maybe these are deprecated and left for backwards compatibility in the static-text widget... but not for other widgets
switching to "centreAligned" seems to fix this.
Yeah... thanks for pointing out that what I had was correct.
Who is online
Users browsing this forum: No registered users and 14 guests