I'm having a mental blockage when it comes to working out aspect ratio scaling factors.
I'm generating some on-the-fly graphics in order to be resolution independant and aspect ratio aware. The nominal resolution I'm starting with is 640x480.
So, no aspect ratio correction is needed for a 640x480, 800x600, 1280x960 or 1600x1200 screen.
For 1920x1080 (which is a 16:9 aspect) I apply a 16/9 scaling factor for x coordinates, which looks almost right.
Here's some code to illistrate (if not demonstrate) what I'm doing:
**EDIT* What I'm looking for is a little formula that lets me vary the main.screenaspect modifier to give correct looking results for widescreen displays and also 5:4 displays (TFT's that do 1280x1024).
I'm going for a cuppa now, if anyone has any ideas on how to accomplish this little task, I would be most grateful :)
I'm generating some on-the-fly graphics in order to be resolution independant and aspect ratio aware. The nominal resolution I'm starting with is 640x480.
So, no aspect ratio correction is needed for a 640x480, 800x600, 1280x960 or 1600x1200 screen.
For 1920x1080 (which is a 16:9 aspect) I apply a 16/9 scaling factor for x coordinates, which looks almost right.
Here's some code to illistrate (if not demonstrate) what I'm doing:
' Kludge... Global main:config = config.start() main.screenwidth = 1920 main.screenheight = 1080 main.screenaspect = 16.0/9.0 main.screencenterx = main.screenwidth/2 main.screencentery = main.screenheight/2 main.screendepth = 32 main.scalex = (main.screenwidth/640) * (1/main.screenaspect) main.scaley = (main.screenheight/480)
**EDIT* What I'm looking for is a little formula that lets me vary the main.screenaspect modifier to give correct looking results for widescreen displays and also 5:4 displays (TFT's that do 1280x1024).
I'm going for a cuppa now, if anyone has any ideas on how to accomplish this little task, I would be most grateful :)