static void render_tab_bar(int active) { move(0,0); deleteln(); display_logo(); display_tabs(active); refresh(); }
/* Main Menu */ void display_main_menu(Menu* main_menu) { int win_width, win_height; render_update(main_menu->window); SDL_GetWindowSize(main_menu->window.win, &win_width, &win_height); display_menu_background(win_width, win_height, main_menu); display_logo(win_width, win_height, main_menu); display_canvas_button(win_width, win_height, main_menu); display_challenges_button(win_width, win_height, main_menu); display_menu_help_button(win_width, win_height, main_menu); display_quit_button(win_width, win_height, main_menu); }
static void draw_menu(t_game *g) { WINDOW *win[3]; int i; if (LINES < 25 || COLS < 32) return (display_error_size()); highlight_choose(g, win); mvwprintw(win[0], 1, 1, " RE-TRY ", g->size, g->size); mvwprintw(win[1], 1, 1, " HIGH SCORES ", g->size, g->size); mvwprintw(win[2], 1, 1, " EXIT ", g->size, g->size); ft_wclear(stdscr); mvwprintw(stdscr, LINES / 2 - 11 / 2 - 1, COLS / 2 - 7, "score: %07d", g->score); display_logo(LINES / 2 - 11 / 2 - 7); wrefresh(stdscr); i = 0; while (i < 3) { wrefresh(win[i]); delwin(win[i++]); } display_fail(LINES / 2 + 24 / 2 - 7); }
int main(int argc, char **argv) { console_init(Version) ; //*********************************************************** // Check for NDIR environment variable //*********************************************************** // get program filename int startIdx = 1 ; char exename[PATH_MAX] ; // for (int j = 1; j < argc; j++) { // printf("0: %s\n", argv[j]) ; // } // interesting lessons from WinNT 4.0: // If the OS is WinNT 4.0, and; // If the executable file is located in the current directory, // THEN: // argv[0] does NOT contain the fully-qualified // path of the EXE, it *only* contains the EXE name. // In all other situations, argv[0] is fully qualified!! // // P.S. While we're here, derive default INI filename also // printf("argv0=%s\n", argv[0]) ; char* strptr = strrchr(argv[0], '\\') ; // no path present if (strptr == 0) { SearchPath(NULL, argv[0], ".exe", PATH_MAX, ininame, NULL) ; strptr = strrchr(ininame, '\\') ; if (strptr != 0) strcpy(strptr, "\\ndir.ini") ; strcpy(exename, argv[0]) ; // ininame[0] = 0 ; // ONLY support current location } else { // pick up INI filename strcpy(ininame, argv[0]) ; strptr = strrchr(ininame, '\\') ; if (strptr == 0) return 1; strcpy(strptr, "\\ndir.ini") ; // now process exe name for getenv() strptr++ ; //lint !e613: skip backslash strcpy(exename, strptr) ; //lint !e613 strptr = strchr(exename, '.') ; if (strptr != 0) *strptr = 0 ; // strip the extension } char* options = getenv(exename) ; if (options != 0) { argv[0] = options ; startIdx = 0 ; } // printf("ininame=%s\n", ininame) ; // getchar() ; // for (int j = startIdx; j < argc; j++) { // printf("1: %s\n", argv[j]) ; // } //*********************************************************** // first read default settings //*********************************************************** read_config_file() ; //*********************************************************** // override defaults with command line and environment vars //*********************************************************** parse_command_args(startIdx, argc, argv) ; verify_flags() ; // this may add extensions if -x is given //*********************************************************** // Execute the requested command //*********************************************************** // output_html_header("ndir32"); display_logo() ; if (n.help) info(helptxt) ; else if (n.info) info(idtxt) ; else if (n.drive_summary) display_drive_summary() ; else { // If no filespec was given, insert current path with *.* if (tcount==0) insert_target_filespec(".") ; sort_target_paths() ; // LFN: okay process_filespecs() ; } // output_html_footer(); error_exit(DATA_OKAY, NULL) ; return 0 ; }
/* * register framebuffer driver. */ bool_t register_framebuffer(struct fb * fb) { struct chrdev * dev; struct console * console; struct fb_console_info * info; struct color_t col; u8_t brightness; if(!fb || !fb->info || !fb->info->name) return FALSE; surface_set_maps(&fb->info->surface.maps); dev = malloc(sizeof(struct chrdev)); if(!dev) return FALSE; dev->name = fb->info->name; dev->type = CHR_DEV_FRAMEBUFFER; dev->open = fb_open; dev->read = fb_read; dev->write = fb_write; dev->ioctl = fb_ioctl; dev->close = fb_close; dev->driver = fb; if(!register_chrdev(dev)) { free(dev); return FALSE; } if(search_chrdev_with_type(dev->name, CHR_DEV_FRAMEBUFFER) == NULL) { unregister_chrdev(dev->name); free(dev); return FALSE; } if(fb->init) (fb->init)(fb); display_logo(fb); if(fb->ioctl) { brightness = 0xff; (fb->ioctl)(fb, IOCTL_SET_FB_BACKLIGHT, &brightness); } if(default_framebuffer == NULL) default_framebuffer = fb; /* * register a console */ console = malloc(sizeof(struct console)); info = malloc(sizeof(struct fb_console_info)); if(!console || !info) { unregister_chrdev(dev->name); free(dev); free(console); free(info); return FALSE; } info->name = (char *)fb->info->name; info->fb = fb; info->fw = 8; info->fh = 16; info->w = fb->info->surface.w / info->fw; info->h = fb->info->surface.h / info->fh; info->x = 0; info->y = 0; info->f = TCOLOR_WHITE; info->b = TCOLOR_BLACK; tcolor_to_color(info->f, &col); info->fc = fb_map_color(fb, &col); tcolor_to_color(info->b, &col); info->bc = fb_map_color(fb, &col); info->cursor = TRUE; info->onoff = TRUE; info->clen = info->w * info->h; info->cell = malloc(info->clen * sizeof(struct fbcon_cell)); if(!info->cell) { unregister_chrdev(dev->name); free(dev); free(console); free(info); return FALSE; } memset(info->cell, 0, info->clen * sizeof(struct fbcon_cell)); console->name = info->name; console->getwh = fbcon_getwh; console->getxy = fbcon_getxy; console->gotoxy = fbcon_gotoxy; console->setcursor = fbcon_setcursor; console->getcursor = fbcon_getcursor; console->setcolor = fbcon_setcolor; console->getcolor = fbcon_getcolor; console->cls = fbcon_cls; console->getcode = NULL; console->putcode = fbcon_putcode; console->onoff = fbcon_onoff; console->priv = info; if(!register_console(console)) { unregister_chrdev(dev->name); free(dev); free(console); free(info->cell); free(info); return FALSE; } return TRUE; }