|
| 1 | +# Screen Export |
| 2 | + |
| 3 | +DCS offers exporting and arranging in-game screens on multi-monitor setups. For |
| 4 | +example displaying the content of the DSCG screen on a second monitor. |
| 5 | + |
| 6 | + (_Setup with RWR |
| 7 | +exported to a small monitor_) |
| 8 | + |
| 9 | +This allows for making great setups, in particular when owning some smaller |
| 10 | +extra monitors; and is especially useful for SimPit builders. |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +DCS interface for this expects users to define what is called a **Viewport**. |
| 15 | +The F-4E currently supports this feature for the following screens: |
| 16 | + |
| 17 | +| Screen | Viewport Name | |
| 18 | +| ------------ | ------------------- | |
| 19 | +| DSCG (Pilot) | `F4E_Dscg_Pilot` | |
| 20 | +| DSCG (WSO) | `F4E_Dscg_Wso` | |
| 21 | +| HUD | `F4E_HeadUpDisplay` | |
| 22 | +| RWR | `F4E_Rwr` | |
| 23 | + |
| 24 | +> 💡 The DSCG screen of the cockpit the player is currently not sitting in will |
| 25 | +> not render any content. |
| 26 | +> |
| 27 | +> In order to work, the DSCG screens currently require also exporting the |
| 28 | +> viewport `F4E_Dscg_Tv`, a width and height of `1` pixel suffices though. |
| 29 | +
|
| 30 | +> 🚧 Support for other screens is in development: |
| 31 | +> |
| 32 | +> - `F4E_Cameras_AvtrTimeIndicatorPilot` |
| 33 | +> - `F4E_Cameras_AvtrTimeIndicatorWso` |
| 34 | +> - `F4E_EoTgtDesignatorSystem_BitDisplay` |
| 35 | +> - `F4E_EoTgtDesignatorSystem_RangeIndicator` |
| 36 | +> - `F4E_UhfRadio_FrequencyChannelIndicator` |
| 37 | +
|
| 38 | +Of special interest are also programs such as |
| 39 | +[Helios](https://github.com/HeliosVirtualCockpit/Helios/wiki) which simplify the |
| 40 | +entire process and lets users create even complex setups with ease. |
| 41 | + |
| 42 | +## Viewport |
| 43 | + |
| 44 | +In order to make use of the feature, players can define a special file in their |
| 45 | +Saved Games `MonitorSetup` folder for DCS, for example: |
| 46 | + |
| 47 | +> `C:\Users\John Doe\Saved Games\DCS\Config\MonitorSetup\` |
| 48 | +
|
| 49 | +Such a file would for example be called `MySetup.lua` and look similar to this: |
| 50 | + |
| 51 | +```lua |
| 52 | +_ = function(p) |
| 53 | + return p |
| 54 | +end |
| 55 | + |
| 56 | +name = _("MySetup") |
| 57 | +Description = "This is my setup" |
| 58 | + |
| 59 | +Viewports = { |
| 60 | + Center = { |
| 61 | + x = 0, |
| 62 | + y = 0, |
| 63 | + width = 3840, |
| 64 | + height = 2160, |
| 65 | + viewDx = 0, |
| 66 | + viewDy = 0, |
| 67 | + aspect = 3840 / 2160 |
| 68 | + } |
| 69 | +} |
| 70 | + |
| 71 | +GU_MAIN_VIEWPORT = { |
| 72 | + x = 0, |
| 73 | + y = 0, |
| 74 | + width = 3840, |
| 75 | + height = 2160 |
| 76 | +} |
| 77 | + |
| 78 | +UIMainView = { |
| 79 | + x = 0, |
| 80 | + y = 0, |
| 81 | + width = 3840, |
| 82 | + height = 2160 |
| 83 | +} |
| 84 | + |
| 85 | +function reconfigure_for_unit(unit_type) |
| 86 | + if unit_type == "F-14B" or unit_type == "F-14A-135-GR" or unit_type == "F-14A-135-GR-Early" then |
| 87 | + F14_VDI = { |
| 88 | + x = 1016, |
| 89 | + y = 1450, |
| 90 | + width = 525, |
| 91 | + height = 525 |
| 92 | + } |
| 93 | + |
| 94 | + F14_HSD = { |
| 95 | + x = 1016, |
| 96 | + y = 1985, |
| 97 | + width = 525, |
| 98 | + height = 525 |
| 99 | + } |
| 100 | + elseif unit_type == "M-2000C" then |
| 101 | + RIGHT_MFCD = { |
| 102 | + x = 879, |
| 103 | + y = 1580, |
| 104 | + width = 800, |
| 105 | + height = 800 |
| 106 | + } |
| 107 | + elseif unit_type == "F-4E-45MC" then |
| 108 | + F4E_Dscg_Pilot = { |
| 109 | + x = 3840, |
| 110 | + y = 2160 - 1527, |
| 111 | + width = 300, |
| 112 | + height = 300 |
| 113 | + } |
| 114 | + F4E_Dscg_Wso = { |
| 115 | + x = 3840 + 300, |
| 116 | + y = 2160 - 1527, |
| 117 | + width = 300, |
| 118 | + height = 300 |
| 119 | + } |
| 120 | + F4E_HeadUpDisplay = { |
| 121 | + x = 3840 + 300 + 300, |
| 122 | + y = 2160 - 1527, |
| 123 | + width = 300, |
| 124 | + height = 300 |
| 125 | + } |
| 126 | + F4E_Rwr = { |
| 127 | + x = 3840 + 300 + 300 + 300, |
| 128 | + y = 2160 - 1527, |
| 129 | + width = 300, |
| 130 | + height = 300 |
| 131 | + } |
| 132 | + |
| 133 | + F4E_Dscg_Tv = { |
| 134 | + x = 3840, |
| 135 | + y = 2160 - 1527 + 300, |
| 136 | + width = 1, |
| 137 | + height = 1 |
| 138 | + } |
| 139 | + else |
| 140 | + LEFT_MFCD = { |
| 141 | + x = 3840, |
| 142 | + y = 2160 - 1527, |
| 143 | + width = 700, |
| 144 | + height = 700 |
| 145 | + } |
| 146 | + |
| 147 | + RIGHT_MFCD = { |
| 148 | + x = 3840 + 700, |
| 149 | + y = 2160 - 1527, |
| 150 | + width = 700, |
| 151 | + height = 700 |
| 152 | + } |
| 153 | + end |
| 154 | +end |
| 155 | +``` |
| 156 | + |
| 157 | +Once created, this setup will now appear within DCS for selection in the |
| 158 | +graphics settings: |
| 159 | + |
| 160 | + |
| 161 | + |
| 162 | +The way the setup works is that you first sum up the resolution of all monitors |
| 163 | +that you want to use combined. This will be the target resolution to render DCS |
| 164 | +at. The example uses two monitors, one at a `3840x2160` resolution and the other |
| 165 | +at `2715x1527`, combined that makes a virtual monitor resolution of `6555x2160`. |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | +The exact arrangement is defined in the Windows Display Settings: |
| 170 | + |
| 171 | + |
| 172 | + |
| 173 | +In the setup-file, one has to now define several viewports for DCS. This tells |
| 174 | +the game where on the virtual monitor to render which scene. The format looks as |
| 175 | +follows: |
| 176 | + |
| 177 | +```lua |
| 178 | +NAME_OF_THE_VIEWPORT = { |
| 179 | + x = ..., -- x-coordinate of top left corner, in pixels |
| 180 | + y = ..., -- y-coordinate of top left corner, in pixels |
| 181 | + width = ..., -- width to use for the scene, in pixels |
| 182 | + height = ... -- height to use for the scene, in pixels |
| 183 | +} |
| 184 | +``` |
| 185 | + |
| 186 | +The main scenery of DCS is defined and placed on the virtual monitor through the |
| 187 | +following viewports: |
| 188 | + |
| 189 | +```lua |
| 190 | +Viewports = { |
| 191 | + Center = { |
| 192 | + x = 0, |
| 193 | + y = 0, |
| 194 | + width = 3840, |
| 195 | + height = 2160, |
| 196 | + viewDx = 0, |
| 197 | + viewDy = 0, |
| 198 | + aspect = 3840 / 2160 |
| 199 | + } |
| 200 | +} |
| 201 | + |
| 202 | +GU_MAIN_VIEWPORT = { |
| 203 | + x = 0, |
| 204 | + y = 0, |
| 205 | + width = 3840, |
| 206 | + height = 2160 |
| 207 | +} |
| 208 | + |
| 209 | +UIMainView = { |
| 210 | + x = 0, |
| 211 | + y = 0, |
| 212 | + width = 3840, |
| 213 | + height = 2160 |
| 214 | +} |
| 215 | +``` |
| 216 | + |
| 217 | +In the example setup this will render the main scenery of the game on the |
| 218 | +`3840x2160` monitor arranged on the left. |
| 219 | + |
| 220 | +The following section in the file lets you define custom viewports per aircraft |
| 221 | +type: |
| 222 | + |
| 223 | +```lua |
| 224 | +function reconfigure_for_unit(unit_type) |
| 225 | + if unit_type == "F-14B" or unit_type == "F-14A-135-GR" or unit_type == "F-14A-135-GR-Early" then |
| 226 | + ... |
| 227 | + elseif unit_type == "M-2000C" then |
| 228 | + ... |
| 229 | + elseif unit_type == "F-4E-45MC" then |
| 230 | + ... |
| 231 | + else |
| 232 | + ... -- any other aircraft |
| 233 | + end |
| 234 | +end |
| 235 | +``` |
| 236 | + |
| 237 | +Within this construct one can now declare custom viewports, for example |
| 238 | + |
| 239 | +```lua |
| 240 | +F4E_Dscg_Pilot = { |
| 241 | + x = 3840, |
| 242 | + y = 2160 - 1527, |
| 243 | + width = 300, |
| 244 | + height = 300 |
| 245 | +} |
| 246 | +``` |
| 247 | + |
| 248 | +will place the DSCG screen on the second monitor as follows: |
| 249 | + |
| 250 | + |
| 251 | + |
| 252 | +## Modding |
| 253 | + |
| 254 | +Viewports, once defined by users in their monitor setups, are then picked up by |
| 255 | +the modules code in the respective _Indicator-lua-files_, which can be found for |
| 256 | +example in: |
| 257 | + |
| 258 | +> `C:\Programs\DCS\Mods\aircraft\F-4E\Cockpit\Scripts` |
| 259 | +
|
| 260 | +As an example, the HUD declares at the end of |
| 261 | +`Scripts\HeadUpDisplay\Indicator\init.lua` the following two lines |
| 262 | + |
| 263 | +```lua |
| 264 | +dofile(LockOn_Options.common_script_path .. "ViewportHandling.lua") |
| 265 | +try_find_assigned_viewport("F4E_HeadUpDisplay") |
| 266 | +``` |
| 267 | + |
| 268 | +which will try to see if the user created a viewport called `F4E_HeadUpDisplay` |
| 269 | +and if so, render the scene there. |
| 270 | + |
| 271 | +Modders can follow this approach to easily create new viewports in modules that |
| 272 | +do not officially support them yet. |
0 commit comments