Initial resizing of stats

This commit is contained in:
DartRuffian 2024-07-19 00:37:19 -05:00
parent 56b150dbfb
commit f0d1caada6
4 changed files with 16 additions and 4 deletions

View File

@ -151,6 +151,8 @@
#define IDC_statsBackground5 5118 #define IDC_statsBackground5 5118
#define IDC_statsBar5 5119 #define IDC_statsBar5 5119
#define IDC_statsText5 5120 #define IDC_statsText5 5120
#define IDC_statsStaticBackground1 5121
#define IDC_statsStaticBackground2 5122
#define IDC_statsPreviousPage 52 #define IDC_statsPreviousPage 52
#define IDC_statsNextPage 53 #define IDC_statsNextPage 53
#define IDC_statsCurrentPage 54 #define IDC_statsCurrentPage 54

View File

@ -19,6 +19,7 @@
params ["_display", "_control", "_curSel", ["_itemCfg", configNull]]; params ["_display", "_control", "_curSel", ["_itemCfg", configNull]];
private _statsBoxCtrl = _display displayCtrl IDC_statsBox; private _statsBoxCtrl = _display displayCtrl IDC_statsBox;
private _statsStaticBackground = _display displayCtrl IDC_statsStaticBackground1;
private _statsPreviousPageCtrl = _display displayCtrl IDC_statsPreviousPage; private _statsPreviousPageCtrl = _display displayCtrl IDC_statsPreviousPage;
private _statsNextPageCtrl = _display displayCtrl IDC_statsNextPage; private _statsNextPageCtrl = _display displayCtrl IDC_statsNextPage;
private _statsCurrentPageCtrl = _display displayCtrl IDC_statsCurrentPage; private _statsCurrentPageCtrl = _display displayCtrl IDC_statsCurrentPage;
@ -111,6 +112,7 @@ private _fnc_handleStats = {
private _statsBarCtrl = controlNull; private _statsBarCtrl = controlNull;
private _statsTextCtrl = controlNull; private _statsTextCtrl = controlNull;
private _textStatementResult = ""; private _textStatementResult = "";
private _height = 5;
{ {
_x params ["", "_configEntry", "_title", "_bools", "_statements"]; _x params ["", "_configEntry", "_title", "_bools", "_statements"];
@ -151,11 +153,18 @@ private _fnc_handleStats = {
_statsTextCtrl ctrlSetText _textStatementResult; _statsTextCtrl ctrlSetText _textStatementResult;
_statsTextCtrl ctrlSetTextColor ([[1, 1, 1, 1], [0, 0, 0, 1]] select (_showBar)); _statsTextCtrl ctrlSetTextColor ([[1, 1, 1, 1], [0, 0, 0, 1]] select (_showBar));
_statsTextCtrl ctrlSetPositionH (ctrlTextHeight _statsTextCtrl);
_statsTextCtrl ctrlSetFade 0; _statsTextCtrl ctrlSetFade 0;
_height = _height + (ctrlTextHeight _statsTextCtrl);
systemChat format ["_showText: %1", _height];
} else { } else {
_statsTextCtrl ctrlSetFade 1; _statsTextCtrl ctrlSetFade 1;
}; };
_height = _height + 10;
systemChat format ["main loop: %1", _height];
{ {
_x ctrlCommit 0; _x ctrlCommit 0;
} forEach [ } forEach [
@ -169,13 +178,14 @@ private _fnc_handleStats = {
// Resize the window // Resize the window
(5 - _statsCount) call _fnc_hideUnused; (5 - _statsCount) call _fnc_hideUnused;
private _height = 10 * _statsCount + 5;
_statsBoxCtrl ctrlSetPosition [ _statsBoxCtrl ctrlSetPosition [
(0.5 - WIDTH_TOTAL / 2) + WIDTH_GAP, (0.5 - WIDTH_TOTAL / 2) + WIDTH_GAP,
safezoneY + 1.8 * GRID_H, safezoneY + 1.8 * GRID_H,
47 * GRID_W, 47 * GRID_W,
_height * GRID_H _height * GRID_H
]; ];
_statsStaticBackground ctrlSetPositionH (_height * GRID_H);
_statsStaticBackground ctrlCommit 0;
_statsBoxCtrl ctrlCommit 0; _statsBoxCtrl ctrlCommit 0;
// Move the actions box // Move the actions box

View File

@ -283,7 +283,7 @@ class GVAR(display) {
h = QUOTE(55 * GRID_H); h = QUOTE(55 * GRID_H);
class controls { class controls {
class statsStaticBackground1: ctrlStaticBackground { class statsStaticBackground1: ctrlStaticBackground {
idc = -1; idc = IDC_statsStaticBackground1;
x = QUOTE(0); x = QUOTE(0);
y = QUOTE(0); y = QUOTE(0);
w = QUOTE(47 * GRID_W); w = QUOTE(47 * GRID_W);
@ -291,7 +291,7 @@ class GVAR(display) {
colorBackground[] = {0.1,0.1,0.1,0.5}; colorBackground[] = {0.1,0.1,0.1,0.5};
}; };
class statsStaticBackground2: ctrlStaticBackground { class statsStaticBackground2: ctrlStaticBackground {
idc = -1; idc = IDC_statsStaticBackground2;
x = QUOTE(0); x = QUOTE(0);
y = QUOTE(0); y = QUOTE(0);
w = QUOTE(47 * GRID_W); w = QUOTE(47 * GRID_W);

View File

@ -214,7 +214,7 @@ class ace_arsenal_stats {
showBar = 1; // 0 disabled; 1 enabled; showBar = 1; // 0 disabled; 1 enabled;
showText = 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. 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. 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. tabs[] = { {0,1,2}, { } }; // Arrays of tabs, left array is left tabs, right array is right tabs.
}; };