void *launch_gui(void *arg) { SDL_Event event; SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) == -1 || !(screen = SDL_SetVideoMode(WIN_WIDTH, WIN_HEIGHT, 32, SDL_HWSURFACE)) || SDL_FillRect(screen, NULL, 0)) return (NULL); SDL_WM_SetCaption(WIN_TITLE, NULL); while (1) { SDL_PollEvent(&event); if (event.type == SDL_QUIT || (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_ESCAPE) || !fill_gui(screen, (t_data *)arg) || SDL_Flip(screen) == -1) break ; else if (event.type == SDL_KEYDOWN) manage_event(&event, (t_data *)arg); SDL_Delay(20); } SDL_FreeSurface(screen); SDL_Quit(); return (NULL); }
void manage_display(t_client *cl, int what) { manage_event(cl); if (cl->status == CL_LOAD && what == 0) { load_background(cl->fx); load_map(cl); load_ressource(cl); load_players(cl); /*load_box_info(cl);*/ SDL_Flip(cl->fx->gui->window); } }