I'm working on a way to Initialize a Menu. Each Menu has Items, an ID, a Title and a Max. Scroll value. I'm trying to design a function with which i can create such a Menu-Layout and store the Details in a struct. I'm looking for something like this:
struct MenuStruct
{
bool Connected, Open;
int SelectedClient, Scroll, MaxScroll, ActiveMenu;
char **Items; // ?
};
MenuStruct Menu[18];
void InitializeMenu(int Client, int MenuID, int MaxScroll, char *Title, char **Items /* ? */)
{
Menu[Client].ActiveMenu = MenuID;
Menu[Client].MaxScroll = MaxScroll;
Menu[Client].Items = Items; // ?
}
void Menu::MainMenu()
{
InitializeMenu(Client, MainMenuID, 3, "Main Menu", { "Sub Menu 1", "Sub Menu 2", "Sub Menu 3" });
}
As you can probably tell, I'm having problems passing the Items in as paramters and later storing them in the Struct. And while writing this i just thought maybe if someone is able to answer my question, he could maybe tell me aswell, if i could somehow get the Max. Scroll from the number of Items passed in and not having to pass it separately. Thanks in advance!