Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
McDiod committed May 7, 2017
1 parent 382b530 commit b6f28b8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# GRAD GPS Tracker
GPS Tracker dialog with a basic API.

![](http://i.imgur.com/aWKas0x.png) ![](http://i.imgur.com/Rn2xKBa.png)

## Dependencies
* [CBA_A3](https://github.com/CBATeam/CBA_A3)

Expand Down Expand Up @@ -30,15 +32,12 @@ class CfgFunctions {
};
```

## Pictures

![](http://i.imgur.com/aWKas0x.png) ![](http://i.imgur.com/Rn2xKBa.png)

## Usage

There are two functions to open the tracker. `grad_gpsTracker_fnc_openTitle` creates a `cutRsc` (this is the function that you want). `grad_gpsTracker_fnc_openDialog` creates and returns a dialog - I don't know why you would want this, but hey it's here. Their parameters are the same.
There are two functions to open the tracker. `grad_gpsTracker_fnc_openTitle` creates a `cutRsc` (this is the function that you want). `grad_gpsTracker_fnc_openDialog` creates and returns a dialog - I don't know why you would want this, but hey it's here. To close the title, use `grad_gpsTracker_fnc_closeTitle`. To close the dialog, use the escape button. Most of their parameters are the same.

`[target,update interval,size,offset X,offset Y,reception code] call grad_gpsTracker_fnc_openTitle`
`[target,update interval,size,offset X,offset Y,reception code,duration] call grad_gpsTracker_fnc_openTitle`

Parameter | Explanation
----------------|--------------------------------------------------------------------------------------------------------------------
Expand All @@ -48,6 +47,7 @@ size | number (optional) - Size factor for title. Default: 1
offset X | number (optional) - Horizontal offset factor for title. Default: 1
offset Y | number (optional) - Vertical offset factor for title. Default: 1
reception code | code (optional) - Code that returns the reception value. See below.
duration | number (optional) - ONLY `_fnc_openTitle`! Time in seconds after which tracker will automatically be closed. -1 to disable. Default: -1

Example:
`[_vehicle2,0.1,1,1.2,1,{_target getVariable ['signalStrength',0]}] call grad_gpsTracker_fnc_openTitle;`
Expand Down
2 changes: 1 addition & 1 deletion functions/fn_closeTitle.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include "..\component.hpp"

"grad_gpsTracker_layer" cutRsc ["RscTitleDisplayEmpty","PLAIN",0,false];
"grad_gpsTracker_layer" cutFadeout 0.5;
8 changes: 7 additions & 1 deletion functions/fn_createGPS.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ private _totalH = _size * SZH(40);

private _ctrlGroup = _display ctrlCreate ["RscControlsGroupNoScrollbars",-1];
_ctrlGroup ctrlSetPosition [_offsetX * SZW(120) - _totalW,_offsetY * SZH(80) - _totalH,_totalW,_totalH];
_ctrlGroup ctrlSetFade 1;
_ctrlGroup ctrlCommit 0;

[{ctrlCommitted _this}, {
_this ctrlSetFade 0;
_this ctrlCommit 0.5;
}, _ctrlGroup] call CBA_fnc_waitUntilAndExecute;

private _background = _display ctrlCreate ["RscPicture",-1,_ctrlGroup];
_background ctrlSetText (grad_gpsTracker_moduleRoot + "\data\tracker_bg.paa");
_background ctrlSetPosition [0,0,_totalW,_totalH];
Expand All @@ -24,4 +30,4 @@ _arrowCtrl ctrlSetText (grad_gpsTracker_moduleRoot + "\data\tracker_arrow.paa");
_arrowCtrl ctrlSetPosition [_size * SZW(14.5),_size * SZH(15),_size * SZW(11),_size * SZH(11)];
_arrowCtrl ctrlCommit 0;

[_arrowCtrl,_receptionCtrl]
[_ctrlGroup,_arrowCtrl,_receptionCtrl]
6 changes: 1 addition & 5 deletions functions/fn_openDialog.sqf
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#include "..\component.hpp"

diag_log "ASDASDASDASD";

params ["_target",["_updateInterval",0.5],["_size",1],["_offsetX",1],["_offsetY",1],["_receptionCode",{params ["_unit","_target","_updateInterval"]; private _reception = 1 - (_unit distance2D _target)/100; _reception}]];

if (!isNil "_target") then {[_target] call grad_gpsTracker_fnc_setTarget};

_display = (findDisplay 46) createDisplay "RscDisplayEmpty";

diag_log ["asd",_display];

_components = [_display,_size,_offsetX,_offsetY] call grad_gpsTracker_fnc_createGPS;
_components params ["_arrowCtrl","_receptionCtrl"];
_components params ["_ctrlGroup","_arrowCtrl","_receptionCtrl"];

[_updateInterval,_display,_arrowCtrl,_receptionCtrl,_receptionCode] call grad_gpsTracker_fnc_addPFH;

Expand Down
7 changes: 5 additions & 2 deletions functions/fn_openTitle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
"grad_gpsTracker_layer" cutRsc ["RscTitleDisplayEmpty","PLAIN",0,false];

[{!isNull (uiNamespace getVariable ["RscTitleDisplayEmpty",displayNull])}, {
params ["_target",["_updateInterval",0.5],["_size",1],["_offsetX",1],["_offsetY",1],["_receptionCode",{params ["_unit","_target","_updateInterval"]; private _reception = 1 - (_unit distance2D _target)/100; _reception}]];
params ["_target",["_updateInterval",0.5],["_size",1],["_offsetX",1],["_offsetY",1],["_receptionCode",{params ["_unit","_target","_updateInterval"]; private _reception = 1 - (_unit distance2D _target)/100; _reception}],["_duration",-1]];

if (!isNil "_target") then {[_target] call grad_gpsTracker_fnc_setTarget};

_display = uiNamespace getVariable ["RscTitleDisplayEmpty",displayNull];

_components = [_display,_size,_offsetX,_offsetY] call grad_gpsTracker_fnc_createGPS;
_components params ["_arrowCtrl","_receptionCtrl"];
_components params ["_ctrlGroup","_arrowCtrl","_receptionCtrl"];

[_updateInterval,_display,_arrowCtrl,_receptionCtrl,_receptionCode] call grad_gpsTracker_fnc_addPFH;

if (_duration > 0) then {
[grad_gpsTracker_fnc_closeTitle,[],_duration] call CBA_fnc_waitAndExecute;
};
}, _this] call CBA_fnc_waitUntilAndExecute;

0 comments on commit b6f28b8

Please sign in to comment.