{"name":"SafeZone","title":"SafeZone","type":"topic","url":"https://community.bistudio.com/wiki/SafeZone","revid":353567,"updated":"2024-03-19T12:01:44Z","aliases":[],"markdown":"In Arma: Cold War Assault, user interface Displays were drawn always in 4:3 aspect ratio. Since then, many other aspect ratios became common and interface has to be compatible with them. Currently, interface is base on following variables:\n\n- **Aspect Ratio** - change screen width to fit user's monitor\n- **Interface Size** - resize size of interface Controls, like menus, hints, cursors, etc. Introduced in Arma 2.\n\n### Coordinate Systems\n\nGames now contains following two coordinate systems, both of them starting in their top left corner and going bottom right (see picture on right).\n\n- **Absolute** *(red frame)* - based on CWA system. Its always 4:3 and changes together with Interface Size.\n  - As absolute area is always centered, [0.5,0.5] is always center a of screen.\n- **Safezone** *(black frame)* - actual monitor size. Uses following commands:\n  - safeZoneX, safeZoneY, safeZoneW and safeZoneH, with additional safeZoneXAbs and safeZoneWAbs to work with multi-screen size.\n  - In case game is running only on one monitor, safeZoneXAbs equals to safezoneX and safezoneWAbs is same as safezoneW.\n  - Safezones serves only as references to absolute positions. Result of safezoneX can for example be -0.452381, which means it is left from absolute area.\n\n### Sample configs\n\nControl with following size will cover whole screen (middle screen in case of TripleHead):\n\n```cpp\nx = safeZoneX;\ny = safeZoneY;\nw = safeZoneW;\nh = safeZoneH;\n```\n\nFollowing proportions will cover all screens in TripleHead:\n\n```cpp\nx = safeZoneXAbs;\ny = safeZoneY;\nw = safeZoneWAbs;\nh = safeZoneH;\n```\n\nCreates centered control with 80% width and height:\n\n```cpp\nx = safeZoneX + 0.1 * safeZoneW;\ny = safeZoneY + 0.1 * safeZoneH;\nw = safeZoneW * 0.8;\nh = safeZoneH * 0.8;\n```\n\nCreates control with absolute width and height, moved 10% from top left screen corner:\n\n```cpp\nx = safeZoneX + 0.1 * safeZoneW;\ny = safeZoneY + 0.1 * safeZoneH;\nw = 0.2;\nh = 0.3;\n```\n\nCreates the same as above, but aligned to bottom right corner:\n\n```cpp\nx = safeZoneX + safeZoneW - 0.2;\ny = safeZoneY + safeZoneH - 0.3;\nw = 0.2;\nh = 0.3;\n```\n\nCreates a control that spans the horizontal and is centered on the vertical according to the control's aspect ratio (useful for fullscreen images that shouldn't be stretched but letterboxed). **2** is the aspect ratio:\n\n```\nx = safeZoneX;\ny = safeZoneY + ((safeZoneH - (safeZoneW / 2 * (4/3))) / 2);\nw = safeZoneW;\nh = safeZoneH / 2 * (4/3);\n```\n\n### User Interface Editor\n\nUser Interface Editor helps with display creation, enabling designer to place controls in simple WYSIWYG editor and export it afterwards to config format.\n\n### Image gallery\n\n#### Aspect Ratio and Interface Size combinations\n\n#### Video Options","sections":[{"heading":null,"level":1,"markdown":"In Arma: Cold War Assault, user interface Displays were drawn always in 4:3 aspect ratio. Since then, many other aspect ratios became common and interface has to be compatible with them. Currently, interface is base on following variables:\n\n- **Aspect Ratio** - change screen width to fit user's monitor\n- **Interface Size** - resize size of interface Controls, like menus, hints, cursors, etc. Introduced in Arma 2."},{"heading":"Coordinate Systems","level":3,"markdown":"Games now contains following two coordinate systems, both of them starting in their top left corner and going bottom right (see picture on right).\n\n- **Absolute** *(red frame)* - based on CWA system. Its always 4:3 and changes together with Interface Size.\n  - As absolute area is always centered, [0.5,0.5] is always center a of screen.\n- **Safezone** *(black frame)* - actual monitor size. Uses following commands:\n  - safeZoneX, safeZoneY, safeZoneW and safeZoneH, with additional safeZoneXAbs and safeZoneWAbs to work with multi-screen size.\n  - In case game is running only on one monitor, safeZoneXAbs equals to safezoneX and safezoneWAbs is same as safezoneW.\n  - Safezones serves only as references to absolute positions. Result of safezoneX can for example be -0.452381, which means it is left from absolute area."},{"heading":"Sample configs","level":3,"markdown":"Control with following size will cover whole screen (middle screen in case of TripleHead):\n\n```cpp\nx = safeZoneX;\ny = safeZoneY;\nw = safeZoneW;\nh = safeZoneH;\n```\n\nFollowing proportions will cover all screens in TripleHead:\n\n```cpp\nx = safeZoneXAbs;\ny = safeZoneY;\nw = safeZoneWAbs;\nh = safeZoneH;\n```\n\nCreates centered control with 80% width and height:\n\n```cpp\nx = safeZoneX + 0.1 * safeZoneW;\ny = safeZoneY + 0.1 * safeZoneH;\nw = safeZoneW * 0.8;\nh = safeZoneH * 0.8;\n```\n\nCreates control with absolute width and height, moved 10% from top left screen corner:\n\n```cpp\nx = safeZoneX + 0.1 * safeZoneW;\ny = safeZoneY + 0.1 * safeZoneH;\nw = 0.2;\nh = 0.3;\n```\n\nCreates the same as above, but aligned to bottom right corner:\n\n```cpp\nx = safeZoneX + safeZoneW - 0.2;\ny = safeZoneY + safeZoneH - 0.3;\nw = 0.2;\nh = 0.3;\n```\n\nCreates a control that spans the horizontal and is centered on the vertical according to the control's aspect ratio (useful for fullscreen images that shouldn't be stretched but letterboxed). **2** is the aspect ratio:\n\n```\nx = safeZoneX;\ny = safeZoneY + ((safeZoneH - (safeZoneW / 2 * (4/3))) / 2);\nw = safeZoneW;\nh = safeZoneH / 2 * (4/3);\n```"},{"heading":"User Interface Editor","level":3,"markdown":"User Interface Editor helps with display creation, enabling designer to place controls in simple WYSIWYG editor and export it afterwards to config format."},{"heading":"Image gallery","level":3,"markdown":""},{"heading":"Aspect Ratio and Interface Size combinations","level":4,"markdown":""},{"heading":"Video Options","level":4,"markdown":""}],"categories":["GUI Topics"],"groups":["GUI"]}