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); } }
void show_fatal_error(void) { if (fatal_error) { int sx, sy, ex, ey; int width = uifont_get_string_width(fatal_error_message); int update = 1; sx = (SCR_WIDTH - width) >> 1; sy = (SCR_HEIGHT - FONTSIZE) >> 1; ex = sx + width; ey = sy + (FONTSIZE - 1); video_set_mode(32); load_background(WP_LOGO); while (Loop != LOOP_EXIT) { if (update) { show_background(); small_icon_shadow(6, 3, UI_COLOR(UI_PAL_TITLE), ICON_SYSTEM); uifont_print_shadow(32, 5, UI_COLOR(UI_PAL_TITLE), TEXT(FATAL_ERROR)); draw_dialog(sx - FONTSIZE/2, sy - FONTSIZE/2, ex + FONTSIZE/2, ey + FONTSIZE/2); uifont_print_shadow_center(sy, UI_COLOR(UI_PAL_SELECT), fatal_error_message); update = draw_battery_status(1); update |= draw_volume_status(1); video_flip_screen(1); } else { update = draw_battery_status(0); update |= draw_volume_status(0); video_wait_vsync(); } pad_update(); if (pad_pressed(PSP_CTRL_ANY)) break; } pad_wait_clear(); fatal_error = 0; } }
static void adhoc_init_progress(int total, const char *text) { char buf[32]; load_background(WP_LOGO); video_copy_rect(work_frame, draw_frame, &full_rect, &full_rect); small_icon(6, 3, UI_COLOR(UI_PAL_TITLE), ICON_SYSTEM); sprintf(buf, "AdHoc - %s", game_name); uifont_print(32, 5, UI_COLOR(UI_PAL_TITLE), buf); video_copy_rect(draw_frame, work_frame, &full_rect, &full_rect); init_progress(total, text); }
void init_sdl(t_sdl *game, t_list *philos, pthread_t *threads) { game->threads = threads; game->philos = philos; init_game(game); if (SDL_Init(SDL_INIT_VIDEO) < 0) _error("init_sdl : Init"); if (!(game->screen = SDL_SetVideoMode(game->size[X], game->size[Y] , 32, SDL_HWSURFACE))) _error("init_sdl : SetVideoMode"); SDL_WM_SetCaption("Philosophes", NULL); load_images(game); load_background(game); if (pthread_create(&threads[NPHIL], NULL, &sdl_loop, game) < 0) _error("main() : phtread_create"); }
void DrawN() { unsigned char end = 1; redraw = 1; do { vsync(); end = 1; if(redraw) { ResetVideo(); set_xres(256, xres_flags); scroll(0, 0, -32, 0, 240, 0xC0); #ifndef CDROM1 load_background(n_bg, n_pal, n_map, 32, 20); #else set_screen_size(SCR_SIZE_32x32); cd_loaddata(GPHX_OVERLAY, OFS_N_PAL_bin, palCD, SIZE_N_PAL_bin); load_palette(0, palCD, 16); cd_loadvram(GPHX_OVERLAY, OFS_N_DATA_bin, 0x1000, SIZE_N_DATA_bin); cd_loadvram(GPHX_OVERLAY, OFS_N_BAT_bin, 0, SIZE_N_BAT_bin); // Why these get zapped to 0 when in CDROM1... RestoreGlobals(); #endif redraw = 0; disp_on(); } controller = joy(0); if(controller & JOY_SEL) end = 0; }while(!end); }
void bios_select(int flag) { int sel = 0, rows = 13, top = 0; int i, prev_sel, update = 1; int old_bios = neogeo_bios; if (!bios_check(flag)) return; if (neogeo_bios == -1) { sel = 0; while (sel < BIOS_MAX) { if (bios_exist[sel]) break; sel++; } } else sel = neogeo_bios; if (top > BIOS_MAX - rows) top = BIOS_MAX - rows; if (top < 0) top = 0; if (sel >= BIOS_MAX) sel = 0; if (sel < 0) sel = BIOS_MAX - 1; if (sel >= top + rows) top = sel - rows + 1; if (sel < top) top = sel; pad_wait_clear(); load_background(BG_DEFAULT); ui_popup_reset(); while (1) { if (update) { int width = uifont_get_string_width(TEXT(SELECT_BIOS_AND_PRESS_CIRCLE_BUTTON)); show_background(); small_icon(8, 3, UI_COLOR(UI_PAL_TITLE), ICON_SYSTEM); uifont_print(36, 5, UI_COLOR(UI_PAL_TITLE), TEXT(BIOS_SELECT_MENU)); uifont_print(477 - width, 271 - 16, UI_COLOR(UI_PAL_SELECT), TEXT(SELECT_BIOS_AND_PRESS_CIRCLE_BUTTON)); if (sel != 0) uifont_print(118, 24, UI_COLOR(UI_PAL_SELECT), FONT_UPTRIANGLE); for (i = 0; i < rows; i++) { if (top + i >= BIOS_MAX) break; if (top + i == sel) { uifont_print(12, 40 + i * 17, UI_COLOR(UI_PAL_SELECT), FONT_RIGHTTRIANGLE); uifont_print(32, 40 + i * 17, UI_COLOR(UI_PAL_SELECT), bios_name[top + i]); } else { if (bios_exist[top + i]) uifont_print(32, 40 + i * 17, UI_COLOR(UI_PAL_NORMAL), bios_name[top + i]); else uifont_print(32, 40 + i * 17, COLOR_DARKGRAY, bios_name[top + i]); } } if (sel + rows < BIOS_MAX) uifont_print(118, 260, UI_COLOR(UI_PAL_SELECT), FONT_DOWNTRIANGLE); update = draw_battery_status(1); update |= ui_show_popup(1); video_flip_screen(1); } else { update = draw_battery_status(0); update |= ui_show_popup(0); video_wait_vsync(); } prev_sel = sel; if (pad_pressed(PSP_CTRL_UP)) { if (sel > 0) { if (bios_exist[sel - 1]) { sel--; } else { for (i = sel - 2; i >= 0; i--) if (bios_exist[i]) break; if (i != -1) sel = i; } } } else if (pad_pressed(PSP_CTRL_DOWN)) { if (sel < BIOS_MAX - 1) { if (bios_exist[sel + 1]) { sel++; } else { for (i = sel + 2; i < BIOS_MAX; i++) if (bios_exist[i]) break; if (i != BIOS_MAX) sel = i; } } } else if (pad_pressed(PSP_CTRL_CIRCLE)) { neogeo_bios = sel; break; } if (top > BIOS_MAX - rows) top = BIOS_MAX - rows; if (top < 0) top = 0; if (sel >= BIOS_MAX) sel = 0; if (sel < 0) sel = BIOS_MAX - 1; if (sel >= top + rows) top = sel - rows + 1; if (sel < top) top = sel; if (prev_sel != sel) update = 1; pad_update(); if (Loop == LOOP_EXIT) break; } pad_wait_clear(); ui_popup_reset(); if (flag) load_background(WP_LOGO); else load_background(WP_FILER); #ifdef ADHOC if (flag != 2) #endif { if (old_bios != neogeo_bios) { if (!flag) ui_popup(TEXT(ALL_NVRAM_FILES_ARE_REMOVED)); delete_files("nvram", ".nv"); } } }
int main(int argc, char* argv[]) { //Quit Trigger bool quit = false; //fps stuff; int frame = 0; Timer fps; //Initiate SDL and such if(!init()) return 1; //Load background if(!load_background()) return 2; //Load in other images BulletController* bulletController = new BulletController(); EnemyController* enemyController = new EnemyController(bulletController); Player player(bulletController); OSD osd; //Put all image loading into one function? //Definitely Going to use sprite sheets //The loop :D while(!quit) { //start timing fps fps.start(); //Check for events if(SDL_PollEvent(&event)) { //Quit when X is pressed if(event.type == SDL_QUIT) quit = true; } //Get keystates Uint8 *keystates = SDL_GetKeyState( NULL ); if(keystates[SDLK_ESCAPE]){ quit = true; } if((keystates[SDLK_RALT] && keystates[SDLK_RETURN]) || keystates[SDLK_F11]){ if(isFullscreen) screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE); else screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE|SDL_FULLSCREEN); isFullscreen = !isFullscreen; } //update player.update(keystates); //render apply_surface( 0, 0, background, screen); player.render(screen); bulletController->update(screen); enemyController->update(screen); osd.update(screen); //Refresh the SCREEN if(SDL_Flip(screen) == -1) return 9999; frame++; if( (CAP_FRAMES) && (fps.get_ticks() < 1000 / FRAMES_PER_SECOND)) { SDL_Delay((1000 / FRAMES_PER_SECOND) - fps.get_ticks()); } } return 0; }
int main(int argc,char *argv[]) { char *s; char *pr; char test[50]; char *mask; InitCrashDump(); SetConsoleCtrlHandler(HandlerRoutine,TRUE); filename[0] ='\0'; // strcpy(filename,"TEST.MAP"); args_support(argc-1,argv); printf("Hledam konfiguracni soubor\n"); config_file = read_config("WSKELDAL.INI"); if (config_file == NULL) { puts("...nemohu najit WSKELDAL.INI\n"); return 1; } if (strlen(filename)>3 && stricmp(filename+strlen(filename)-3,"adv") == 0) { TSTR_LIST adv_cfg = read_config(filename); config_file = merge_configs(config_file,adv_cfg); filename[0] = 0; } sample_path = get_text_field(config_file,"CESTA_ZVUKY"); if (sample_path == NULL) sample_path =""; mob_dir = get_text_field(config_file,"CESTA_ENEMY"); if (mob_dir == NULL) mob_dir =""; init_sound(); init(); concat(mask,get_text_field(config_file,"CESTA_MAPY"),"*.map"); atexit(shut_down); // signal(SIGABRT,shut_down); init_mob_list(); InitMapFiles(get_text_field(config_file,"CESTA_MAPY")); do { ask_exit_status = 2; if (filename[0] =='\0') browser(mask,filename); if (filename[0]!='\0') { char *mapy = get_text_field(config_file,"CESTA_MAPY"); memmove(filename+strlen(mapy),filename,strlen(filename)+1); memcpy(filename,mapy,strlen(mapy)); s = pripona(filename,".HI"); background_file = (char *)getmem(strlen(s)+1);strcpy(background_file,s); load_background(); } do_events(); logo(); pr = pripona(filename,SCR); script_name = NewArr(char,strlen(pr)+1); strcpy(script_name,pr); read_full_side_script(pr); read_spec_procs(); read_side_list(ITEMS_SCRIPT,&vzhled_veci,0,4); read_side_list(ITEMS_PICS,&pohledy_veci,0,2); read_dlg_list(DLG_SCRIPT,&dlg_names,&dlg_pgfs); read_side_list(WEAPONS_SCRIPT,&weapons,0,3); read_side_list(WEAPONS_SCRIPT,&weapons_pos,2,3); set_defaults(); init_multiactions(); memset(vyklenky,0,sizeof(vyklenky)); init_item_system(); if (filename[0]!='\0' ) { int sel = 1; init_maps(); set_defaults(); if (load_map(filename)) msg_box(filename,'\01',"Tento soubor je buƒ ne‡iteln˜, nebo po¨kozen˜","Pokra‡ovat",NULL); if (check_password(NULL) == 0) if (ask_password(test,0) == 0 || check_password(test) == 0) { filename[0] = 0; ask_exit_status = 1; goto preskoc; } if (maplen<2) { sel = msg_box(filename,' ',"Soubor neexistuje, bude vytvo©en nov˜. Nyn¡ je nutn‚ nastavit z kladn¡ stˆny" " a jin‚ dal¨¡ parametry pro tuto mapu","Pokra‡ujem","Zav©it",NULL); if (sel == 1) { newmap = 1; } } if (sel == 1) { create_menu(); redraw_window(); escape(); filename[0] = 0; close_current(); } } preskoc: free(background_file); } while (ask_exit_status == 1); ClearMapFiles(); redraw_desktop(); close_manager(); return 0; }