From da73f62ea700bea51ea0f080d9655f3a53cc763f Mon Sep 17 00:00:00 2001 From: Simon <33755707+Crotex@users.noreply.github.com> Date: Thu, 23 Jan 2020 13:01:19 +0100 Subject: [PATCH] Now supporting single Arguments --- menu.c | 2 +- menu.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/menu.c b/menu.c index 98839cd..48269a8 100644 --- a/menu.c +++ b/menu.c @@ -63,7 +63,7 @@ void show_menu(const struct MenuPage* pages, const size_t page_count, const bool { // Perform action system("cls"); - pages[page_index].items[i].action(); + pages[page_index].items[i].action(pages[page_index].items[i].param); action_performed = true; // Pause if requested diff --git a/menu.h b/menu.h index 496f55f..3776b21 100644 --- a/menu.h +++ b/menu.h @@ -6,7 +6,8 @@ struct MenuItem { char* text; char key; - void* (*action)(void); + void* (*action)(void* params); + void* param; }; /// Represents a border in which a menu is displayed.