absolute window size

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

martini
Just popping in
Just popping in
Posts: 2
Joined: Mon Oct 29, 2007 16:47

absolute window size

Postby martini » Thu Nov 01, 2007 07:57

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?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Nov 01, 2007 12:11

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) ) );

martini
Just popping in
Just popping in
Posts: 2
Joined: Mon Oct 29, 2007 16:47

Postby martini » Wed Nov 14, 2007 20:58

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!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Nov 15, 2007 09:24

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" );


Return to “Help”

Who is online

Users browsing this forum: No registered users and 23 guests