Interface toggles

This commit is contained in:
SilentSpike 2015-07-18 15:42:07 +01:00
parent c6e71fbc36
commit 5d279e11ec
5 changed files with 121 additions and 83 deletions

View File

@ -79,61 +79,70 @@ class GVAR(interface) {
}; };
}; };
}; };
class nameTool: RscText { class toolbar: RscControlsGroupNoScrollbars {
idc = IDC_TOOL_NAME; idc = IDC_TOOL;
x = safeZoneX; x = safeZoneX;
y = safeZoneY; y = safeZoneY;
w = TOOL_W * 2; w = safeZoneW;
h = TOOL_H; h = TOOL_H;
shadow = 2; class controls {
colorText[]={COL_FORE}; class nameTool: RscText {
colorBackground[] = {COL_BACK}; idc = IDC_TOOL_NAME;
sizeEx = H_PART(1); x = 0;
}; y = 0;
class nameFrame: nameTool { w = TOOL_W * 2;
idc = -1; h = TOOL_H;
style = 64; shadow = 2;
}; colorText[]={COL_FORE};
class viewTool: nameTool { colorBackground[] = {COL_BACK};
idc = IDC_TOOL_VIEW; sizeEx = H_PART(1);
x = safeZoneX + TOOL_W * 2 + MARGIN; };
w = TOOL_W; class nameFrame: nameTool {
}; idc = -1;
class viewFrame: viewTool { style = 64;
idc = -1; };
style = 64; class viewTool: nameTool {
}; idc = IDC_TOOL_VIEW;
class clockTool: viewTool { x = TOOL_W * 2 + MARGIN;
idc = IDC_TOOL_CLOCK; w = TOOL_W;
x = safeZoneX + TOOL_W * 3 + MARGIN * 2; };
}; class viewFrame: viewTool {
class clockFrame: clockTool { idc = -1;
idc = -1; style = 64;
style = 64; };
}; class clockTool: viewTool {
class focusTool: viewTool { idc = IDC_TOOL_CLOCK;
idc = IDC_TOOL_FOCUS; x = TOOL_W * 3 + MARGIN * 2;
x = safeZoneX + safeZoneW - TOOL_W * 3 - MARGIN * 2; };
}; class clockFrame: clockTool {
class focusFrame: focusTool { idc = -1;
idc = -1; style = 64;
style = 64; };
}; class focusTool: viewTool {
class fovTool: viewTool { idc = IDC_TOOL_FOCUS;
idc = IDC_TOOL_FOV; x = safeZoneW - TOOL_W * 3 - MARGIN * 2;
x = safeZoneX + safeZoneW - TOOL_W * 2 - MARGIN; };
}; class focusFrame: focusTool {
class fovFrame: fovTool { idc = -1;
idc = -1; style = 64;
style = 64; };
}; class fovTool: viewTool {
class speedTool: viewTool { idc = IDC_TOOL_FOV;
idc = IDC_TOOL_SPEED; x = safeZoneW - TOOL_W * 2 - MARGIN;
x = safeZoneX + safeZoneW - TOOL_W; };
}; class fovFrame: fovTool {
class speedFrame: speedTool { idc = -1;
idc = -1; style = 64;
style = 64; };
class speedTool: viewTool {
idc = IDC_TOOL_SPEED;
x = safeZoneW - TOOL_W;
};
class speedFrame: speedTool {
idc = -1;
style = 64;
};
};
}; };
class unitTools: RscControlsGroupNoScrollbars { class unitTools: RscControlsGroupNoScrollbars {
idc = IDC_UNIT; idc = IDC_UNIT;
@ -153,9 +162,9 @@ class GVAR(interface) {
colorBorder[] = {COL_FORE}; colorBorder[] = {COL_FORE};
colorBackground[] = {COL_BACK}; colorBackground[] = {COL_BACK};
colorSelect[] = { colorSelect[] = {
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1 1
}; };
multiselectEnabled = 0; multiselectEnabled = 0;
@ -167,19 +176,20 @@ class GVAR(interface) {
w = TOOL_W * 2; w = TOOL_W * 2;
h = TOOL_H; h = TOOL_H;
sizeEx = TOOL_H; sizeEx = TOOL_H;
colorBackground[] = {COL_FORE_D};
text = CSTRING(RefreshList); text = CSTRING(RefreshList);
action = QUOTE([] call FUNC(updateUnits)); action = QUOTE([] call FUNC(updateUnits));
}; };
}; };
}; };
class spectatorMap: RscMapControl { class mapOverlay: RscMapControl {
idc = IDC_MAP; idc = IDC_MAP;
x = safeZoneX; x = safeZoneX;
y = safeZoneY + TOOL_H; y = safeZoneY;
w = safeZoneW; w = safeZoneW;
h = safeZoneH; h = safeZoneH;
}; };
class helpBox: RscControlsGroupNoScrollbars { class helpSplash: RscControlsGroupNoScrollbars {
idc = IDC_HELP; idc = IDC_HELP;
x = 0.5 - W_PART(12); x = 0.5 - W_PART(12);
y = 0.5 - H_PART(12); y = 0.5 - H_PART(12);
@ -196,12 +206,7 @@ class GVAR(interface) {
class helpTitle: helpBack { class helpTitle: helpBack {
h = H_PART(1); h = H_PART(1);
colorText[]={COL_FORE}; colorText[]={COL_FORE};
colorBackground[] = { colorBackground[] = {COL_FORE_D};
"(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
};
sizeEx = H_PART(1); sizeEx = H_PART(1);
text = CSTRING(HelpTitle); text = CSTRING(HelpTitle);
}; };

View File

@ -10,11 +10,20 @@ PREP(handleRespawn);
PREP(handleTree); PREP(handleTree);
PREP(moduleSpectatorSettings); PREP(moduleSpectatorSettings);
PREP(setSpectator); PREP(setSpectator);
PREP(updateInterface);
PREP(updateUnits); PREP(updateUnits);
PREP(updateView); PREP(updateView);
GVAR(showComp) = true;
GVAR(showHelp) = true;
GVAR(showInterface) = true;
GVAR(showMap) = false;
GVAR(showTool) = true;
GVAR(showUnit) = true;
GVAR(unitList) = []; GVAR(unitList) = [];
GVAR(unitBlacklist) = []; GVAR(unitBlacklist) = [];
GVAR(unitWhitelist) = []; GVAR(unitWhitelist) = [];
ADDON = true; ADDON = true;

View File

@ -124,9 +124,10 @@ switch (toLower _mode) do {
// Initalize the display // Initalize the display
_display = _args select 0; _display = _args select 0;
// Hide the map // Always show interface and hide map upon opening
(_display displayCtrl IDC_MAP) ctrlShow false; GVAR(showInterface) = true;
(_display displayCtrl IDC_MAP) mapCenterOnCamera false; GVAR(showMap) = false;
[] call FUNC(updateInterface);
// Set text values // Set text values
(_display displayCtrl IDC_TOOL_FOCUS) ctrlSetText str(GVAR(camFocus)); (_display displayCtrl IDC_TOOL_FOCUS) ctrlSetText str(GVAR(camFocus));
@ -195,14 +196,11 @@ switch (toLower _mode) do {
switch (_dik) do { switch (_dik) do {
case 1: { // Esc 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 case 14: { // Backspace
private ["_tree","_show"]; GVAR(showInterface) = !GVAR(showInterface);
_tree = _display displayCtrl IDC_UNIT; [] call FUNC(updateInterface);
_show = !ctrlShown _tree;
_tree ctrlShow _show;
}; };
case 16: { // Q case 16: { // Q
GVAR(camBoom) set [0,true]; GVAR(camBoom) set [0,true];
@ -210,6 +208,14 @@ switch (toLower _mode) do {
case 17: { // W case 17: { // W
GVAR(camDolly) set [0,true]; 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 case 29: { // Ctrl
GVAR(ctrlKey) = true; GVAR(ctrlKey) = true;
}; };
@ -223,21 +229,19 @@ switch (toLower _mode) do {
GVAR(camDolly) set [3,true]; GVAR(camDolly) set [3,true];
}; };
case 35: { // H case 35: { // H
private ["_help","_show"]; GVAR(showHelp) = !GVAR(showHelp);
_help = _display displayCtrl IDC_HELP; [] call FUNC(updateInterface);
_show = !ctrlShown _help; };
case 37: { // K
_help ctrlShow _show; GVAR(showComp) = !GVAR(showComp);
[] call FUNC(updateInterface);
}; };
case 44: { // Z case 44: { // Z
GVAR(camBoom) set [1,true]; GVAR(camBoom) set [1,true];
}; };
case 50: { // M case 50: { // M
private ["_map","_show"]; GVAR(showMap) = !GVAR(showMap);
_map = _display displayCtrl IDC_MAP; [] call FUNC(updateInterface);
_show = !ctrlShown _map;
_map ctrlShow _show;
//[_show] call FUNC(handleMap); //[_show] call FUNC(handleMap);
}; };
case 57: { // Spacebar case 57: { // Spacebar

View File

@ -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;
};

View File

@ -52,3 +52,4 @@
// UI colours // UI colours
#define COL_BACK 0.1,0.1,0.1,0.8 #define COL_BACK 0.1,0.1,0.1,0.8
#define COL_FORE 1,1,1,1 #define COL_FORE 1,1,1,1
#define COL_FORE_D 0.1,0.1,0.1,1