void splash_screen_update(void) { /* Keep track of how long the splash screen has been displayed */ total_ticks += delta; if (total_ticks >= 3000) { init_main_menu(); } /* End keep track of how long the splash screen has been displayed */ }
void splash_screen_poll_events(SDL_Event* event) { while (SDL_PollEvent(event) != 0) { if (event->type == SDL_QUIT) { exit_SDL = 1; } else if (event->type == SDL_KEYDOWN || event->type == SDL_MOUSEBUTTONDOWN) { init_main_menu(); } } }
static int lcd_entry(struct ftm_param *param, void *priv) { lcd_module *lcd = (lcd_module *)priv; bool exit = false; seq_index = 0; init_main_menu(param, lcd); while(!exit) { switch(lcd->itm_view->run(lcd->itm_view, NULL)) { case ITEM_SHOW_TEST_IMAGES: display_test_images(lcd); init_main_menu(param, lcd); exit = false; break; case ITEM_CHANGE_CONTRAST: change_contrast(); exit = false; break; case ITEM_PASS: lcd->module->test_result = FTM_TEST_PASS; exit = true; break; case ITEM_FAIL: lcd->module->test_result = FTM_TEST_FAIL; exit = true; break; case -1: exit = true; break; default: break; } } write_int(BRIGHTNESS_FILE, 255); return 0; }
void open_main_window() { int xtmp, ytmp; WindowParams bwin; WinUnion wun; init_main_menu(); /* the main menu must be created *before* the SIMM window */ glueSetWindowPlacement(GLUT_NORMAL_WINDOW, GLUE_CENTER, root.gldesc.max_screen_x, root.gldesc.max_screen_y, 0, 0, NULL); bwin.id = glueOpenWindow("simm",no,GLUE_NO_WINDOW_FLAGS); glueSetWindowMinSize(950,700); #if SIMM_DEMO_VERSION sprintf(buffer,"%s - Tryout Version (%s)", program_name, program_version); #elif SIMM_VIEWER sprintf(buffer,"%s (%s)", program_name, program_version); #elif defined WIN32 strcpy(buffer, program_with_version); if (is_in_demo_mode()) strcat(buffer, " - Demo Mode"); #else sprintf(buffer,"%s: %s, %s %s", program_name, program_full_name, program_version, copyright_notice); #endif mstrcpy(&bwin.name,buffer); glutSetIconTitle(program_name); glutSetWindowTitle(bwin.name); wun.tool = NULL; root.basewindow = add_window(&bwin,&wun,NOTYPE,-1,no,display_background, update_background,background); if (root.basewindow == -1) error(exit_program,tool_message); glutSetWindowData(bwin.id, root.basewindow); glueGetWindowOrigin(&root.surgwin.x1,&root.surgwin.y1); glueGetWindowSize(&xtmp,&ytmp); root.surgwin.x2 = root.surgwin.x1 + xtmp; root.surgwin.y2 = root.surgwin.y1 + ytmp; }
/** * menustate(void) * * @brief * @param void * @return void */ void menustate(void) { sbool run = TRUE; while(run){ if(widget_get_uip()->root->shown.count > 0 || widget_get_uip()->root->hidden.count > 0) widget_unload(widget_get_uip()->root); switch(menu_state){ case MENU_STATE_MAIN: init_main_menu();//initializes the first menu for use. main_menu();//Start the First Menu, Menu main loop. break; case MENU_STATE_CREDITS: init_credits(); credits(); break; case MENU_STATE_LOGIN: init_login(); login(); break; case MENU_STATE_CREATE: init_new_account(); new_account(); break; case MENU_STATE_INGAME: init_ingame(); ingame(); break; case MENU_STATE_STATUS: if(!statusloader) init_status("Log in successful."); else { init_status("Widget System Initialized."); statusloader = FALSE; } status(); break; case MENU_STATE_EXIT: run = FALSE; break; } } }
static int tvout_entry(struct ftm_param *param, void *priv) { tvout_module *tvout = (tvout_module *)priv; bool exit = false; init_accdet(); init_main_menu(param, tvout); tvout->exit_thread = false; pthread_create(&tvout->polling_thread, NULL, polling_cable_plugin_thread, priv); while(!exit) { switch(tvout->itm_view->run(tvout->itm_view, NULL)) { case ITEM_PASS: tvout->module->test_result = FTM_TEST_PASS; exit = true; break; case ITEM_FAIL: tvout->module->test_result = FTM_TEST_FAIL; exit = true; break; case -1: exit = true; break; default: break; } } tvout->exit_thread = true; pthread_join(tvout->polling_thread, NULL); return 0; }
int main() { if(chdir(PKGDATADIR) != 0) { printf("data directory %s not found.", PKGDATADIR); } init(); init_camera(); init_board(&board); init_striker(&striker); init_chips(); init_orientation(&striker); init_instructions(); init_speed_text(); init_main_menu(); init_scores(); init_game_over_state(); move_to_main_menu(); while(!quit) { frame_start(); while(!quit && accumulator >= elapsed_time) { handle_events(); update(); render(); accumulator -= elapsed_time; } } close(); }
int main(void) { int ret=0; /* Open debugging output file */ output = fopen("curses.out","w"); if (output == NULL) { fprintf(stderr,"Error opening output file\n"); return -1; } /* Initialize ncurses */ if ( initscr() == NULL ) { fprintf(stderr, "Error initialising ncurses.\n"); return-1; } fprintf(output,"Initialized main window\n"); set_xy_size(0); signal(SIGWINCH, set_xy_size); /* handle window resizing in xterm */ signal(SIGINT, _quit_handler); /* handle forced closured */ if (max_x < MIN_X || max_y < MIN_Y) { fprintf(output, "Terminal must be at least %d x %d.\n", MIN_X, MIN_Y); ret=-1; goto cleanup; } /* don't buffer input until the enter key is pressed */ cbreak(); /* don't echo user input to the screen */ noecho(); /* allow the use of arrow keys */ keypad(stdscr, TRUE); /* Clear anything that might be on the screen */ clear(); refresh(); /* Create & bind all menu entries */ init_main_menu(); menu_window = newwin(max_y, max_x, 0, 0); /* enable colours support */ if(has_colors() != FALSE) { start_color(); init_pair(1, COLOR_GREEN, COLOR_BLACK); init_pair(2, COLOR_BLUE, COLOR_BLACK); } /* Start drawing everything on screen */ draw_sibling_menu(main_menu); /* We got here - the user exited the menu. Check for unsaved stuff */ /* TODO */ cleanup: delwin(stdscr); endwin(); refresh(); fclose(output); return ret; }
void gui_thread(GUI_DRIVER_INFO* drv_info) { unsigned int res, tmp, redraw; WINDOW win; WINDOW top; WINDOW desktop; //main_dlg; CHandle key_hnd; CHandle gui_hnd; //prevent these signals not to be used from task handles ALLOCATE_SIGNAL(SIG_GUI_TASK); //wait for static constructors (lcd object) while(!detect_displays(drv_info)) tsk_sleep(10); // start desktop while( !(desktop = tsk_new_window(maindlg_cb)) ) { tsk_sleep(10); } desktop->next = NULL; top = desktop; desktop->rect.x1 = drv_info->lcd[0]->size_x; desktop->rect.y1 = drv_info->lcd[0]->size_y; for(int i=0; i<GUI_DISPLAYS; i++) { if(drv_info->lcd[i]) { #if GUI_DISPLAYS > 1 desktop->displays |= (1<<i); #endif drv_info->lcd[i]->lcd_init((GUI_CB)splashdlg_cb); } } tsk_sleep(3000); init_main_menu(); // start key handle key_hnd.tsk_safe_open(KEY_DRV_INDX, 0); key_hnd.src.as_int = 0; key_hnd.tsk_start_read(&key_hnd.src.as_int, 1); // start gui handle gui_hnd.tsk_safe_open(GUI_DRV_INDX, 0); //mode = 1 - control handle gui_hnd.tsk_start_read(NULL, 0); for(;;) { res = tsk_wait_signal(-1u, 1000 - (CURRENT_TIME %1000)); redraw = res>>8;; if(!res) redraw = 0xFF; // 1) get waiting objects if(res & gui_hnd.signal) { drv_info->lcd[0]->backlight_signal(); gui_hnd.res &= ~FLG_SIGNALED; win = (WINDOW)gui_hnd.dst.as_voidptr; if(win) { top->next = win; do { top = (WINDOW)top->next; top->rect.x1 = desktop->rect.x1; top->rect.y1 = desktop->rect.y1; top->callback(NULL , WM_INIT); #if GUI_DISPLAYS > 1 redraw |= top->displays; #endif } while( top->next ); } gui_hnd.tsk_start_read(NULL, 0); #if GUI_DISPLAYS == 1 redraw |= 1; #endif } // 2) check keyboard if(res & key_hnd.signal) { drv_info->lcd[0]->backlight_signal(); key_hnd.res &= ~FLG_SIGNALED; //send to top tmp = top->callback(key_hnd.src.as_int , WM_KEY); if(tmp & FLG_BUSY) //FLG_BUSY returned to redraw { tmp ^= FLG_BUSY; #if GUI_DISPLAYS > 1 redraw |= top->displays; #else redraw |= 1; #endif } top->mode1 = tmp; key_hnd.tsk_start_read(&key_hnd.src.as_int, 1); } // 3) command loop top = NULL; win = desktop; do { // check for pending commands if(win->mode0 & FLG_OK) { locked_clr_byte(&win->mode0, FLG_OK); tmp = win->callback(win->dst.as_int, WM_USER); if(tmp & FLG_BUSY) //FLG_BUSY returned to redraw { tmp ^= FLG_BUSY; #if GUI_DISPLAYS > 1 redraw |= win->displays; #else redraw |= 1; #endif } win->mode1 |= tmp; } //check for complete (close object) if(top && ((win->mode0 | win->mode1) & FLG_SIGNALED) ) { top->next = win->next; #if GUI_DISPLAYS > 1 redraw |= win->displays; #else redraw |= 1; #endif usr_HND_SET_STATUS(win, win->mode1 | FLG_SIGNALED); win = (WINDOW)top->next; } else { top = win; win = (WINDOW)win->next; } } while (win ); // 3) draw loop for(int i=0; i<GUI_DISPLAYS; i++) { if( (redraw & (1<<i)) && drv_info->lcd[i]) { drv_info->lcd[i]->redraw_screen(desktop); } } } }