int interface_init(t_sceptiques *tab) { char* filoname[7]; t_surfaces *surfaces; int i; filoname_init(filoname); surfaces = &g_graph.surfaces; g_graph.fps = DEFAULT_FPS; i = -1; while (++i < 7) create_rgb_surface(&surfaces->filos[i], FILOIMG_WIDTH, FILOIMG_HEIGHT); surfaces->faces[RESTING] = SDL_LoadBMP("assets/filor.bmp"); surfaces->faces[EATING] = SDL_LoadBMP("assets/filoe.bmp"); surfaces->faces[THINKING] = SDL_LoadBMP("assets/filot.bmp"); surfaces->faces[LEFT] = SDL_LoadBMP("assets/end.bmp"); i = -1; while (++i < 7) { tab[i].name = filoname[i]; g_graph.filo[i].onScreen.x = LEGENDE_WIDTH + i * FILOIMG_WIDTH; g_graph.filo[i].onScreen.y = 0; } srand((unsigned int) time(NULL)); init(tab); return (0); }
void screen_init () { screen.width = opt.width; screen.height = opt.height; screen.bpp = 32; screen.running = 1; screen.display = SDL_SetVideoMode (screen.width, screen.height, screen.bpp, SDL_SWSURFACE | SDL_DOUBLEBUF); if (screen.display == NULL) { perror ("SDL_SetVideoMode"); exit (EXIT_FAILURE); } sdl_init (); create_rgb_surface (); }