fn_ctrlMapCenter.sqf 622 B

1234567891011121314151617181920212223242526
  1. /*
  2. Name: cTab_fnc_ctrlMapCenter
  3. Author(s):
  4. Gundy
  5. Description:
  6. Determine map center position of given map control
  7. Parameters:
  8. 0: OBJECT - Map control to return map center coordinates for
  9. Returns:
  10. ARRAY - 2D world coordinates of map control center
  11. Example:
  12. [_ctrlScreen] call cTab_fnc_ctrlMapCenter;
  13. */
  14. private ["_ctrlScreen","_ctrlPos","_ctrlPosCenter"];
  15. _ctrlScreen = _this select 0;
  16. _ctrlPos = ctrlPosition _ctrlScreen;
  17. _ctrlPosCenter = [(_ctrlPos select 0) + ((_ctrlPos select 2) / 2),(_ctrlPos select 1) + ((_ctrlPos select 3) / 2)];
  18. _ctrlScreen ctrlMapScreenToWorld _ctrlPosCenter