Scalable squared elements (in a grid for example)

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

matt
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Tue Nov 08, 2011 16:00

Scalable squared elements (in a grid for example)

Postby matt » Fri May 04, 2012 14:53

Hello!

I'm currenlty designing an interface with CEGUI, and I would like to make it the more scalable that I could
I found this thread which is quite interesting:
http://www.cegui.org.uk/phpBB2/viewtopic.php?f=3&t=5257

Indeed, my main problem is that sometimes I need some scalable squared elements (buttons for example), and I don't know how to create them in . layout file.
For example I have a grid of 2x2 buttons, and the only way i found is to put them in absolute size

Code: Select all

<Window Type="MyWidgets/ContainerWindow" Name="Root/MainView/" >   
    <Property Name="UnifiedSize" Value="{{0.0,50},{0.0,240}}" />               
    <Property Name="HorizontalAlignment" Value="Right" />
    <Property Name="VerticalAlignment" Value="Top" />
           
        <Window Type="GridLayoutContainer" Name="Root/MainView/MainBlock">
            <Property Name="HorizontalAlignment" Value="Centre" />
            <Property Name="VerticalAlignment" Value="Centre" />
            <Property Name="GridSize" Value="w:2 h:2" />
           
            <Window Type="MyLook/RadioButton" Name="Button1" >
                <Property Name="UnifiedSize" Value="{{0.0,20},{0.0,20}}" />
            </Window>
            <Window Type="MyLook/RadioButton" Name="Button2" >
                <Property Name="UnifiedSize" Value="{{0.0,20},{0.0,20}}" />
            </Window>
            <Window Type="MyLook/RadioButton" Name="Button3" >
                <Property Name="UnifiedSize" Value="{{0.0,20},{0.0,20}}" />
            </Window>
            <Window Type="MyLook/RadioButton" Name="Button4" >
                <Property Name="UnifiedSize" Value="{{0.0,20},{0.0,20}}" />
            </Window>
           
        </Window>

</Window>


Is there a way to say to elements Height to be a relative size of their width?
For example if we have an element in a 10x10 grid, and the relative width of this elements is 0.1 (in order to fit 10 elements in a row), then would it possible to set a "kind of relative height (vs its width)" to this element to 1.0, in order to have squared elements. (not depending of the ratio of the parent container).

Thanx in advance for the help

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

Re: Scalable squared elements (in a grid for example)

Postby Kulik » Wed May 09, 2012 08:38

Hi,

this is possible with AspectLock and AspectRatio features of CEGUI 1.0 (unreleased). Sadly it's way harder in 0.7 (requires custom code that reacts to Size changes basically and even then there are some quirks about the behaviour).

matt
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Tue Nov 08, 2011 16:00

Re: Scalable squared elements (in a grid for example)

Postby matt » Thu May 10, 2012 11:37

ok, thanx Kulik for your answer!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 8 guests