Relative coordinates and aspect ratio

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

User avatar
Nitro
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Wed Jan 12, 2005 12:06

Relative coordinates and aspect ratio

Postby Nitro » Mon Sep 29, 2008 12:58

Hello,

I run into this situation quite often: I am using relative coordinates so the gui works at different sizes and resolutions. Somtimes the gui consists of circles and I set relative their size to e.g. (0.1, 0.1). When the circle is displayed it doesn't appear as a circle, but as an ellipse. This is because my resolution is like 800x600 and the aspect ratio is not 1. Therefore the circle gets a size of 0.1 * 800, 0.1 * 600 which is 80,60 (an ellipse).

What's the recommended way to deal with aspect issues? Has CEGUI some builtin functionality to make this easier to work with? How are you dealing with aspect ratio issues?

-Matthias

P.S.: I know I can do all the scaling myself, but this seems a bit too much work.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Mon Sep 29, 2008 14:15

Hi,

Fonts and Imagesets have a method called "setNativeResolution", who accept a width and height. They update internal scaling factors, according to the values passed. It's good practice to call these methods after loading fonts and/or imagery.

HTH.
Check out my released snake game using Cegui!

User avatar
Nitro
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Wed Jan 12, 2005 12:06

Postby Nitro » Mon Sep 29, 2008 15:20

Thanks for your help. I guess this is a step in the right direction, but it doesn't quite work. The window layout is not affected by these calls at all, probably because they only affect imagesets and fonts internally somehow.

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

Postby CrazyEddie » Mon Oct 06, 2008 08:50

Hi,

Yes this is something of an issue, and when you factor in things such as folks with widescreen monitors vs those with standard 4:3 screens it becomes a real nightmare. I have to be honest and say that this did not receive any thought at all when creating the system (because at the time, and the reason for the systems creation, this was not an issue I had to think about :P ).

One thing you might be able to try is to have a square 'root' window. this will then cause all added content to have equal dimensions when using the same scale values on both the x and y axis.

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests