x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Viewport Size vs. GSystemResolution

Hi all:

I've used both Viewport->GetSizeXY() and GSystemResolution, and have found that:

  1. GSystemResolution will return the project's standard resolution, no matter what the viewport size

  2. GetSizeXY() returns something CLOSER to the actual viewport size, but slightly bigger (see below)

As an example, if I run a game at 1280 x 720, #1 will return (1280x720) where as #2 will return (1290x754). Please note that GetSizeXY() is 10 pixels wider and 34 pixels taller. I'm assuming this is due to the Windows borders and title bar.

My question is, is there a way to get the Viewport space without having the Windows border elements added to the dimensions? I'm using #1 for the time being, but GetSizeXY() seems more flexible in that it will automatically adjust to the actual dimensions used in the Editor, etc.

Thank you,

p.s. Quick sample code for measuring your own screensize (so that others can see what I mean):

 myController = Cast<APlayerController>(UGameplayStatics::GetPlayerController(this->GetWorld(), 0));
 viewPortSize = this->GetWorld()->GetGameViewport()->Viewport->GetSizeXY();
 UE_LOG(LogTemp, Warning, TEXT("Viewport X- %i   Y- %i"), viewPortSize.X, viewPortSize.Y);
 UE_LOG(LogTemp, Error, TEXT("Resolution X- %i   Y- %i"), GSystemResolution.ResX, GSystemResolution.ResY);
Product Version: UE 4.16
Tags:
more ▼

asked Jul 18 '17 at 06:53 PM in Rendering

avatar image

Orakga
40 5 11 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question