HUD UI Scaling Issues...again.

Hey Community,

I am pretty lost on HUD / UI scaling involving textures and simply text as well. I’ve looked through a variety of sources, including the wiki and the FPS C++ project but I just can’t seem to grip the concept behind UI programming.

My biggest issue is that I have a texture that I would like to scale from left to right of the screen to fit any resolution, without touching the borders. Then I would like text to appear on this texture but the problem is whenever I change resolution sizes the text clips through the screen and then of course the texture itself loses it’s sharpness.

If anything I want to set something up like the image below. A dialogue box at the bottom that is centered in the middle. With text that won’t clip through the sides. Should I be using Canvas or Slate or does it really matter?

Drawing from the center of the image to place it in the middle isn’t an issue since I use this…

		float DX = DialogBoxes->GetSurfaceWidth();
		float DY = DialogBoxes->GetSurfaceHeight();

		float XPosition = SD.X / 2 - DX / 2; 
		float YPosition = SD.Y / 2 - DY / 2;

		DrawTexture(DialogBoxes, XPosition, YPosition, DialogBoxes->GetSurfaceWidth(), DialogBoxes->GetSurfaceHeight(), 1.0, 1.0, 1.0, 1.0);

The issue then becomes…well, as you can see. The Screen Dimension X has changed but the texture of course hasn’t, obviously. Though the problem is it has changed it’s position drastically which makes for inaccurate buttons or image draws which is an issue.

I want it to fit at a constant size regardless of the resolution, but it shouldn’t clip outside of the Canvas. How would I achieve this? Thank you!