This commit is contained in:
Raymix 2016-06-29 23:32:57 +01:00
parent e04f4d2e69
commit a21ca947f2
11 changed files with 1573 additions and 1163 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
/*
Author: Raimonds Virtoss - EpochMod.com
Contributors:
Description:
Creates special dialog that allows players to reposition (move) all HUD groups on the screen and save to profile
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/dynamicHUD/Epoch_dynamicHUD_adjust.sqf
*/
_this spawn {
disableSerialization;
(findDisplay 49) closeDisplay 0;
waitUntil {isNull (findDisplay 49)};
if (_this) then {
findDisplay 46 createDisplay "rmx_moveDynamicHUD";
_dsp = findDisplay 66666;
rmx_var_dynamicHUD_groupsAdjust = [];
rmx_var_drag_MouseDown = false;
{
_c = _dsp ctrlCreate ["rmx_drag_RscActivePicture", call epoch_getIDC];
_c ctrlSetText "#(rgb,8,8,3)color(1,1,1,1)";
_c ctrlSetPosition (ctrlPosition _x);
_c ctrlCommit 0;
rmx_var_dynamicHUD_groupsAdjust set [_forEachIndex, _c];
} forEach rmx_var_dynamicHUD_groups;
waitUntil {!isNull (findDisplay 66666)};
while {!isNull (findDisplay 66666)} do {
if !(rmx_var_drag_MouseDown) then {
{
_c = (rmx_var_dynamicHUD_groups select _forEachIndex);
_c ctrlSetPosition (ctrlPosition _x);
_c ctrlCommit 0;
} forEach rmx_var_dynamicHUD_groupsAdjust;
};
uiSleep 0.1;
};
} else {
//reset hud positions
};
};
true

View File

@ -0,0 +1,13 @@
/*
Author: Raimonds Virtoss - EpochMod.com
Contributors:
Description:
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/dynamicHUD/Epoch_loadSave.sqf
*/

View File

@ -0,0 +1,126 @@
/*
Author: Raimonds Virtoss - EpochMod.com
Contributors:
Description:
Creates special HUD Groups defined in CfgDynamicHUD.hpp at the start of the game.
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/dynamicHUD/Epoch_dynamicHUD_start.sqf
*/
#include "\A3\ui_f\hpp\defineCommonGrids.inc"
_cfg = "rmx_dynamicHUD" call EPOCH_returnConfig;
_configs = "true" configClasses _cfg;
setMousePosition [0.5,0.5];
disableSerialization;
_dsp = findDisplay 46;
rmx_var_dynamicHUD_groups = [];
rmx_var_dynamicHUD_groupCTRL = [];
{
_group = _dsp ctrlCreate ["rscControlsGroup", call Epoch_getIDC];
rmx_var_dynamicHUD_groups set [_forEachIndex, _group];
_defaultPopulate = getNumber (_x >> "defaultPopulate");
_defaultPos = getNumber (_x >> "defaultPos");
_arraySize = getNumber (_x >> "arraySize");
_classname = getText (_x >> "classname");
_offsetX = getNumber (_x >> "offSetX");
_offsetY = getNumber (_x >> "offSetY");
_height = getNumber (_x >> "height");
_width = getNumber (_x >> "width");
_wCtrl = _width * GUI_GRID_W;
_hCtrl = _height * GUI_GRID_H;
_oX = _offsetX * _wCtrl;
_oY = _offsetY * _hCtrl;
_w = 0; _h = 0;
if (_defaultPopulate in [0,1,4]) then {
_w = _arraySize * _width * GUI_GRID_W;
_h = _height * GUI_GRID_H;
} else {
_w = _width * GUI_GRID_W;
_h = _arraySize * _height * GUI_GRID_H;
};
_groupPos = switch _defaultPos do {
case 0: {[SafezoneX, safezoneY, _w, _h]};
case 1: {[0.5 - _w/2, safezoneY, _w, _h]};
case 2: {[(safezoneW + safezoneX) - _w, safezoneY, _w, _h]};
case 3: {[SafezoneX, 0.5 - _h/2, _w, _h]};
case 4: {[0.5 - _w/2, 0.5 - _h/2, _w, _h]};
case 5: {[(safezoneW + safezoneX) - _w, 0.5 - _h/2, _w, _h]};
case 6: {[SafezoneX, (safezoneH + safezoneY) - _h, _w, _h]};
case 7: {[0.5 - _w/2, (safezoneH + safezoneY) - _h, _w, _h]};
case 8: {[(safezoneW + safezoneX) - _w, (safezoneH + safezoneY) - _h, _w, _h]};
default {[0,0,0,0]};
};
_groupPos set [0, (_groupPos select 0)+_oX];
_groupPos set [1, (_groupPos select 1)+_oY];
_group ctrlSetPosition _groupPos;
_group ctrlCommit 0;
_evenOdd = true;
rmx_var_dynamicHUD_groupCTRL set [_forEachIndex, [(configName _x)]];
for "_i" from 0 to (_arraySize - 1) do {
_c = _dsp ctrlCreate [_classname, call Epoch_getIDC, _group];
(rmx_var_dynamicHUD_groupCTRL select _forEachIndex) pushBack _c;
_cPos = switch _defaultPopulate do {
case 0: {[_i * _wCtrl,0,_wCtrl, _hCtrl]};
case 1: {[(_arraySize - 1 - _i) * _wCtrl,0,_wCtrl, _hCtrl]};
case 2: {[0,_i * _hCtrl,_wCtrl, _hCtrl]};
case 3: {[0,(_arraySize - 1 - _i) * _hCtrl,_wCtrl, _hCtrl]};
case 4:
{
_center = _w/2 - _wCtrl/2;
_result = if (_i == 0) then {
[_center, 0, _wCtrl, _hCtrl]
} else {
if _evenOdd then {
[_wCtrl * _i/2 + _center, 0, _wCtrl, _hCtrl]
} else {
[(_center - _wCtrl/2) - (_wCtrl * _i/2), 0, _wCtrl, _hCtrl]
};
};
_evenOdd = !_evenOdd;
_result
};
case 5:
{
_center = _h/2 - _hCtrl/2;
_result = if (_i == 0) then {
[0, _center, _wCtrl, _hCtrl]
} else {
if _evenOdd then {
[0, _hCtrl * _i/2 + _center, _wCtrl, _hCtrl]
} else {
[0, (_center - _hCtrl/2) - (_hCtrl * _i/2), _wCtrl, _hCtrl]
};
};
_evenOdd = !_evenOdd;
_result
};
default {[0,0,0,0]};
};
_c ctrlSetPosition _cPos;
_c ctrlCommit 0;
};
} forEach _configs;
//dump default positions into an array
true

View File

@ -0,0 +1,32 @@
/*
Author: Raimonds Virtoss - EpochMod.com
Contributors:
Description:
Returns Control from Dynamic HUD to be manipulated externally. See CfgDynamicHUD.hpp on how to create your own HUD groups.
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/dynamicHUD/Epoch_getHUDCtrl.sqf
Usage:
[_configName, _index] call epoch_getHUDCtrl;
["myHudName", 2] call epoch_getHUDCtrl;
*/
if !(_this isEqualTypeArray ["",0]) exitWith {controlNull};
params ["_gName","_cIdx"];
_gIdx = -1;
{
if ((_x select 0) isEqualTo _gName) exitWith {_gIdx = _forEachIndex};
} forEach rmx_var_dynamicHUD_groupCTRL;
if (_gIdx == -1) exitWith {controlNull};
(rmx_var_dynamicHUD_groupCTRL select _gIdx) select _cIdx

View File

@ -0,0 +1,26 @@
/*
Author: Raimonds Virtoss - EpochMod.com
Contributors:
Description:
Gives ability to move active controls like RscActivePicture (see Epoch_GUI_rmx.hpp for an example).
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/Epoch_dragControl.sqf
Usage:
No direct usage, simply create your control in configs following example in HPP mentioned in description
*/
private ["_ctrl","_curr","_mpos"];
_ctrl = param [0];
_curr = ctrlPosition _Ctrl;
_mpos = getmousePosition;
if (rmx_var_drag_MouseDown) then {
_ctrl ctrlSetPosition [(_mpos select 0) - (_curr select 2) / 2, (_mpos select 1) - (_curr select 3) / 2 ];
_ctrl ctrlCommit 0;
};

View File

@ -55,6 +55,7 @@ EPOCH_arr_interactedObjs = [];
EPOCH_buildOption = 0;
EPOCH_nearestLocations = [];
EPOCH_lastFiredLocation = [];
rmx_var_drag_MouseDown = false;
["EPOCH_onEachFrame", "onEachFrame", EPOCH_onEachFrame] call BIS_fnc_addStackedEventHandler;

View File

@ -178,6 +178,7 @@ class CfgClientFunctions
class secureStorageHandler {};
class genderSelection {};
class getColorScheme {};
class dragControl {};
};
class config {
@ -191,7 +192,15 @@ class CfgClientFunctions
class dynamicMenuPopulate {};
class dynamicMenuCleanup {};
};
class dynamicHUD {
file = "epoch_code\gui\scripts\dynamicHUD";
class dynamicHUD_adjust {};
class dynamicHUD_loadSave {};
class dynamicHUD_start {};
class getHUDCtrl {};
};
class gui_craft {
file = "epoch_code\gui\scripts\craftingv2";
class crafting_animate {};

View File

@ -0,0 +1,60 @@
/*
defaultPos:
0 - top left
1 - top center
2 - top right
3 - mid left
4 - mid center
5 - mid right
6 - bottom left
7 - bottom center
8 - bottom right
defaultPopulate:
0 - right
1 - left
2 - down
3 - up
4 - horizontal grow
5 - vertical grow
offSetX: Positive = right, Negative = left
offSetY: Positive = down, Negative = up
Offsets group of controls, unit measurement is width or height of group. The bigger the group the more it will be offset.
Offsets are optional, don't have to be included
classname:
https://community.bistudio.com/wiki/ctrlCreate/classnames
Obtaining Controls:
use epoch_getHUDCtrl function to obtain controls for manipulation
_name = Config name of your group
_index = each group hosts multiple elements, each element has it's index, starting from 0
[_ConfigName, _index] call epoch_getHUDCtrl;
["myHUDname", 3] call epoch_getHUDCtrl;
*/
class rmx_dynamicHUD
{
class topRight //ConfigName matters to be able to use function!
{
classname = "RscPicture";
defaultPos = 2;
defaultPopulate = 1;
arraySize = 8;
width = 4;
height = 4;
offSetX = 0;
offSetY = 0;
};
class botcenter
{
classname = "RscPicture";
defaultPos = 7;
defaultPopulate = 4;
arraySize = 9;
width = 5;
height = 5;
};
};

View File

@ -23,6 +23,13 @@ class CfgEpochConfiguration
icon = "\x\addons\a3_epoch_code\Data\owner.paa";
controlGroup = "EpochConfigKeyMap";
};
class HUD
{
name = "Customize HUD (WIP)";
color[] = {1,1,1,1};
icon = "\x\addons\a3_epoch_code\Data\owner.paa";
controlGroup = "Epoch_main_config_dynamicHUD";
};
class html
{
name = "Changelog";

View File

@ -57,6 +57,7 @@ disableRandomization[] = {"All"};
#include "Configs\CfgMissionsTasks.hpp"
#include "Configs\cfgCrafting.hpp"
#include "Configs\cfgPricing.hpp"
#include "Configs\CfgDynamicHUD.hpp"
#include "Configs\CfgEpochClient.hpp"