Beispiel #1
0
Datei: menu.c Projekt: glankk/gz
void menu_enter(struct menu *menu, struct menu *submenu)
{
  if (menu->child)
    return menu_enter(menu->child, submenu);
  menu_signal_leave(menu, MENU_SWITCH_ENTER);
  menu->child = submenu;
  submenu->parent = menu;
  menu_signal_enter(submenu, MENU_SWITCH_ENTER);
}
Beispiel #2
0
/* 
 * Execute function for currently selected menu entry (or if it's a submenu,
 *  enter the submenu)
 *
 */
void menu_select(menu_context_t *context) {
	menu_entry_t *entry = &context->menu->entry[context->menu->current_entry];
	if (entry->flags & MENU_FLAG_SUBMENU) {
		// Submenu -- enter it
		menu_enter(context, (menu_t *) entry->value);
	} else {
		// Regular entry -- execute function
		entry->select(entry->value, entry->name);
	}
	// Re-display menu on return
	menu_display(context);
}
Beispiel #3
0
void menu_drawmain(void)
{
   	glcd_fillScreen(OFF);
	glcd_text57(0, 0, mainmenu[0].menutext, 1, ON);
   	glcd_bar(0, 9, 127, 9, 2, ON); //div

   	for(i=1;i<mm;i++)
   	{
		glcd_text57(0, 14+((i-1)*9), mainmenu[i].menutext, 1, ON);
   		menu_enter(14+((i-1)*9),ON);
   	}
   	
   	glcd_update();
}
Beispiel #4
0
static void watchfile_view(struct menu *menu)
{
  /* initialize menus */
  watchfile_menu_init();
  watchfile_scroll = 0;
  /* configure menus */
  for (int i = 0; i < WATCHFILE_VIEW_ROWS; ++i) {
    if (i < watchfile_entries.size)
      menu_item_enable(watchfile_items[i]);
    else
      menu_item_disable(watchfile_items[i]);
  }
  if (watchfile_entries.size > 0)
    menu_select(&watchfile_menu, watchfile_items[0]);
  else
    menu_select(&watchfile_menu, watchfile_return);
  menu_enter(menu, &watchfile_menu);
}
void processa_menu(Jogo* jogo, Menu* menu, ALLEGRO_EVENT ev){
	if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
		jogo->sair = true;
	else if (ev.type == ALLEGRO_EVENT_TIMER)
		jogo->redraw = true;
	else if (ev.type == ALLEGRO_EVENT_KEY_DOWN)
		switch (ev.keyboard.keycode){
			case ALLEGRO_KEY_DOWN:
				menu_down(menu);
				break;
			case ALLEGRO_KEY_UP:
				menu_up(menu);
				break;
			case ALLEGRO_KEY_SPACE: case ALLEGRO_KEY_ENTER:
				menu_enter(menu);
				break;
		}
}
Beispiel #6
0
static void menu_settings(void) {
	menu_enter(entries_settings);
}
Beispiel #7
0
Datei: menu.c Projekt: glankk/gz
void menu_enter_top(struct menu *menu, struct menu *submenu)
{
  if (menu->parent)
    return menu_enter_top(menu->parent, submenu);
  return menu_enter(menu, submenu);
}