C Language Development Kit/Snippets/Menu/InitGraphMenu

From OptiWiki

Jump to: navigation, search
Description Initializes the menu_layers. Needed when using the ShowGraphMenu or ShowGraphSelectionMenu.
Syntax
void InitGraphMenu( void );
Arguments None.
Returns None.
Remarks This function must be used in the main() loop and only once!!!
Example
#include <stdio.h>
#include <stdlib.h>
 
#include "lib.h"
#include "menu.h"     //Holds the menu functions
#include "input.h"    //Holds the input functions
 
const char mnuTextA[] = "Menu item A";
const char mnuTextB[] = "Menu item B";
 
void MenuA( void )
{
    setfont( LARGE_FONT, NULL );
    putchar('\f');
    printf("Menu A \Selected\nPress a key");
    WaitForKey();
}
 
void MenuB( void )
{
    setfont( LARGE_FONT, NULL );
    putchar('\f');
    printf("Menu B \Selected\nPress a key");
    WaitForKey();
}
 
const sgraphMenu graphMenu[] = {
        (char*)mnuTextA, NULL, MenuA,
        (char*)mnuTextB, NULL, MenuB,
        };
 
void main( void )
{
    InitGraphMenu();
    for(;;)
    {
        ShowGraphMenu( (sgraphMenu*) graphMenu, sizeof( graphMenu ) / sizeof( sgraphMenu ));
    }
}


Views
Personal tools