本文整理汇总了C++中display_menu函数的典型用法代码示例。如果您正苦于以下问题:C++ display_menu函数的具体用法?C++ display_menu怎么用?C++ display_menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了display_menu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (void) {
int command;
display_menu ();
printf("Enter a command from above menu:");
scanf("%d", &command);
switch (command) {
case 0:
display_menu ();
break;
case 1:
copy ();
display_menu ();
break;
case -1:
return 0;
default:
printf("Invalid choice\n");
break;
}
printf("\n");
printf("\n");
return 0;
}
示例2: dma_callback
/**
* \brief DMA callback function for transfer complete.
*/
static void dma_callback(struct dma_resource* const resource)
{
transfer_is_done = true;
dma_break++;
if (true == is_scrolling) {
/* Used for automatically exit implementation */
if ((dma_block_count * 4) <= dma_break) {
dma_break = 0;
/* Stop Automated character mode */
xpro_lcd_automated_char_stop();
printf("Exits from scrolling mode.\n\n\r");
display_menu();
}
}
if (true == is_bitmapping) {
/* Used for automatically exit implementation */
if ((bitmapping_repeat_count) <= dma_break) {
dma_break = 0;
/* Stop Automated bit mode */
xpro_lcd_automated_bit_stop();
printf("Exits from Bit mapping mode.\n\n\r");
display_menu();
}
}
}
示例3: main
/**
* \brief Application entry point for SPI example.
*
* \return Unused (ANSI-C compatibility).
*/
int main(void)
{
uint8_t uc_key;
/* Initialize the SAM system. */
sysclk_init();
board_init();
/* Initialize the console UART. */
configure_console();
/* Output example information. */
puts(STRING_HEADER);
/* Configure SPI interrupts for slave only. */
NVIC_ClearPendingIRQ(SPI_IRQn);
NVIC_DisableIRQ(SPI_IRQn);
NVIC_SetPriority(SPI_IRQn, 0);
NVIC_EnableIRQ(SPI_IRQn);
spi_slave_initialize();
spi_xdmac_configure(SPI0);
/* Display menu. */
display_menu();
while (1) {
scanf("%c", (char *)&uc_key);
switch (uc_key) {
case 'h':
display_menu();
break;
case 't':
spi_disable_xdmac();
NVIC_ClearPendingIRQ(SPI_IRQn);
NVIC_DisableIRQ(SPI_IRQn);
NVIC_SetPriority(SPI_IRQn, 0);
NVIC_EnableIRQ(SPI_IRQn);
spi_master_go();
break;
default:
/* Set configuration #n. */
if ((uc_key >= '0')
&& (uc_key <= ('0' + NUM_SPCK_CONFIGURATIONS - 1))) {
spi_set_clock_configuration(uc_key - '0');
}
break;
}
}
}
示例4: switch
void STLMoblet::keyPressEvent(int keyCode)
{
switch(keyCode)
{
case MAK_BACK:
maExit(0);
break;
case MAK_0:
STL_containers();
display_menu();
break;
case MAK_1:
functors_explained();
STL_functors();
display_menu();
break;
case MAK_2:
pointer_adapters_explained();
STL_adaptors();
display_menu();
break;
case MAK_3:
predicates_explained();
display_menu();
break;
case MAK_4:
STL_algorithms();
display_menu();
break;
case MAK_5:
STL_string();
display_menu();
break;
case MAK_6:
aux_functions();
display_menu();
break;
case MAK_7:
STL_auto_ptr();
display_menu();
break;
case MAK_8:
STL_pair();
display_menu();
break;
case MAK_9:
STL_iterators();
display_menu();
break;
}
}
示例5: main
/**
* \brief The main function.
*/
int main(void)
{
uint8_t key;
/* Initialize the SAM system */
sysclk_init();
board_init();
/* Initialize the console */
configure_console();
/* Output example information */
printf("-- AES Example --\r\n");
printf("-- %s\n\r", BOARD_NAME);
printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);
/* Enable the AES module. */
aes_get_config_defaults(&g_aes_cfg);
aes_init(AES, &g_aes_cfg);
aes_enable();
/* Enable AES interrupt. */
aes_enable_interrupt(AES, AES_INTERRUPT_DATA_READY);
/* Display menu */
display_menu();
while (1) {
scanf("%c", (char *)&key);
switch (key) {
case 'h':
display_menu();
break;
case 'e':
printf("GCM mode encryption test.\r\n");
gcm_mode_encryption_test();
break;
case 'd':
printf("GCM mode decryption test.\r\n");
gcm_mode_decryption_test();
break;
default:
break;
}
}
}
示例6: main_platform
void main_platform() {
if(button_read_button(&down_btn)) {
if(is_view(gfx_mono_active_menu)) {
if(gfx_mono_active_menu != NO_GPS_VIEW) {
display_next_view();
}
}
// If it's not a view then the down button should be used for menu navigation.
else {
gfx_mono_menu_process_key(&menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)], GFX_MONO_MENU_KEYCODE_DOWN);
ssd1306_write_display();
}
}
if(button_read_button(&select_btn)) {
if(is_view(gfx_mono_active_menu)) {
ssd1306_clear_display();
display_menu(MAIN_MENU);
}
else {
volatile uint8_t menuChoice = gfx_mono_menu_process_key(&menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)], GFX_MONO_MENU_KEYCODE_ENTER);
menu_link menu = menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].element_links[menuChoice];
// TODO: Skriv om snyggare :)
if(menu == EXIT_MENU) {
menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].current_page = 0;
menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].current_selection = 0;
if(is_view(menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].parent)) {
display_view(menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].parent);
}
else {
menu = menu_list[gfx_mono_active_menu-(VIEW_MAX_INDEX+1)].parent;
display_menu(menu);
}
}
else {
display_menu(menu);
}
}
}
}
示例7: process_input
static Uint8 process_input(SDL_Scancode const *s, t_menuentries *item)
{
t_menuentries old_item;
old_item = *item;
*item += (*s == get_input(UP_INP)->code && *item != START_MEN) ? -1 : 0;
*item += (*s == get_input(DOWN_INP)->code && *item != SCORE_MEN) ? 1 : 0;
if (*s == get_input(RETURN_INP)->code)
{
play_sfx(get_common_sfx(BLIPCANCEL_SFX));
set_launcher(&space_destroy);
}
else if (*s == get_input(START_INP)->code)
{
if (entries[*item].enabled)
{
play_sfx(get_common_sfx(BLIPOK_SFX));
set_launcher(entries[*item].callback);
}
}
if (*item != old_item)
{
display_menu();
play_sfx(get_common_sfx(BLIPSEL_SFX));
return (1);
}
return (0);
}
示例8: set_afec_resolution
/**
* \brief Set AFEC resolution mode.
*/
static void set_afec_resolution(void)
{
uint8_t uc_key;
uint8_t uc_done = 0;
display_menu();
while (!uc_done) {
while (uart_read(CONF_UART, &uc_key));
switch (uc_key) {
case 'n':
g_max_digital = MAX_DIGITAL_12_BIT;
afec_set_resolution(AFEC0, AFEC_12_BITS);
puts(" Set Resolution to Normal \n\r");
break;
case 'e':
g_max_digital = MAX_DIGITAL_12_BIT * 16;
afec_set_resolution(AFEC0, AFEC_16_BITS);
puts(" Set Resolution to Enhanced \n\r");
break;
case 'q':
uc_done = 1;
puts(" Quit Configuration \n\r");
break;
default:
break;
}
}
}
示例9: show_bmarks_menu
int
show_bmarks_menu(FileView *view, const char tags[], int go_on_single_match)
{
static menu_info m;
init_menu_info(&m, strdup("Bookmarks"), strdup("No bookmarks found"));
m.execute_handler = &execute_bmarks_cb;
m.key_handler = &bmarks_khandler;
if(is_null_or_empty(tags))
{
bmarks_list(&bmarks_cb, &m);
}
else
{
bmarks_find(tags, &bmarks_cb, &m);
}
if(go_on_single_match && m.len == 1)
{
goto_selected_file(view, m.items[m.pos], 0);
reset_popup_menu(&m);
return curr_stats.save_msg;
}
return display_menu(&m, view);
}
示例10: show_volumes_menu
int
show_volumes_menu(FileView *view)
{
TCHAR c;
TCHAR vol_name[MAX_PATH];
TCHAR file_buf[MAX_PATH];
static menu_info m;
init_menu_info(&m, VOLUMES, strdup("No volumes mounted"));
m.title = strdup(" Mounted Volumes ");
for(c = TEXT('a'); c < TEXT('z'); c++)
{
if(drive_exists(c))
{
TCHAR drive[] = TEXT("?:\\");
drive[0] = c;
if(GetVolumeInformation(drive, vol_name, MAX_PATH, NULL, NULL, NULL,
file_buf, MAX_PATH))
{
char item_buf[MAX_PATH + 5];
snprintf(item_buf, sizeof(item_buf), "%s %s ", drive, vol_name);
m.len = add_to_string_array(&m.items, m.len, 1, item_buf);
}
}
}
return display_menu(&m, view);
}
示例11: inheritance_menu
static void inheritance_menu(ostream &out, istream &in)
{
int choice ;
static FrInheritanceType types[] =
{ NoInherit, InheritSimple,
InheritDFS, InheritBFS,
InheritLocalDFS,
} ;
static const char *type_name[] = { "None", "Simple", "DFS", "BFS",
"Local-DFS"
} ;
out << "Select inheritance type (currently "
<< type_name[get_inheritance_type()] << "):" << endl ;
choice = display_menu(out,in,false,lengthof(types),
0,
"\t1. None\n"
"\t2. Simple IS-A lookup\n"
"\t3. Full Depth-First Search\n"
"\t4. Breadth-First Search\n"
"\t5. Per-slot inheritance, then full DFS\n"
) ;
set_inheritance_type(types[choice-1]) ;
return ;
}
示例12: main_menu
void main_menu() {
int selected_menu_entry;
do {
selected_menu_entry = display_menu();
if(selected_menu_entry == 1) {
// run the game
run();
} else if(selected_menu_entry == 2) {
// display the highscores
show_highscores();
} else if(selected_menu_entry == 3) {
// display a dialog which explains the controls of the game
display_controls();
} else if(selected_menu_entry == 4) {
// display a dialog which explains the elements of the game
display_help();
} else if(selected_menu_entry == 5) {
// clear highscores
if(clear_score_dialog() == 1) {
clear_highscore();
}
}
// leave if the menu entry "exit" is chosen
} while(selected_menu_entry != 6);
}
示例13: menu_run
/**
* \brief Read user input and execute menu selection
*/
void menu_run(void)
{
static unsigned int value = 0;
int c = uart_getchar();
if ((c >= '0') && (c <= '9')) {
value *= 10;
value += c - '0';
uart_putchar(c);
} else if ((c == '\n') || (c == '\r')) {
if ((value > 0) && (value <= _current_menu_size)) {
/* Invoke the callback */
if (_current_menu[value - 1].handler != NULL) {
uart_puts("\n");
if (_current_menu[value - 1].handler() != 0) {
uart_puts("\nError\n");
}
}
} else {
uart_puts("\nInvalid selection\n");
}
display_menu();
value = 0;
} else {
/* Not a valid character */
}
}
示例14: main
//---------main-------------------
int main(){
char end;
int operation;
do{
display_menu();
scanf("%d",&operation);
switch(operation){
case 1 :
display_list();
break;
case 2 :
push();
break;
case 3 :
pop();
break;
default :
printf("Error : Wronge number entered.\n");
break;
}
printf("\n\nDo you want to end program? Enter 'y' or 'n' : ");
end=getche();
printf("\n\n");
}while(end!='y');
}
示例15: main
/*
* The hash table is to keep track of leaves which have already been displayed
* to the user.
*/
int main(int argc, char **argv)
{
int i;
/* Initialize space for blacklist hash table */
if(hcreate(10000)==0) {
fputs("Cannot create hash table.\n",stderr);
return(EX_UNAVAILABLE);
}
i=0;
do {
if(read_pkglist(i++))
break;
if(display_menu())
break;
if(remove_packages())
break;
free_menu();
} while(keep_going());
hdestroy();
fputs("\nProgram Terminated Successfully\n",stderr);
return(0);
}