Page 1 of 1

Relative coordinates and aspect ratio

Posted: Mon Sep 29, 2008 12:58
by Nitro
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.

Posted: Mon Sep 29, 2008 14:15
by scriptkid
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.

Posted: Mon Sep 29, 2008 15:20
by Nitro
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.

Posted: Mon Oct 06, 2008 08:50
by CrazyEddie
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.