diff --git a/addons/spectator/UI/interface.hpp b/addons/spectator/UI/interface.hpp index 5c0e3a0041..30171c7b04 100644 --- a/addons/spectator/UI/interface.hpp +++ b/addons/spectator/UI/interface.hpp @@ -79,61 +79,70 @@ class GVAR(interface) { }; }; }; - class nameTool: RscText { - idc = IDC_TOOL_NAME; + class toolbar: RscControlsGroupNoScrollbars { + idc = IDC_TOOL; x = safeZoneX; y = safeZoneY; - w = TOOL_W * 2; + w = safeZoneW; h = TOOL_H; - shadow = 2; - colorText[]={COL_FORE}; - colorBackground[] = {COL_BACK}; - sizeEx = H_PART(1); - }; - class nameFrame: nameTool { - idc = -1; - style = 64; - }; - class viewTool: nameTool { - idc = IDC_TOOL_VIEW; - x = safeZoneX + TOOL_W * 2 + MARGIN; - w = TOOL_W; - }; - class viewFrame: viewTool { - idc = -1; - style = 64; - }; - class clockTool: viewTool { - idc = IDC_TOOL_CLOCK; - x = safeZoneX + TOOL_W * 3 + MARGIN * 2; - }; - class clockFrame: clockTool { - idc = -1; - style = 64; - }; - class focusTool: viewTool { - idc = IDC_TOOL_FOCUS; - x = safeZoneX + safeZoneW - TOOL_W * 3 - MARGIN * 2; - }; - class focusFrame: focusTool { - idc = -1; - style = 64; - }; - class fovTool: viewTool { - idc = IDC_TOOL_FOV; - x = safeZoneX + safeZoneW - TOOL_W * 2 - MARGIN; - }; - class fovFrame: fovTool { - idc = -1; - style = 64; - }; - class speedTool: viewTool { - idc = IDC_TOOL_SPEED; - x = safeZoneX + safeZoneW - TOOL_W; - }; - class speedFrame: speedTool { - idc = -1; - style = 64; + class controls { + class nameTool: RscText { + idc = IDC_TOOL_NAME; + x = 0; + y = 0; + w = TOOL_W * 2; + h = TOOL_H; + shadow = 2; + colorText[]={COL_FORE}; + colorBackground[] = {COL_BACK}; + sizeEx = H_PART(1); + }; + class nameFrame: nameTool { + idc = -1; + style = 64; + }; + class viewTool: nameTool { + idc = IDC_TOOL_VIEW; + x = TOOL_W * 2 + MARGIN; + w = TOOL_W; + }; + class viewFrame: viewTool { + idc = -1; + style = 64; + }; + class clockTool: viewTool { + idc = IDC_TOOL_CLOCK; + x = TOOL_W * 3 + MARGIN * 2; + }; + class clockFrame: clockTool { + idc = -1; + style = 64; + }; + class focusTool: viewTool { + idc = IDC_TOOL_FOCUS; + x = safeZoneW - TOOL_W * 3 - MARGIN * 2; + }; + class focusFrame: focusTool { + idc = -1; + style = 64; + }; + class fovTool: viewTool { + idc = IDC_TOOL_FOV; + x = safeZoneW - TOOL_W * 2 - MARGIN; + }; + class fovFrame: fovTool { + idc = -1; + style = 64; + }; + class speedTool: viewTool { + idc = IDC_TOOL_SPEED; + x = safeZoneW - TOOL_W; + }; + class speedFrame: speedTool { + idc = -1; + style = 64; + }; + }; }; class unitTools: RscControlsGroupNoScrollbars { idc = IDC_UNIT; @@ -153,9 +162,9 @@ class GVAR(interface) { colorBorder[] = {COL_FORE}; colorBackground[] = {COL_BACK}; colorSelect[] = { - "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", - "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", - "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", + "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])", + "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])", + "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])", 1 }; multiselectEnabled = 0; @@ -167,19 +176,20 @@ class GVAR(interface) { w = TOOL_W * 2; h = TOOL_H; sizeEx = TOOL_H; + colorBackground[] = {COL_FORE_D}; text = CSTRING(RefreshList); action = QUOTE([] call FUNC(updateUnits)); }; }; }; - class spectatorMap: RscMapControl { + class mapOverlay: RscMapControl { idc = IDC_MAP; x = safeZoneX; - y = safeZoneY + TOOL_H; + y = safeZoneY; w = safeZoneW; h = safeZoneH; }; - class helpBox: RscControlsGroupNoScrollbars { + class helpSplash: RscControlsGroupNoScrollbars { idc = IDC_HELP; x = 0.5 - W_PART(12); y = 0.5 - H_PART(12); @@ -196,12 +206,7 @@ class GVAR(interface) { class helpTitle: helpBack { h = H_PART(1); colorText[]={COL_FORE}; - colorBackground[] = { - "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", - "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", - "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", - 1 - }; + colorBackground[] = {COL_FORE_D}; sizeEx = H_PART(1); text = CSTRING(HelpTitle); }; diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 6b5081c000..4fb9dc3744 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -10,11 +10,20 @@ PREP(handleRespawn); PREP(handleTree); PREP(moduleSpectatorSettings); PREP(setSpectator); +PREP(updateInterface); PREP(updateUnits); PREP(updateView); +GVAR(showComp) = true; +GVAR(showHelp) = true; +GVAR(showInterface) = true; +GVAR(showMap) = false; +GVAR(showTool) = true; +GVAR(showUnit) = true; + GVAR(unitList) = []; GVAR(unitBlacklist) = []; GVAR(unitWhitelist) = []; + ADDON = true; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 8374154273..ab51902c57 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -124,9 +124,10 @@ switch (toLower _mode) do { // Initalize the display _display = _args select 0; - // Hide the map - (_display displayCtrl IDC_MAP) ctrlShow false; - (_display displayCtrl IDC_MAP) mapCenterOnCamera false; + // Always show interface and hide map upon opening + GVAR(showInterface) = true; + GVAR(showMap) = false; + [] call FUNC(updateInterface); // Set text values (_display displayCtrl IDC_TOOL_FOCUS) ctrlSetText str(GVAR(camFocus)); @@ -195,14 +196,11 @@ switch (toLower _mode) do { switch (_dik) do { case 1: { // Esc - ["close"] call FUNC(handleInterface); // Handle esc menu goes here, currently closes for purposes of testing + [player,false] call FUNC(setSpectator); // Handle esc menu goes here, currently closes for purposes of testing }; case 14: { // Backspace - private ["_tree","_show"]; - _tree = _display displayCtrl IDC_UNIT; - _show = !ctrlShown _tree; - - _tree ctrlShow _show; + GVAR(showInterface) = !GVAR(showInterface); + [] call FUNC(updateInterface); }; case 16: { // Q GVAR(camBoom) set [0,true]; @@ -210,6 +208,14 @@ switch (toLower _mode) do { case 17: { // W GVAR(camDolly) set [0,true]; }; + case 20: { // T + GVAR(showTool) = !GVAR(showTool); + [] call FUNC(updateInterface); + }; + case 22: { // U + GVAR(showUnit) = !GVAR(showUnit); + [] call FUNC(updateInterface); + }; case 29: { // Ctrl GVAR(ctrlKey) = true; }; @@ -223,21 +229,19 @@ switch (toLower _mode) do { GVAR(camDolly) set [3,true]; }; case 35: { // H - private ["_help","_show"]; - _help = _display displayCtrl IDC_HELP; - _show = !ctrlShown _help; - - _help ctrlShow _show; + GVAR(showHelp) = !GVAR(showHelp); + [] call FUNC(updateInterface); + }; + case 37: { // K + GVAR(showComp) = !GVAR(showComp); + [] call FUNC(updateInterface); }; case 44: { // Z GVAR(camBoom) set [1,true]; }; case 50: { // M - private ["_map","_show"]; - _map = _display displayCtrl IDC_MAP; - _show = !ctrlShown _map; - - _map ctrlShow _show; + GVAR(showMap) = !GVAR(showMap); + [] call FUNC(updateInterface); //[_show] call FUNC(handleMap); }; case 57: { // Spacebar diff --git a/addons/spectator/functions/fnc_updateInterface.sqf b/addons/spectator/functions/fnc_updateInterface.sqf new file mode 100644 index 0000000000..0d9e19fdf9 --- /dev/null +++ b/addons/spectator/functions/fnc_updateInterface.sqf @@ -0,0 +1,19 @@ +#include "script_component.hpp" + +private ["_display","_elements","_show"]; +disableSerialization; + +_display = GETUVAR(GVAR(display),displayNull); +_elements = [IDC_COMP,IDC_HELP,IDC_MAP,IDC_TOOL,IDC_UNIT]; +_show = [GVAR(showComp),GVAR(showHelp),GVAR(showMap),GVAR(showTool),GVAR(showUnit)]; + +// Hide/show interface elements in accordance with good UX design +if (GVAR(showInterface)) then { + { + (_display displayCtrl _x) ctrlShow (_show select _forEachIndex); + } forEach _elements; +} else { + { + (_display displayCtrl _x) ctrlShow GVAR(showInterface); + } forEach _elements; +}; diff --git a/addons/spectator/script_component.hpp b/addons/spectator/script_component.hpp index dbb3f4b38f..0e28053d32 100644 --- a/addons/spectator/script_component.hpp +++ b/addons/spectator/script_component.hpp @@ -52,3 +52,4 @@ // UI colours #define COL_BACK 0.1,0.1,0.1,0.8 #define COL_FORE 1,1,1,1 +#define COL_FORE_D 0.1,0.1,0.1,1