For those that are using canvas or even GFx.
I have a nice way to fix any aspect ratio problems when you are scaling your elements with RatioX and RatioY depending on screen resolution.
I hope this helps anyone!
In Your HUD Note : I'm extending HUD.UC
Code:function CheckViewPortAspectRatio() { local vector2D ViewportSize; local bool bIsWideScreen; local PlayerController PC; foreach LocalPlayerControllers(class'PlayerController', PC) { LocalPlayer(PC.Player).ViewportClient.GetViewportSize(ViewportSize); break; } bIsWideScreen = (ViewportSize.Y > 0.f) && (ViewportSize.X/ViewportSize.Y > 1.7); if ( bIsWideScreen ) { RatioX = SizeX / 1280.f; RatioY = SizeY / 720.f; } }
You can call this function in DrawHUD. So voila! It will detect any change in aspect ratio and change the default "ratio of viewport compared to native resolution" on the fly!






Reply With Quote


Bookmarks