Simple menu system with sibling menus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Cole f27e6eaeff
who knows
9 months ago
src who knows 9 months ago
.gitignore Initial commit 11 months ago
Makefile uploaded documentation 11 months ago
README.md Fixed issue with num_of_strings in README 9 months ago

README.md

Simple ncurses Menu System (WIP)

Features

  • Create simple and sibling menus

Documentation

  • Create 3 menus
#include <stdio.h>
#include <ncurses.h>

#include "menu.h"
#include "config.h"

int main()
{
    /* Inits ncurses */
    initscr();
    noecho();
    curs_set(0);

    /* Sets up the color pair of the selected menu */
    start_color();
    init_pair(1, COLOR_BLUE, COLOR_BLACK);

    /* Each sub-array is the text of said windows/menu */
    const char* arr[NUM_OF_WINDOWS][MAX_ARR_SIZE] = {
        {"test1", "test2", "test3", NULL},
        {"test4", "test5", NULL},
        {"test6", "test7", "test8", "test9", NULL}
    };

    /* This creates the menus/windows with the text above */
    WINDOW* windows[NUM_OF_WINDOWS] = {
        create_window(10, 20, 1, 1, 3, arr[0]),
        create_window(10, 10, 1, 21, 2, arr[1]),
        create_window(10, 10, 1, 31, 4, arr[2])
    };

    /* This creates the actual menu */
    while (1) {
        menu_init(NUM_OF_WINDOWS, MAX_ARR_SIZE, arr, windows, 1);
    }
    endwin();
}

Output

output


Keybindings

j - move cursor down
k - move cursor up
H - select menu to the left
L - select menu to the right

Todo

  • Make accessing the functions more user friendly
  • An indicator showing which menu is currently selected
  • Add other types of menus