How to create vertical text string?

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

asjt3
Just popping in
Just popping in
Posts: 10
Joined: Fri Jun 12, 2009 13:54

How to create vertical text string?

Postby asjt3 » Tue Dec 21, 2010 21:48

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

uelkfr
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Tue Dec 14, 2010 16:57

Re: How to create vertical text string?

Postby uelkfr » Wed Dec 22, 2010 17:07

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++:

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

asjt3
Just popping in
Just popping in
Posts: 10
Joined: Fri Jun 12, 2009 13:54

Re: How to create vertical text string?

Postby asjt3 » Wed Dec 22, 2010 18:24

Thanks for the reply uelkfr!

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

uelkfr
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Tue Dec 14, 2010 16:57

Re: How to create vertical text string?

Postby uelkfr » Wed Dec 22, 2010 20:25

I dunno. Do you have default Font set? Or at least one Font loaded?

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

User avatar
Mikademus
CEGUI MVP
CEGUI MVP
Posts: 130
Joined: Wed Mar 18, 2009 19:14

Re: How to create vertical text string?

Postby Mikademus » Thu Dec 23, 2010 01:09

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

asjt3
Just popping in
Just popping in
Posts: 10
Joined: Fri Jun 12, 2009 13:54

Re: How to create vertical text string?

Postby asjt3 » Wed Jan 12, 2011 16:28

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:

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 :lol: 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?

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

Re: How to create vertical text string?

Postby Kulik » Wed Jan 12, 2011 17:19

Definitely update to 0.7.5
0.6.x has no rotation support (because there is no RTT support)

asjt3
Just popping in
Just popping in
Posts: 10
Joined: Fri Jun 12, 2009 13:54

Re: How to create vertical text string?

Postby asjt3 » Tue Jan 18, 2011 21:29

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

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

Re: How to create vertical text string?

Postby Kulik » Wed Jan 19, 2011 13:51

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.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 13 guests