User Tools

Site Tools


en:tutorials:display:autosized_displays_and_objects

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:tutorials:display:autosized_displays_and_objects [2019/06/14 03:03 (2 months ago)] (current)
sausage created
Line 1: Line 1:
 +====== Autosized Displays and Objects ======
  
 +With the [[en:​tutorials:​display:​borderless_window_mode|Borderless Window support]] and Fullscreen support in Orx, it is possible in config to tell the Camera'​s Frustum to be the same size as the Display.
 +
 +To get Borderless Window mode working, you don't specify any ''​ScreenHeight''​ or ''​ScreenWidth''​.
 +
 +So how do you tell the frustum where to get the specified screen size? By using commands in your properties to get the current real screen dimensions. ​
 +
 +Here is an example:
 +
 +<code ini>
 +[Display]
 +Title           = Display Test
 +Decoration ​     = false
 +VSync           = true
 +
 +[MainCamera]
 +FrustumWidth ​   = % get Display ScreenWidth
 +FrustumHeight ​  = % get Display ScreenHeight
 +FrustumFar ​     = 2
 +FrustumNear ​    = 0
 +Position ​       = (0, 0, -1)
 +</​code>​
 +
 +See the magic? For the ''​FrustumWidth'',​ ''​% get Display ScreenWidth''​ is used to assign the current screenwidth.
 +
 +So any time the application opens onto a different screen resolution with Borderless Window mode, the camera'​s frustum will be set to whatever the current screen dimensions are.
 +
 +===== Objects =====
 +
 +Objects can use the same feature, but this time, we'll use a different command to set the Object'​s Size property. Imagine you wanted a large object to act as a background that needs to automatically size to the same dimensions as the screen:
 +
 +<code ini>
 +[SceneObject]
 +Size = % > texture.find screen, texture.getsize <
 +Alpha = 0.3
 +Graphic = @
 +Texture = pixel
 +Pivot = center
 +</​code>​
 +
 +The command here locates the screen'​s texture used for overall rendering, gets the vector, and assigns it to the ''​Size''​ property for the ''​SceneObject''​.
 +
 +And that's it. Two ways to dynamically get and use the current screen size for objects and camera frustums rather than having to specify an exact screen resolution.
en/tutorials/display/autosized_displays_and_objects.txt ยท Last modified: 2019/06/14 03:03 (2 months ago) by sausage