{"name":"safeZoneH","title":"safeZoneH","type":"command","url":"https://community.bistudio.com/wiki/safeZoneH","revid":369130,"updated":"2024-09-03T10:34:34Z","groups":["GUI Control - Positioning"],"status":"ok","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","description":"Returns the height of the screen in screen measurement units.\nTaken from top left corner of the default viewport (0,0) of the screen and going in the same direction as the Y axis, the value will be positive but resulting Y will end up beyond the bottom border.\nTherefore in order to calculate Y of the bottom screen border, the length of safeZoneY must be subtracted from safeZoneH, but because it is negative, it must be added instead.\n`_screenBottomBorderY = safeZoneH + safeZoneY`. The measurement units depend on the current screen resolution getResolution. See also SafeZone.","syntaxes":[{"syntax":"safeZoneH","params":[],"returns":{"type":"Number","type_expr":"Number","description":"height of the screen in screen measurement units"},"form":"nullary"}],"examples":[{"code":["_screenHeight = safeZoneH;"]},{"code":["_screenTopBorderY = safeZoneY;\n_screenBottomBorderY = safeZoneH + safeZoneY;"]},{"text":"Create control 50% wide, 30% tall, centered on screen:\n\n```sqf\nprivate _ctrl = findDisplay 46 createDisplay \"RscDisplayEmpty\" ctrlCreate [\"RscText\", -1];\n_ctrl ctrlSetBackgroundColor [1,0,0,0.5];\nprivate _ctrlWidth = 0.5 * safeZoneW; // 50% of screen width\nprivate _ctrlHeight = 0.3 * safeZoneH; // 30% of screen height\n_ctrl ctrlSetPositionW _ctrlWidth;\n_ctrl ctrlSetPositionH _ctrlHeight;\n_ctrl ctrlSetPositionX ((safeZoneW - _ctrlWidth) / 2 + safeZoneX); // center it horizontally\n_ctrl ctrlSetPositionY ((safeZoneH - _ctrlHeight) / 2 + safeZoneY); // center it vertically\n_ctrl ctrlCommit 0;\n```","code":["private _ctrl = findDisplay 46 createDisplay \"RscDisplayEmpty\" ctrlCreate [\"RscText\", -1];\n_ctrl ctrlSetBackgroundColor [1,0,0,0.5];\nprivate _ctrlWidth = 0.5 * safeZoneW; // 50% of screen width\nprivate _ctrlHeight = 0.3 * safeZoneH; // 30% of screen height\n_ctrl ctrlSetPositionW _ctrlWidth;\n_ctrl ctrlSetPositionH _ctrlHeight;\n_ctrl ctrlSetPositionX ((safeZoneW - _ctrlWidth) / 2 + safeZoneX); // center it horizontally\n_ctrl ctrlSetPositionY ((safeZoneH - _ctrlHeight) / 2 + safeZoneY); // center it vertically\n_ctrl ctrlCommit 0;"]}],"see_also":["SafeZone","safeZoneX","safeZoneY","safeZoneW","safeZoneXAbs","safeZoneWAbs"]}