From f0d1caada68a5877c60bda2cdb74ebb9a7284753 Mon Sep 17 00:00:00 2001 From: DartRuffian Date: Fri, 19 Jul 2024 00:37:19 -0500 Subject: [PATCH] Initial resizing of stats --- addons/arsenal/defines.hpp | 2 ++ addons/arsenal/functions/fnc_handleStats.sqf | 12 +++++++++++- addons/arsenal/ui/RscAttributes.hpp | 4 ++-- docs/wiki/framework/arsenal-framework.md | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/addons/arsenal/defines.hpp b/addons/arsenal/defines.hpp index cd6d937426..8f8321b0a3 100644 --- a/addons/arsenal/defines.hpp +++ b/addons/arsenal/defines.hpp @@ -151,6 +151,8 @@ #define IDC_statsBackground5 5118 #define IDC_statsBar5 5119 #define IDC_statsText5 5120 +#define IDC_statsStaticBackground1 5121 +#define IDC_statsStaticBackground2 5122 #define IDC_statsPreviousPage 52 #define IDC_statsNextPage 53 #define IDC_statsCurrentPage 54 diff --git a/addons/arsenal/functions/fnc_handleStats.sqf b/addons/arsenal/functions/fnc_handleStats.sqf index 0411ac759e..496d360db2 100644 --- a/addons/arsenal/functions/fnc_handleStats.sqf +++ b/addons/arsenal/functions/fnc_handleStats.sqf @@ -19,6 +19,7 @@ params ["_display", "_control", "_curSel", ["_itemCfg", configNull]]; private _statsBoxCtrl = _display displayCtrl IDC_statsBox; +private _statsStaticBackground = _display displayCtrl IDC_statsStaticBackground1; private _statsPreviousPageCtrl = _display displayCtrl IDC_statsPreviousPage; private _statsNextPageCtrl = _display displayCtrl IDC_statsNextPage; private _statsCurrentPageCtrl = _display displayCtrl IDC_statsCurrentPage; @@ -111,6 +112,7 @@ private _fnc_handleStats = { private _statsBarCtrl = controlNull; private _statsTextCtrl = controlNull; private _textStatementResult = ""; + private _height = 5; { _x params ["", "_configEntry", "_title", "_bools", "_statements"]; @@ -151,11 +153,18 @@ private _fnc_handleStats = { _statsTextCtrl ctrlSetText _textStatementResult; _statsTextCtrl ctrlSetTextColor ([[1, 1, 1, 1], [0, 0, 0, 1]] select (_showBar)); + _statsTextCtrl ctrlSetPositionH (ctrlTextHeight _statsTextCtrl); _statsTextCtrl ctrlSetFade 0; + + _height = _height + (ctrlTextHeight _statsTextCtrl); + systemChat format ["_showText: %1", _height]; } else { _statsTextCtrl ctrlSetFade 1; }; + _height = _height + 10; + systemChat format ["main loop: %1", _height]; + { _x ctrlCommit 0; } forEach [ @@ -169,13 +178,14 @@ private _fnc_handleStats = { // Resize the window (5 - _statsCount) call _fnc_hideUnused; - private _height = 10 * _statsCount + 5; _statsBoxCtrl ctrlSetPosition [ (0.5 - WIDTH_TOTAL / 2) + WIDTH_GAP, safezoneY + 1.8 * GRID_H, 47 * GRID_W, _height * GRID_H ]; + _statsStaticBackground ctrlSetPositionH (_height * GRID_H); + _statsStaticBackground ctrlCommit 0; _statsBoxCtrl ctrlCommit 0; // Move the actions box diff --git a/addons/arsenal/ui/RscAttributes.hpp b/addons/arsenal/ui/RscAttributes.hpp index 00de09f699..162a4f5b27 100644 --- a/addons/arsenal/ui/RscAttributes.hpp +++ b/addons/arsenal/ui/RscAttributes.hpp @@ -283,7 +283,7 @@ class GVAR(display) { h = QUOTE(55 * GRID_H); class controls { class statsStaticBackground1: ctrlStaticBackground { - idc = -1; + idc = IDC_statsStaticBackground1; x = QUOTE(0); y = QUOTE(0); w = QUOTE(47 * GRID_W); @@ -291,7 +291,7 @@ class GVAR(display) { colorBackground[] = {0.1,0.1,0.1,0.5}; }; class statsStaticBackground2: ctrlStaticBackground { - idc = -1; + idc = IDC_statsStaticBackground2; x = QUOTE(0); y = QUOTE(0); w = QUOTE(47 * GRID_W); diff --git a/docs/wiki/framework/arsenal-framework.md b/docs/wiki/framework/arsenal-framework.md index 954bbc0a7e..65f8f71cb8 100644 --- a/docs/wiki/framework/arsenal-framework.md +++ b/docs/wiki/framework/arsenal-framework.md @@ -214,7 +214,7 @@ class ace_arsenal_stats { showBar = 1; // 0 disabled; 1 enabled; showText = 1; // 0 disabled; 1 enabled; barStatement = "1"; // Statement evaluated to set the bar progress, needs to return a NUMBER. - textStatement = "test entry"; // statement evaluated to set the text entry, can return anything. + textStatement = "test entry"; // statement evaluated to set the text entry, can return anything. Arrays will have a linebreak added after each element. condition = "true"; // Condition for the stats to be displayed, default is true if not defined, needs to return a BOOL. tabs[] = { {0,1,2}, { } }; // Arrays of tabs, left array is left tabs, right array is right tabs. };