- Joined
- May 3, 2016
- Messages
- 2,601
- Solutions
- 6
- Reaction score
- 2,051
- Points
- 145
- Favorite Pinball Machine
- Attack From Mars
Everyone knows a HUD overlay is squeezed together when it is displayed on a monitor that is rotated to 270 degrees. I have found you can create an extra wide version of the overlay that will display textures correctly at 270 degrees but then of course it will look stretched apart at 0 degrees. I sent @ravarcade a message saying I wanted to be able to switch between 2 overlays and asked if there is a way I can identify the setting for rotation (0, 90, 180, 270) that an end user selects. He said this script would accomplish what I want:
xBAM.Camera.AspectRatio < 1.0 ' screen is wide (the end user selected either 0 or 180 degrees rotation)
xBAM.Camera.AspectRatio > 1.0 ' screen is tall (the end user selected either 90 or 270 degrees rotation)
In conclusion, you can create 2 versions of the same overlay, one that displays correctly on a desktop (normally using 0 degrees rotation) and another that displays correctly on a pinball cabinet (which normally use 270 degrees rotation). You need to use the same image list for both overlays. Then, you can then use Rafal's code to select which overlay is displayed.
I have found that I can code both overlays identically and use a transparent texture to turn the display on and off without using the fade functions. Then I can add this code to the "BeginPlay" subroutine and the correct overlay will be displayed:
If xBAM.Camera.AspectRatio =< 1.0 then Overlay2.fadeout ' screen is wide
If xBAM.Camera.AspectRatio > 1.0 then Overlay1.fadeout ' screen is tall
This works by having both overlays display the same thing with one of the overlays faded out. The overlays can still be coded if you use the fade functions in places other than the above but it is not quite as simple.
I created the attached demo file so you can play a table after switching the degrees rotation to 0 or 270 to see it work. It includes the fail safe coding that you may want to use (though be aware that if one of the displays is not faded out, you will have 2 overlays being displayed at the same time).
I included an Excel file in the download that you can use to calculate the size of an overlay based on the dimensions of your texture.
xBAM.Camera.AspectRatio < 1.0 ' screen is wide (the end user selected either 0 or 180 degrees rotation)
xBAM.Camera.AspectRatio > 1.0 ' screen is tall (the end user selected either 90 or 270 degrees rotation)
In conclusion, you can create 2 versions of the same overlay, one that displays correctly on a desktop (normally using 0 degrees rotation) and another that displays correctly on a pinball cabinet (which normally use 270 degrees rotation). You need to use the same image list for both overlays. Then, you can then use Rafal's code to select which overlay is displayed.
I have found that I can code both overlays identically and use a transparent texture to turn the display on and off without using the fade functions. Then I can add this code to the "BeginPlay" subroutine and the correct overlay will be displayed:
If xBAM.Camera.AspectRatio =< 1.0 then Overlay2.fadeout ' screen is wide
If xBAM.Camera.AspectRatio > 1.0 then Overlay1.fadeout ' screen is tall
This works by having both overlays display the same thing with one of the overlays faded out. The overlays can still be coded if you use the fade functions in places other than the above but it is not quite as simple.
I created the attached demo file so you can play a table after switching the degrees rotation to 0 or 270 to see it work. It includes the fail safe coding that you may want to use (though be aware that if one of the displays is not faded out, you will have 2 overlays being displayed at the same time).
I included an Excel file in the download that you can use to calculate the size of an overlay based on the dimensions of your texture.
Attachments
Last edited: