|
if (isNil "whiteboard") then { |
|
whiteboard = "Land_MapBoard_F" createVehicle getPos player; |
|
}; |
|
[] spawn { |
|
_cam = "camera" camCreate (whiteboard modelToWorld [0, -1.4, 0.6]); |
|
|
|
_cam cameraEffect ["internal", "back"]; |
|
_cam camSetTarget (whiteboard modelToWorld [0, 0, 0.35]); |
|
showCinemaBorder false; |
|
_cam camCommit 1; |
|
|
|
sleep 0.1; |
|
|
|
// AGL |
|
leftUpperCorner = whiteboard modelToWorld [-0.705566,-0.144257,0.950002]; |
|
rightBottomCorner = whiteboard modelToWorld [0.733643,-0.329407,-0.0551631]; |
|
|
|
_topLeft = worldToScreen leftUpperCorner; |
|
_bottomRight = worldToScreen rightBottomCorner; |
|
|
|
(_bottomRight vectorAdd (_topLeft vectorMultiply -1)) params ["_w", "_h"]; |
|
|
|
_display = findDisplay 46 createDisplay "RscDisplayEmpty"; |
|
_ctrlDraw = _display ctrlCreate ["RscControlsGroupNoScrollbars", -1]; |
|
_ctrlDraw ctrlSetPosition (_topLeft + [_w, _h]); |
|
_ctrlDraw ctrlSetBackgroundColor [0,0,0,0.2]; |
|
_ctrlDraw ctrlCommit 0; |
|
|
|
with uiNamespace do { |
|
draw_xMin = _topLeft select 0; |
|
draw_xMax = _bottomRight select 0; |
|
draw_yMin = _topLeft select 1; |
|
draw_yMax = _bottomRight select 1; |
|
|
|
draw_ctrlLine = controlNull; |
|
draw_startPos = []; |
|
draw_endPos = []; |
|
draw_lines = []; |
|
draw_currentLine = []; |
|
|
|
draw_polyline = true; |
|
draw_polylineThreshold = 0.01; |
|
|
|
drawing = false; |
|
}; |
|
|
|
_ctrlDraw ctrlAddEventHandler ["MouseButtonDown", { |
|
params ["_ctrl", "_button", "_x", "_y", "_shift"]; |
|
if (_button != 0) exitWith {}; |
|
|
|
private _display = ctrlParent _ctrl; |
|
with uiNamespace do { |
|
draw_ctrlLine = _display ctrlCreate ["RscLine", -1]; |
|
draw_ctrlLine ctrlSetPosition [_x, _y, 0, 0]; |
|
draw_ctrlLine ctrlSetTextColor [1,0,0,1]; |
|
draw_ctrlLine ctrlCommit 0; |
|
|
|
draw_startPos = [_x, _y]; |
|
draw_endPos = draw_startPos; |
|
|
|
draw_polyline = !_shift; |
|
|
|
drawing = true; |
|
}; |
|
}]; |
|
_ctrlDraw ctrlAddEventHandler ["MouseButtonUp", { |
|
params ["", "_button"]; |
|
if (_button != 0) exitWith {}; |
|
with uiNamespace do { |
|
|
|
if ((draw_startPos vectorDistance draw_endPos) < 0.001) then { |
|
ctrlDelete draw_ctrlLine; |
|
} else { |
|
draw_lines pushBack [draw_polyline, draw_currentLine]; |
|
}; |
|
|
|
drawing = false; |
|
}; |
|
}]; |
|
_ctrlDraw ctrlAddEventHandler ["MouseMoving", { |
|
params ["_ctrl", "_x", "_y"]; |
|
private _display = ctrlParent _ctrl; |
|
with uiNamespace do { |
|
if (!drawing) exitWith {}; |
|
_x = draw_xMin max _x min draw_xMax; |
|
_y = draw_yMin max _y min draw_yMax; |
|
|
|
draw_endPos = [_x, _y]; |
|
|
|
(draw_endPos vectorAdd (draw_startPos vectorMultiply -1)) params ["_w", "_h"]; |
|
draw_ctrlLine ctrlSetPositionW _w; |
|
draw_ctrlLine ctrlSetPositionH _h; |
|
draw_ctrlLine ctrlCommit 0; |
|
|
|
if (draw_polyline) then { |
|
if ((draw_startPos vectorDistance draw_endPos) < draw_polylineThreshold) exitWith {}; |
|
|
|
draw_currentLine pushBack [draw_startPos, draw_endPos]; |
|
|
|
draw_ctrlLine = _display ctrlCreate ["RscLine", -1]; |
|
draw_ctrlLine ctrlSetPosition [_x, _y, 0, 0]; |
|
draw_ctrlLine ctrlSetTextColor [1,0,0,1]; |
|
draw_ctrlLine ctrlCommit 0; |
|
|
|
draw_startPos = draw_endPos; |
|
} else { |
|
draw_currentLine = [draw_startPos, draw_endPos]; |
|
}; |
|
}; |
|
}]; |
|
|
|
|
|
waitUntil {isNull _display}; |
|
_cam cameraEffect ["terminate","back"]; |
|
camDestroy _cam; |
|
}; |