Jump to content
The Dark Mod Forums

Recommended Posts

Posted

Some time ago we added "forcescreenaspect" flag to GUI windows for this:

void idWindow::CalcClientRect(float xofs, float yofs) {
	drawRect = rect;

	if ( flags & WIN_INVERTRECT ) {
		drawRect.x = rect.x() - rect.w();
		drawRect.y = rect.y() - rect.h();
	}
	
	if (flags & WIN_SCREENASPECT) {
		float renderAspectRatio = float(renderSystem->GetScreenWidth()) / renderSystem->GetScreenHeight();
		float widthMultiplier = renderAspectRatio / (640.0f / 480.0f);
		drawRect.w /= widthMultiplier;
	}

Ideally, it should be combined with "hcenter" of course.

The plan was to go and add these flags to where they fit, but I did not return to this.

Posted

Oh, I tried to apply forceaspectratio to Objectives, it seems to apply to single window only.
To make this flag useful, it should apply recursively to all children.

Also there are forceAspectWidth, forceAspectHeight, but they also seem to be non-recursive.

Posted

I noticed those flags though pretty late in my exploration when I was looking at how the glasses worked. The aspect ratio is currently wrong on those galsses right now but I noticed the black transparency extends nicely onto the sides. Tried getting the spyglass looking as nice but adding a black background would also cover the spyglass lens.

I suppose the h/center and forceAspecWidth/Height have to be applied to every GUI file or at least the root windowDefs. My attempt goes for an automated approach and GUI authors can use flags to stop control it. Attaching all the stuff I did if you want to have a look.

  • Patch1.patch - Letterboxing for windowDefs. Menu cursor aspect rendering fix. Adds xOffset and yOffset to DeviceContext and a RestoreCoords() for reverse AdjustCoords() calculation.
  • Patch2.patch - Adjust clip rect coords so elements can render outside the letterbox like world books. Backgrounds will render fullscreen if the rect looks like a fullscreen rect.
  • Patch3.patch - Adds the aspectAware flag for making exceptions to rendering fullscreen rects so they become letterboxed instead.

Patch1.patch Patch2.patch Patch3.patch

  • Thanks 1
Posted

Thank you!
I have linked this to 5282.

Yes, I think doing this at the lower level of idDeviceContext (where virtual resolution scaling happens) is the better approach than trying to do it on the idWindow level.

It seems that you assume current UIs were made for 16:9. I'm afraid the sad truth is that they were partly made for 16:9 (new ones) and partly made for 4:3 (old ones). And the old ones look stretched. I'm not even sure which kind of intended aspect ratio is more popular now.
I guess I'll try to make the scaling configurable depending on settings in the root window (aka "Desktop") of the UI.

Moreover, we already have some overlay images prepared for several aspect ratios (ultrawide not included). Ideally, I'd like to drop all the duplicates and have only one image with proper scaling/padding. A long story obviously.

Yeah, the special handling of full-screen windows feels hacky. I guess I'll need to avoid it somehow.

Posted

Yep I assumed it was all 16:9. The code can be modified so referenceAspect is no longer const. It could use 16:9 as default and for other aspect ratios perhaps forceAspectWidth/Height can be set on those screens and the referenceAspect would be calculated based on those values.

I agree it would be nice to drop special images for different aspect ratios. I was able to change the spyglass & keyhole images to always use the 16:9 image and it worked nicely. The issue is just finding a way to have the black background continue outside the letterbox area so the game viewport is not leaking through.

With the fullscreen changes I was hoping to find some general way of correcting the UI without having to change the content too much, ideally so mission creators wouldn't have to go back and change their content to support different aspect ratios. I did however hit a roadblock because it seems that loading screens and briefing screens are copypasted for every mission so this content may need to be patched anyway.

If a whole pass on the GUI files is necessary anyway I would skip the fullscreen hack and aspectAware parameter and go with something else that makes sense.

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • The Black Arrow

      Things have been so bad these days for me...
      Just a year ago, I've been feeling dizzy, I thought it was nothing, today's stress, that type of thing, went to sleep...Still dizzy! 9 more days dizzy, went to doctor (I would have gone on the first day if NOT for the long appointment time)
      Said it may be Neck Dizziness...I did exercises for 6 months, no changes.
      Went to a Physical Therapist, went to another, no changes.
      I've asked my doctor for a full check this time.
      I hated yesteryear so much due to personal reasons, this year might be the same.
      To be brutally honest, I'd rather have cancer or/and chronic pain than suffer dizziness any second longer, especially when nothing helps.
      Hard to enjoy Thief when you're dizzy so I was hoping this year, Winter will be best for me.
      · 0 replies
    • JackFarmer

      Hello mappers and taffers! 

      Are you still out there? It is so calm here these days and I am afraid this is no good sign.
      Proof me wrong, tell your best friend (=me), that you are still here and that you will not go away!
      · 2 replies
    • JackFarmer

      Happy Labour Day, my taffing taffers & hard working mapping friends!
      And remember the poor souls who, within the Inventors’ organization, labor under Jonus’s yoke to ensure the success of that very guild! Always remember the hard workers!
      · 2 replies
    • datiswous

      Is there a script command to make a screenshot?
      I just though it could be interesting to be able to create a screenshot at a certain point in time. Then use that screenshot possibly in a debrief.
      I guess the second question is: Can you use a (in-game made) screenshot in a (debrief) gui?
      · 1 reply
    • Bikerdude  »  Display Cement

      So what type, and what ratio of portland to sand 😏
      · 1 reply
×
×
  • Create New...