Handle focus

This commit is contained in:
SilentSpike 2015-07-19 20:26:26 +01:00
parent e406a794f2
commit e95186f550
3 changed files with 11 additions and 5 deletions

View File

@ -17,7 +17,7 @@ PREP(updateInterface);
PREP(updateUnits); PREP(updateUnits);
// Permanent variables // Permanent variables
GVAR(camFocus) = -1; GVAR(camFocus) = 0;
GVAR(camMode) = 0; GVAR(camMode) = 0;
GVAR(camPan) = 0; GVAR(camPan) = 0;
GVAR(camPos) = [worldSize * 0.5,worldSize * 0.5,0]; GVAR(camPos) = [worldSize * 0.5,worldSize * 0.5,0];

View File

@ -142,7 +142,7 @@ switch (toLower _mode) do {
// Scroll to change zoom, modifier for focus // Scroll to change zoom, modifier for focus
if (GVAR(ctrlKey)) then { if (GVAR(ctrlKey)) then {
//GVAR(camFocus) set [0,(GVAR(camFocus) select 0) - (_zChange * (GVAR(camFocus) select 0) * 0.2)] GVAR(camFocus) = (GVAR(camFocus) + _zChange) max 0;
} else { } else {
GVAR(camZoom) = ((GVAR(camZoom) + (_zChange * 0.1)) max 0.01) min 2; GVAR(camZoom) = ((GVAR(camZoom) + (_zChange * 0.1)) max 0.01) min 2;
}; };

View File

@ -22,7 +22,11 @@ params ["_display"];
// Kill PFH when display is closed // Kill PFH when display is closed
if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; };
GVAR(camera) camSetFocus [GVAR(camFocus),1.5]; if (GVAR(camFocus) == 0) then {
GVAR(camera) camSetFocus [-1,-1];
} else {
GVAR(camera) camSetFocus [GVAR(camFocus),1];
};
GVAR(camera) camSetFov -(linearConversion [0.1,2,GVAR(camZoom),-2,-0.1,true]); GVAR(camera) camSetFov -(linearConversion [0.1,2,GVAR(camZoom),-2,-0.1,true]);
GVAR(camera) camCommit 0; GVAR(camera) camCommit 0;
@ -33,15 +37,17 @@ private ["_name","_focus","_fov","_speed","_mode","_time","_toolbar"];
// Find all tool values // Find all tool values
if (GVAR(camMode) == 0) then { if (GVAR(camMode) == 0) then {
_focus = ["AUTO FOCUS", format ["%1 m", round GVAR(camFocus)]] select (GVAR(camFocus) > 0);
_fov = format ["%1x", floor(GVAR(camZoom) * 100) * 0.01];
_name = "None"; _name = "None";
_speed = format ["%1 m/s", GVAR(camSpeed)]; _speed = format ["%1 m/s", GVAR(camSpeed)];
} else { } else {
_focus = rank GVAR(camUnit);
_fov = WFSideText GVAR(camUnit);
_name = name GVAR(camUnit); _name = name GVAR(camUnit);
_speed = format ["%1 km/h", floor(speed GVAR(camUnit))]; _speed = format ["%1 km/h", floor(speed GVAR(camUnit))];
}; };
_focus = format ["%1 m", GVAR(camFocus)];
_fov = format ["%1x", floor(GVAR(camZoom) * 100) * 0.01];
_mode = ["FREE","FIRST","THIRD"] select GVAR(camMode); _mode = ["FREE","FIRST","THIRD"] select GVAR(camMode);
_time = [daytime,"HH:MM"] call BIS_fnc_timeToString; _time = [daytime,"HH:MM"] call BIS_fnc_timeToString;