Page 1 of 1

absolute window size

Posted: Thu Nov 01, 2007 07:57
by martini
is there a way to specify an absolute window size (e.g. in screenpixels) so that the window isn't scaled if the resolution is changed?

and is it also possible to setup absolute positions for the widgets within the windows?

Posted: Thu Nov 01, 2007 12:11
by CrazyEddie
Yes to both questions.

Virtually all parts of the system use the 'UDim' concept which provides scale and offset components, to specify an absolute size or position you use the offset part of the UDim and set the scale to 0.

Code: Select all

// Position a window to pixel coordinates (10,20)
myWnd->setPosition( CEGUI::UVector2( CEGUI::UDim( 0, 10 ), CEGUI::UDim( 0, 20 ) ) );

// Set window size to 150 x 200 pixels
myWnd->setSize( CEGUI::UVector2( CEGUI::UDim( 0, 150 ), CEGUI::UDim( 0, 200) ) );

Posted: Wed Nov 14, 2007 20:58
by martini
thx, that works for the window. but the text within the window rescales if i scale the viewport window. do you also have a solution for this? thx!

Posted: Thu Nov 15, 2007 09:24
by CrazyEddie
The fonts have an 'autoscaled' setting, if you turn this off the text will no longer rescale along with the vp.

You can do this within the font XML by changing the attribute part:

Code: Select all

Autoscaled="true"


to

Code: Select all

Autoscaled="false"


or in code by:

Code: Select all

// myFont is a ptr to the font object
myFont->setProperty( "AutoScaled", "false" );