Shifting in 16:10 (and 16:9) resolutions with SetHudSize

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
skadoomer
Posts: 1026
Joined: Fri Sep 05, 2003 12:49 pm

Shifting in 16:10 (and 16:9) resolutions with SetHudSize

Post by skadoomer »

I've noticed that unlike 4:3 resolutions where you can scale down your resolution with SetHudSize, doing the same in 16:10 (and 16:9) dosn't start drawing from the left most edge of the screen. Instead, it sets the 0 of the x axis to an area not on the edge of the screen.

Included is an example wad. I set my resolution to 1440 x 900 in 16:10 and tried to scale it down to 720 x 480, but it indents the text so its not flush with the left edge of the screen. If this is intentional behavior, is there anything to set so the 0,0 to the top left corner like square resolutions (like 4:3 and 5:4)?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Shifting in 16:10 (and 16:9) resolutions with SetHudSize

Post by Graf Zahl »

This is fully intentional to ensure that everything drawn with SetHUDSize is properly scaled and uses the proper aspect ratio. Otherwise you'd get distortion on at least some resolutions.
User avatar
Nash
 
 
Posts: 17484
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Shifting in 16:10 (and 16:9) resolutions with SetHudSize

Post by Nash »

I also ran into such a problem. I can only think of one ugly hack...

Use Blzut3's aspect ratio checker function (it's probably in one of his posts here, or maybe even on the wiki) and in your drawing functions, make special-case checks for widescreen modes that position the X coordinates of the graphic differently...

It's tedious but it's probably the only way to do it now. :( Even then, I'm not sure if this is 100% widescreen proof... IIRC, some unconventional widescreen modes behave really, REALLY differently in regards to HUDMessage positioning...
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm
Contact:

Re: Shifting in 16:10 (and 16:9) resolutions with SetHudSize

Post by bagheadspidey »

Nash wrote:Use Blzut3's aspect ratio checker function
This. You can find his "getaspectratio" function on the wiki. Try this bit of code on top of that for an easy way to get the "real" leftmost and rightmost pixel position:

Code: Select all

function int GetHudRight(int w)
{
  int ar = getaspectratio();
  
  if (ar == ASPECT_16_10)
  {
    return w + (FixedDiv(w<<16,10.0)>>16);
  }
  if (ar == ASPECT_16_9)
  {
    return w + (FixedDiv(w<<16,5.9)>>16);
  }
  return w;
}

function int GetHudLeft(int w)
{
  return w - GetHudRight(w);
}
param w should be the same width passed to SetHudSize. At 4:3, GetHudRight(320) will return 320 and GetHudLeft(320) will return 0. At wider resolutions, GetHudRight(320) will return > 320 and GetHudLeft(320) will return < 0. I'm using this code to keep a radar lined up with the right edge of the screen in this demo mod. Let me know if you guys find any bugs with this.
User avatar
Nash
 
 
Posts: 17484
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Shifting in 16:10 (and 16:9) resolutions with SetHudSize

Post by Nash »

Thanks for the code. It works beautifully!

Also, a little topic... have you stopped developement of your DoomCrap tools? Why? :(
skadoomer
Posts: 1026
Joined: Fri Sep 05, 2003 12:49 pm

Re: Shifting in 16:10 (and 16:9) resolutions with SetHudSize

Post by skadoomer »

Graf Zahl wrote:This is fully intentional to ensure that everything drawn with SetHUDSize is properly scaled and uses the proper aspect ratio. Otherwise you'd get distortion on at least some resolutions.
I understand that mapping a square resolution into a wide screen would cause this effect, but it seems odd that it would choose to do this using lesser resolutions of the same aspect ratio group. Your telling me its intentional that setting Sethudsize in 800 x 500 (a 16:10 resolution) would cause this offset if you set it to 720 x 480 (a lower resolution in 16:10)? Even in 5:4, using a lower resolution screen size works correctly. Does this have anything to do with they fact that they are more square? In almost every 4:3, setting the resolution to 320 x 200 or 640 x 480 (provided the resolution is 800 x 600 or something higher in the 4:3 resolution bracket), it draws to the top left corner of the screen.
Nash wrote:Use Blzut3's aspect ratio checker function
Already being used, its how I figured out what resolution to scale down to. I'm trying to make conscious effort to be full resolution aware or my larger aspects of hudmessage usage to have objects be placed in similar places.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Shifting in 16:10 (and 16:9) resolutions with SetHudSize

Post by Graf Zahl »

SetHUDSize sets the virtual resolution for the center 4:3 area. It does not interpret the given values in any way, in particular what ratio they'd be numerically.
skadoomer
Posts: 1026
Joined: Fri Sep 05, 2003 12:49 pm

Re: Shifting in 16:10 (and 16:9) resolutions with SetHudSize

Post by skadoomer »

Makes sense, it just makes things a little more complicated.
Post Reply

Return to “Closed Bugs [GZDoom]”