Results 1 to 3 of 3
  1. #1
    Palace Guard
    Join Date
    Aug 2008
    Location
    Location,Location
    Posts
    3,720

    Default WideScreen HotFix Canvas

    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!
    Last edited by TheAgent; 07-10-2011 at 05:25 PM.

  2. #2
    MSgt. Shooter Person
    Join Date
    Jun 2009
    Location
    Los Angeles
    Posts
    184

    Default

    Thanks!

  3. #3
    Palace Guard
    Join Date
    Aug 2008
    Location
    Location,Location
    Posts
    3,720

    Default

    You are welcome! Hope it is useful.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.