Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move flexiMenu functions to CfgFunctions #1054

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions addons/ui/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,36 @@ class CfgFunctions {
description = "Open a previously defined menu by passing the exact parameters used with cba_fnc_fleximenu_add. Result: TBA (WIP)";
file = QUOTE(PATHTOF(flexiMenu\fnc_openMenuByDef.sqf));
};
class flexiMenu_keyDown {
file = QUOTE(PATHTOF(flexiMenu\fnc_keyDown.sqf));
};
class flexiMenu_keyUp {
file = QUOTE(PATHTOF(flexiMenu\fnc_keyUp.sqf));
};
class flexiMenu_menu {
file = QUOTE(PATHTOF(flexiMenu\fnc_menu.sqf));
};
class flexiMenu_list {
file = QUOTE(PATHTOF(flexiMenu\fnc_list.sqf));
};
class flexiMenu_getMenuDef {
file = QUOTE(PATHTOF(flexiMenu\fnc_getMenuDef.sqf));
};
class flexiMenu_getMenuOption {
file = QUOTE(PATHTOF(flexiMenu\fnc_getMenuOption.sqf));
};
class flexiMenu_menuShortcut {
file = QUOTE(PATHTOF(flexiMenu\fnc_menuShortcut.sqf));
};
class flexiMenu_mouseButtonDown {
file = QUOTE(PATHTOF(flexiMenu\fnc_mouseButtonDown.sqf));
};
class flexiMenu_highlightCaretKey {
file = QUOTE(PATHTOF(flexiMenu\fnc_highlightCaretKey.sqf));
};
class flexiMenu_execute {
file = QUOTE(PATHTOF(flexiMenu\fnc_execute.sqf));
};
PATHTO_FNC(addPauseMenuOption);
PATHTO_FNC(progressBar);
PATHTO_FNC(getFov);
Expand Down
30 changes: 14 additions & 16 deletions addons/ui/flexiMenu/init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@

if (isDedicated) exitWith {false};

FUNC(keyDown) = CBA_fnc_flexiMenu_keyDown;
FUNC(keyUp) = CBA_fnc_flexiMenu_keyUp;
FUNC(menu) = CBA_fnc_flexiMenu_menu;
FUNC(list) = CBA_fnc_flexiMenu_list;
FUNC(getMenuDef) = CBA_fnc_flexiMenu_getMenuDef;
FUNC(getMenuOption) = CBA_fnc_flexiMenu_getMenuOption;
FUNC(menuShortcut) = CBA_fnc_flexiMenu_menuShortcut;
FUNC(mouseButtonDown) = CBA_fnc_flexiMenu_mouseButtonDown;
FUNC(highlightCaretKey) = CBA_fnc_flexiMenu_highlightCaretKey;
FUNC(execute) = CBA_fnc_flexiMenu_execute;
FUNC(add) = CBA_fnc_flexiMenu_add;
FUNC(remove) = CBA_fnc_flexiMenu_remove;
FUNC(setObjectMenuSource) = CBA_fnc_setObjectMenuSource;
dedmen marked this conversation as resolved.
Show resolved Hide resolved
dedmen marked this conversation as resolved.
Show resolved Hide resolved

// list of all menu activation keys and associated types
GVAR(typeMenuSources) = []; // types, keys and menu sources data
GVAR(target) = objNull; // current object for interaction
GVAR(holdKeyDown) = false; // default global behaviour of requiring holding key down. Can be overriden by menus.
GVAR(hotKeyColor) = ""; // override colour of hotkey. It is set from rsc menu file, upon opening either the "menu" or "list". If not present, a default will be used.

PREP_SUB(flexiMenu,keyDown);
PREP_SUB(flexiMenu,keyUp);
PREP_SUB(flexiMenu,menu);
PREP_SUB(flexiMenu,list);
PREP_SUB(flexiMenu,getMenuDef);
PREP_SUB(flexiMenu,getMenuOption);
PREP_SUB(flexiMenu,menuShortcut);
PREP_SUB(flexiMenu,mouseButtonDown);
PREP_SUB(flexiMenu,highlightCaretKey);
PREP_SUB(flexiMenu,execute);

// TODO: move these to public CfgFunctions soon.
PREP_SUB(flexiMenu,add);
PREP_SUB(flexiMenu,remove);
PREP_SUB(flexiMenu,setObjectMenuSource);

dedmen marked this conversation as resolved.
Show resolved Hide resolved
// prevent instant reactivation of menu after selection was made, while key still held down. Value is reset upon key release.
GVAR(optionSelected) = false;
// prevent multiple activations of menu due to key press via keyDown. onLoad can sometimes take a few milliseconds to init.
Expand Down