Hey guys,
I'm trying to rotate my text string on a button so that it reads from the side of the screen, for example http://img253.imageshack.us/i/screenshotxk.jpg
How to create vertical text string?
Moderators: CEGUI MVP, CEGUI Team
Re: How to create vertical text string?
This is very easy. You need to set ZRotation property to 270 degrees. But it requires RenderToBufferObject, so it will not run on office computers with integrated graphics manufactured before 2008 year, for example, OpenGL 1.1 drivers. The bad thing is that CELayoutEditor doesn't support this.
C++:
Lua:
XML:
Best option is XML.
C++:
Code: Select all
CEGUI::WindowManager::getSingleton().getWindow( "root/StaticText" )->setProperty("ZRotation", "270");
Lua:
Code: Select all
CEGUI.WindowManager:getSingleton():getWindow("root/StaticText"):SetProperty("ZRotation","270");
XML:
Code: Select all
<Window Type="WindowsLook/StaticText" Name="root/StaticText" >
<Property Name="Text" Value=" text" />
<Property Name="ZRotation" Value="270" />
<Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.3,0},{0.55,0},{0.55,0}}" />
</Window>
Best option is XML.
helper to newbies
"i help you, dear newbie
but nobody helps me!"
"i help you, dear newbie
but nobody helps me!"
Re: How to create vertical text string?
Thanks for the reply uelkfr!
I've been trying this and unfortunately is doesn't seem to work
The following is my XML code:
And I'm running this on a Dell XPS w/ Dual Nvidia 8800 GTX cards, so I should be good with the RenderToBufferObject right?
thanks,
Alex
I've been trying this and unfortunately is doesn't seem to work
The following is my XML code:
Code: Select all
<!--SHIP CONTROL-->
<Window Type="TaharezLook/Static" Name="Root/ShipControl" >
<Property Name='UnifiedAreaRect' Value='{{0.95000,0.000000},{0.5,0.000000},{1.15,0.000000},{.7,0.000000}}'/>
<Property Name='Alpha' Value='0.3'/>
<Property Name='AlwaysOnTop' Value='true'/>
<Property Name='FrameEnabled' Value='false'/>
<Window Type='TaharezLook/StaticText' Name ='Root/ShipControl/Titlebar' >
<Property Name='UnifiedAreaRect' Value='{{0.0,0.00},{0.0,0.000000},{.25,0.000},{1.0,0.000000}}'/>
<Property Name='ZRotation' Value='270' />
<Property Name='Text' Value ='Ship Control'/>
<Property Name='AlwaysOnTop' Value='true'/>
<Property Name='TextColour' Value='FFFFFF' />
<Property Name='FrameEnabled' Value='false'/>
<Property Name='Tooltip' Value='right' />
</Window>
</Window>
And I'm running this on a Dell XPS w/ Dual Nvidia 8800 GTX cards, so I should be good with the RenderToBufferObject right?
thanks,
Alex
Re: How to create vertical text string?
I dunno. Do you have default Font set? Or at least one Font loaded?
Yeah, that <Property Name="BackgroundEnabled" Value="False" /> is that you also will need if you use StaticText as a child, but I think to rotate StaticText you will need square UnifiedAreaRect with conterminous center points and to render as separate window.
Code: Select all
CEGUI::Font font = CEGUI::FontManager::getSingleton().create( "DejaVuSans-10.font" );
CEGUI::System::getSingleton().setDefaultFont(font); // this not needed because first loaded font becomes default
Code: Select all
<Window Type="TaharezLook/Static" Name="Root/ShipControl" >
<Property Name="Alpha" Value="0.3" />
<Property Name="AlwaysOnTop" Value="True" />
<Property Name="FrameEnabled" Value="False" />
<Property Name="UnifiedAreaRect" Value="{{0.95,0},{0.5,0},{1,0},{0.7,0}}" />
<Window Type="TaharezLook/StaticText" Name="Root/ShipControl/Titlebar" >
<Property Name="Text" Value="Ship Control" />
<Property Name="Tooltip" Value="right" />
<Property Name="Rotation" Value="x:0 y:0 z:270" />
<Property Name="BackgroundEnabled" Value="False" />
<Property Name="HorzExtent" Value="108" />
<Property Name="VertExtent" Value="16.7334" />
<Property Name="AlwaysOnTop" Value="True" />
<Property Name="FrameEnabled" Value="False" />
<Property Name="UnifiedAreaRect" Value="{{0,-50},{0,-50},{1,50},{1,0}}" />
<Property Name="AutoRenderingSurface" Value="True" />
</Window>
</Window>
Yeah, that <Property Name="BackgroundEnabled" Value="False" /> is that you also will need if you use StaticText as a child, but I think to rotate StaticText you will need square UnifiedAreaRect with conterminous center points and to render as separate window.
helper to newbies
"i help you, dear newbie
but nobody helps me!"
"i help you, dear newbie
but nobody helps me!"
Re: How to create vertical text string?
Again, it should probably be said that static text might not actually be what you want. Name to the contrary it is not just a static text label. See this post by CE:
I would start by avoiding static text. To be honest, the static text has become bloated and horrible, and is not really suitable for a lightweight label class anymore - which is a shame, since that's what it was supposed to be. 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
Re: How to create vertical text string?
Thanks for the replies guys! I'm now using a push button, but to no avail. Let me clarify; the buttons load , but they are not rotated.
Please see the following xml:
I end up with a very squashed horizontal button Any ideas as to how to get a vertical button?
[EDIT]: In the CEGUI.log I'm seeing the error msg: "There is no Property named 'ZRotation' available in the set."
Could this be because I'm using CEGUI 0.6.2?
Please see the following xml:
Code: Select all
<Window Type="TaharezLook/Static" Name="Root/ShipControl" >
<Property Name='UnifiedAreaRect' Value='{{.95000,0.000000},{0.1,0.000000},{1.15,0.000000},{.4,0.000000}}'/>
<Property Name='Alpha' Value='0.3'/>
<Property Name='AlwaysOnTop' Value='true'/>
<Property Name='FrameEnabled' Value='false'/>
<Window Type='TaharezLook/Button' Name ='Root/ShipControl/Titlebar' >
<Property Name='UnifiedAreaRect' Value='{{0.0,0.00},{0.0,0.000000},{.25,0.000},{1.0,0.000000}}'/>
<Property Name='ZRotation' Value='270' />
<Property Name='Text' Value ='Ship Control'/>
<Property Name='AlwaysOnTop' Value='true'/>
<Property Name='TextColour' Value='FFFFFF' />
<Property Name='FrameEnabled' Value='false'/>
</Window>
I end up with a very squashed horizontal button Any ideas as to how to get a vertical button?
[EDIT]: In the CEGUI.log I'm seeing the error msg: "There is no Property named 'ZRotation' available in the set."
Could this be because I'm using CEGUI 0.6.2?
Re: How to create vertical text string?
Definitely update to 0.7.5
0.6.x has no rotation support (because there is no RTT support)
0.6.x has no rotation support (because there is no RTT support)
Re: How to create vertical text string?
Alright well I upgraded to 0.7.2 and the rotation works! Only problem is the clickable area of the button is set to area of the button before it was rotated. How can I set the clickable area to follow the rotation?
Much thanks,
alex
Much thanks,
alex
Re: How to create vertical text string?
The unprojecting code is a subject for rewrite (for 0.8 ), so I am not sure what works and what does not. I have had mixed experience with it. As a workaround, you can subclass and create your own hit test function.
Who is online
Users browsing this forum: No registered users and 21 guests