static void order(void) { void *f; char *text; int x, y; int size = 0; SDLTexture *restore = NULL; restore = render.createScreenTexture(); f = loadfile("pic\\order.pcx", &size); text = (char *)loadfile("stuff\\order1.txt", NULL); fadeout(FADE_PALETTE); render.clear(0, 0, 0); showpcx(f, 20, size); blue->print_c(XMAX/2, 0, "ORDER RAVAGE NOW"); x = 0; y = 30; beauty(tiny, x, y, text); unloadfile(text); fadein(NULL); input_wait(); input_fire(); input_wait(); fadeout(FADE_PALETTE); text = (char *)loadfile("stuff\\order2.txt", NULL); render.clear(0, 0, 0); showpcx(f, 20, size); blue->print_c(XMAX/2, 0, "HOW TO ORDER"); x = 0; y = 30; beauty(tiny, x, y, text); unloadfile(text); fadein(NULL); unloadfile(f); input_wait(); input_fire(); input_wait(); fadeout(FADE_PALETTE); render.drawTexture(restore, 0, 0); fadein(level.palette); restore->destroy(); delete restore; }
void st_general_setup(void) { /* Seed random number generator: */ srand(SDL_GetTicks()); /* Set icon image: */ seticon(); /* Unicode needed for input handling: */ SDL_EnableUNICODE(1); /* Load global images: */ #ifndef RES320X240 white_text = new Text(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18); #else white_text = new Text(datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9); fadeout(); #endif #ifndef RES320X240 black_text = new Text(datadir + "/images/status/letters-black.png", TEXT_TEXT, 16,18); #else black_text = new Text(datadir + "/images/status/letters-black-small.png", TEXT_TEXT, 8,9); #endif #ifndef RES320X240 gold_text = new Text(datadir + "/images/status/letters-gold.png", TEXT_TEXT, 16,18); #else gold_text = new Text(datadir + "/images/status/letters-gold-small.png", TEXT_TEXT, 8,9); #endif silver_text = new Text(datadir + "/images/status/letters-silver.png", TEXT_TEXT, 16,18); #ifndef RES320X240 blue_text = new Text(datadir + "/images/status/letters-blue.png", TEXT_TEXT, 16,18); #else blue_text = new Text(datadir + "/images/status/letters-blue-small.png", TEXT_TEXT, 8,9); #endif red_text = new Text(datadir + "/images/status/letters-red.png", TEXT_TEXT, 16,18); green_text = new Text(datadir + "/images/status/letters-green.png", TEXT_TEXT, 16,18); //white_text = new Text(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18); white_small_text = new Text(datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9); white_big_text = new Text(datadir + "/images/status/letters-white-big.png", TEXT_TEXT, 20,22); yellow_nums = new Text(datadir + "/images/status/numbers.png", TEXT_NUM, 32,32); /* Load GUI/menu images: */ checkbox = new Surface(datadir + "/images/status/checkbox.png", USE_ALPHA); checkbox_checked = new Surface(datadir + "/images/status/checkbox-checked.png", USE_ALPHA); back = new Surface(datadir + "/images/status/back.png", USE_ALPHA); arrow_left = new Surface(datadir + "/images/icons/left.png", USE_ALPHA); arrow_right = new Surface(datadir + "/images/icons/right.png", USE_ALPHA); /* Load the mouse-cursor */ mouse_cursor = new MouseCursor( datadir + "/images/status/mousecursor.png",1); MouseCursor::set_current(mouse_cursor); }
void check_contrib_menu() { int index = contrib_menu->check(); if (index == -1) return; if (index < (int)contrib_subsets.size()) { // FIXME: This shouln't be busy looping LevelSubset& subset = * (contrib_subsets[index]); current_contrib_subset = subset.name; contrib_subset_menu->clear(); contrib_subset_menu->additem(MN_LABEL, subset.title, 0,0); contrib_subset_menu->additem(MN_HL,"",0,0); for (int i = 0; i < subset.levels; ++i) { /** get level's title */ Level level; level.load(subset.name, i+1); contrib_subset_menu->additem(MN_ACTION, level.name, 0,0,i+1); } contrib_subset_menu->additem(MN_HL,"",0,0); contrib_subset_menu->additem(MN_BACK, "Back", 0, 0); } else if(index < worldmap_list.num_items + (int)contrib_subsets.size()) { // Loading fade fadeout(); emscripten_pause_main_loop(); delete worldmap; worldmap = new WorldMapNS::WorldMap(); worldmap->loadmap(worldmap_list.item[index - contrib_subsets.size()]); // worldmap.set_levels_as_solved(); static std::string savegame = worldmap_list.item[index - contrib_subsets.size()]; // remove .stwm... savegame = savegame.substr(0, savegame.size()-5); savegame = std::string(st_save_dir) + "/" + savegame + ".stsg"; std::cout << "SaveGameName: " << savegame << "\n"; worldmap->loadgame(savegame.c_str()); worldmap->display(); emscripten_set_main_loop(worldmap_loop, 100); emscripten_resume_main_loop(); //Menu::set_current(main_menu); } }
bool process_load_game_menu() { int slot = load_game_menu->check(); if(slot != -1 && load_game_menu->get_item_by_id(slot).kind == MN_ACTION) { char slotfile[1024]; snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot); emscripten_pause_main_loop(); if (access(slotfile, F_OK) != 0) { //draw_intro(); } fadeout(); if (!worldmap) { worldmap = new WorldMapNS::WorldMap(); //TODO: Define the circumstances under which BonusIsland is chosen //printf("pxx: %s, %s, %d\n", __FILE__, __FUNCTION__, __LINE__); worldmap->set_map_file("world1.stwm"); //printf("pxx: %s, %s, %d\n", __FILE__, __FUNCTION__, __LINE__); worldmap->load_map(); //printf("pxx: %s, %s, %d\n", __FILE__, __FUNCTION__, __LINE__); } // Load the game or at least set the savegame_file variable worldmap->loadgame(slotfile); //printf("pxx: %s, %s, %d\n", __FILE__, __FUNCTION__, __LINE__); worldmap->display(); //printf("pxx: %s, %s, %d\n", __FILE__, __FUNCTION__, __LINE__); emscripten_set_main_loop(worldmap_loop, 100); //printf("pxx: %s, %s, %d\n", __FILE__, __FUNCTION__, __LINE__); emscripten_resume_main_loop(); //Menu::set_current(main_menu); //st_pause_ticks_stop(); return true; } else { return false; } }
/*--------------------------------------------------------- Function: Description: Display Intro & Title screen. ---------------------------------------------------------*/ void title(void) { void *f; Font *tiny; char *text; int x, y; int size = 0; // Load needed font & picture. tiny = new Font("fonts\\tiny.fnt"); f = loadfile("pic\\title.pcx", &size); text = (char *) loadfile("stuff\\reg.txt", NULL); // Fade out and draw new screen. fadeout(FADE_PALETTE); showpcx(f, 20, size); // Print text. x = 0; y = 140; beauty(tiny, x, y, text); // Fade in fadein(NULL); //input_wait(); input_fire(); input_wait(); SDL_Delay(1500); fadeout(FADE_PALETTE); //render.clear(0, 0, 0); unloadfile(text); unloadfile(f); delete tiny; }
static void showpicture(char *file) { void *f; int size = 0; SDLTexture *restore; restore = render.createScreenTexture(); f = loadfile(file, &size); fadeout(FADE_PALETTE); render.clear(0, 0, 0); showpcx(f, 0, size); unloadfile(f); fadein(NULL); input_wait(); input_fire(); input_wait(); fadeout(FADE_PALETTE); render.drawTexture(restore, 0, 0); fadein(level.palette); restore->destroy(); delete restore; }
void Bullet::onRangeOut(){ switch (_bullet_outrange) { case BULLET_OUTRANGE_FADEOUT: break; case BULLET_OUTRANGE_NORMALBOMB: { NormalBombModel* model = NormalBombModelManager::getInstance()->getModelByID(_bullet_outrange_2); NormalBombFactory::create(getPosition(), *model,getPhysicsBody()->getContactTestBitmask(),getPhysicsBody()->getCollisionBitmask()); } break; case BULLET_OUTRANGE_SPLITBOMB: break; default: break; } fadeout(); }
void Bullet::onContact(Point contactPoint){ switch (_bullet_collision) { case BULLET_COLLISION_FADEOUT: break; case BULLET_COLLISION_NORMALBOMB: { NormalBombModel* model = NormalBombModelManager::getInstance()->getModelByID(_bullet_collision_2); NormalBombFactory::create(contactPoint, *model,getPhysicsBody()->getContactTestBitmask(),getPhysicsBody()->getCollisionBitmask()); } break; case BULLET_COLLISION_SPLITBOMB: { SplitBombModel* model = SplitBombModelManager::getInstance()->getModelByID(_bullet_outrange_2); SplitBombFactory::create(contactPoint, *model,getPhysicsBody()->getContactTestBitmask(),getPhysicsBody()->getCollisionBitmask()); } break; default: break; } fadeout(); }
static void shutmenu(void) { fadeout(FADE_ALL); s_unloadmod(); // Housekeeping. weapon_removeall(nowplayer); shutlevel(); shutgame(); playback_stop(); cheatlevel = cheatsave; // Restore Previous Saved Game State. gstate = gsave; player[nowplayer] = psave; player[1-nowplayer] = psave2; // release resources. unloadfile(yesno); sYesNo.destroy(); unloadfile(addsub); sAddSub.destroy(); delete tiny; delete blue; delete back; unloadfile(pointer); sPointer.destroy(); unloadfile(head); sHead.destroy(); demoTexture.destroy(); delete menuback; }
void show_hscore_list(char *name) { fadeout(50, 256); if(!name) { name = malloc(sizeof(char)); strcpy(name, " "); } FONT *fonte = (FONT*)fnt_datafile[COMICSANS].dat; BITMAP *high_score = (BITMAP*)img_datafile[HIGH_SCORE].dat; fadein(high_score, 10, 120); register int i; for(i = 1; i < 10; i++) { char score[5]; itoa(score_table[i-1].player_score, score, 10); if(!strcmp(score_table[i-1].player_name, name)) { char aux[11]; /// shorter variable strcpy(aux, score_table[i-1].player_name); aux[strlen(aux)-1] = '\0'; strcpy(score_table[i-1].player_name, aux); textout_ex(screen, fonte, score_table[i-1].player_name, 240, 50+(48*i), RED, -1); textout_ex(screen, fonte, score, 535, 50+(48*i), RED, -1); } else{ textout_ex(screen, fonte, score_table[i-1].player_name, 240, 50+(48*i), WHITE, -1); textout_ex(screen, fonte, score, 535, 50+(48*i), WHITE, -1); } } textout_ex(screen, font, "Press any key to exit", 320, SCREEN_H-50, WHITE, -1); while(!keypressed()); }
bool process_load_game_menu() { int slot = load_game_menu->check(); if(slot != -1 && load_game_menu->get_item_by_id(slot).kind == MN_ACTION) { char slotfile[1024]; snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot); if (access(slotfile, F_OK) != 0) { draw_intro(); } fadeout(); WorldMapNS::WorldMap worldmap; //TODO: Define the circumstances under which BonusIsland is chosen worldmap.set_map_file("world1.stwm"); worldmap.load_map(); // Load the game or at least set the savegame_file variable worldmap.loadgame(slotfile); worldmap.display(); Menu::set_current(main_menu); st_pause_ticks_stop(); return true; } else { return false; } }
int main(void) { DDRD = 255; DDRB |= (1<<0); DDRB |= (1<<1); DDRB |= (1<<2); DDRB |= (1<<3); DDRB &= ~(1<<4); DDRB &= ~(1<<5); PORTD = 0; PORTB &= ~(1<<0); PORTB &= ~(1<<1); PORTB &= ~(1<<2); PORTB &= ~(1<<3); PORTB &= ~(1<<4); PORTB &= ~(1<<5); int knop1,knop2,select=0,kleur=0,tijd=400,a,b,rgb[3]={1,2,4},c; while(1) { knop1 = PINB&(1<<in1); //==16 is hoog knop2 = PINB&(1<<in2); //==32 is hoog if ((knop1==16)&&(knop2==32)) { for (a=0;a<3;a+=1) { for (b=0;b<10;b+=1) { ledon (7,rgb[a]); waitms (50); dark(); waitms (50); } } for (b=0;b<10;b+=1) { for (a=0;a<3;a+=1) { ledon (7,rgb[a]); waitms (50); dark(); waitms (50); } } for (c=120;c>=0;c-=20) { ledon (1,1); waitms (c); dark(); ledon (2,2); waitms (c); dark(); ledon (3,4); waitms (c); dark(); ledon (4,1); waitms (c); dark(); ledon (1,2); waitms (c); dark(); ledon (2,4); waitms (c); dark(); ledon (3,1); waitms (c); dark(); ledon (4,2); waitms (c); dark(); ledon (1,4); waitms (c); dark(); ledon (2,1); waitms (c); dark(); ledon (3,2); waitms (c); dark(); ledon (4,4); waitms (c); dark(); } for (c=0;c<=120;c+=20) { ledon (1,1); waitms (c); dark(); ledon (2,2); waitms (c); dark(); ledon (3,4); waitms (c); dark(); ledon (4,1); waitms (c); dark(); ledon (1,2); waitms (c); dark(); ledon (2,4); waitms (c); dark(); ledon (3,1); waitms (c); dark(); ledon (4,2); waitms (c); dark(); ledon (1,4); waitms (c); dark(); ledon (2,1); waitms (c); dark(); ledon (3,2); waitms (c); dark(); ledon (4,4); waitms (c); dark(); } fadein (7,7,500); fadeout(7,7,500); dark(); } else if ((knop1==16)&&(knop2!=32)) { ledon (5,1); ledon (6,2); waitms (tijd); dark(); ledon (5,2); ledon (6,4); waitms (tijd); dark(); ledon (5,4); ledon (6,1); waitms (tijd); dark(); ledon (5,1); ledon (6,2); waitms (tijd); dark(); ledon (5,2); ledon (6,4); waitms (tijd); dark(); ledon (5,4); ledon (6,1); waitms (tijd); dark(); dark(); } else if ((knop1!=16)&&(knop2==32)) { for (kleur=1;kleur<8;kleur+=1) { fadein (7,kleur,700); fadeout(7,kleur,700); waitms(600); } dark(); } else { fadein (7,1,700); fadeout(7,1,700); waitms (600); dark(); } } }
int main(int argc, char **argv) { u32 cookie; FILE *exeFile = NULL; void *exeBuffer = (void *)EXECUTABLE_MEM_ADDR; u32 exeSize = 0; u32 exeEntryPointAddress = 0; entrypoint exeEntryPoint; __exception_setreload(0); IOS_ReloadIOS(58); /* int videomod */ InitVideo(); /* get imagedata */ u8 * imgdata = GetImageData(); fadein(imgdata); /* check devices */ SDCard_Init(); USBDevice_Init(); char cfgpath[256]; bool result = false; sprintf(cfgpath, "sd:/config/SaveGame_Manager_GX/SaveGame_Manager_GX.cfg"); result = cfg_parsefile(cfgpath, &cfg_set); if(!result) //no cfg-File on SD: try USB: { sprintf(cfgpath, "usb:config/SaveGame_Manager_GX/SaveGame_Manager_GX.cfg"); result = cfg_parsefile(cfgpath, &cfg_set); } if(result) { sprintf(cfgpath, "%sboot.dol", update_path); /* Open dol File and check exist */ exeFile = fopen (cfgpath, "rb"); if (exeFile==NULL) { sprintf(cfgpath, "%sboot.elf", update_path); exeFile = fopen (cfgpath,"rb"); } if (exeFile==NULL) result = false; else result = true; } if(!result) // non cfg-File loaded or update_path not set { /* Open dol File and check exist */ sprintf(cfgpath, "sd:/apps/SaveGame_Manager_GX/boot.dol"); exeFile = fopen (cfgpath ,"rb"); if (exeFile==NULL) { sprintf(cfgpath, "sd:/apps/SaveGame_Manager_GX/boot.elf"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "usb:/apps/SaveGame_Manager_GX/boot.dol"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "usb:/apps/SaveGame_Manager_GX/boot.elf"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "sd:/apps/SaveGameManagerGX/boot.dol"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "sd:/apps/SaveGameManagerGX/boot.elf"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "usb:/apps/SaveGameManagerGX/boot.dol"); exeFile = fopen (cfgpath ,"rb"); } if (exeFile==NULL) { sprintf(cfgpath, "usb:/apps/SaveGameManagerGX/boot.elf"); exeFile = fopen (cfgpath ,"rb"); } // if nothing found exiting if (exeFile==NULL) { fadeout(imgdata); fclose (exeFile); SDCard_deInit(); USBDevice_deInit(); StopGX(); free(imgdata); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } } fseek (exeFile, 0, SEEK_END); exeSize = ftell(exeFile); rewind (exeFile); if(fread (exeBuffer, 1, exeSize, exeFile) != exeSize) { fadeout(imgdata); fclose (exeFile); SDCard_deInit(); USBDevice_deInit(); StopGX(); free(imgdata); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } fclose (exeFile); /* load entry point */ struct __argv args; bzero(&args, sizeof(args)); args.argvMagic = ARGV_MAGIC; args.length = strlen(cfgpath) + 2; args.commandLine = (char*)malloc(args.length); if (!args.commandLine) SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); strcpy(args.commandLine, cfgpath); args.commandLine[args.length - 1] = '\0'; args.argc = 1; args.argv = &args.commandLine; args.endARGV = args.argv + 1; u8 * appboot_buff = (u8 *) malloc(app_booter_dol_size); if(!appboot_buff) { fadeout(imgdata); SDCard_deInit(); USBDevice_deInit(); StopGX(); free(imgdata); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } memcpy(appboot_buff, app_booter_dol, app_booter_dol_size); exeEntryPointAddress = load_dol_image(appboot_buff, &args); if(appboot_buff) free(appboot_buff); fadeout(imgdata); SDCard_deInit(); USBDevice_deInit(); StopGX(); free(imgdata); if (exeEntryPointAddress == 0) { SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } exeEntryPoint = (entrypoint) exeEntryPointAddress; /* cleaning up and load dol */ SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); _CPU_ISR_Disable (cookie); __exception_closeall (); exeEntryPoint (); _CPU_ISR_Restore (cookie); return 0; }
int main(int argc, char** argv) { int c = argc; int i; int j; WaveHeader input; //read header,check header and store header file readHeader(&input); checkHeader(&input); fprintf(stderr,"\nInput Wave Header Information\n\n"); printHeader(&input); short* channel1 = (short*)malloc(sizeof(short)*(input.dataChunk.size/4)); short* channel2 = (short*)malloc(sizeof(short)*(input.dataChunk.size/4)); if(channel1 == NULL || channel2 == NULL) { fprintf(stderr, "Program out of memory."); exit(1); } short* c1 = channel1; short* c2 = channel2; unsigned char a; unsigned char b; for(i = 0;i<input.dataChunk.size/4;i++) { //Checks to see if the file size matches the header's. if((a = getchar()) == EOF ||(b = getchar()) == EOF) { fprintf(stderr,"File size does not match size in header"); exit(1); } //Bit shift operation to convert the data from chars to shorts. c1[i] = (b << 8) | a; if((a = getchar()) == EOF ||(b = getchar()) == EOF) { fprintf(stderr,"File size does not match size in header"); exit(1); } c2[i] = (b << 8) | a; } //Reads in the commandline arguments stored in 'argv' i=1; //Store 'arguments' provided by the user. 'Arguments' are used to prevent using multiple descriptive variables. double arguement1,arguement2; while(i<c) { if(argv[i][0] =='-') { switch(argv[i][1]) { case'r': reverse(channel1, channel2,&input); break; case's': //converts the next thing stored in argv after 's' to an float to be passed as an argument. arguement1= atof(argv[++i]); //Gives an error message if the the speed specified by the user is invalid. if(arguement1<=0) { fprintf( stderr,"A positive number must be supplied for the speed change\n"); exit(1); } speed(&c1,&c2,c1,c2,&input,arguement1); break; case'f': flip(&c1,&c2); break; case'o': //converts the next thing stored in argv after 'o' to an float to be passed as an argument. arguement1 = atof(argv[++i]); if(arguement1<=0) { fprintf( stderr,"A positive number must be supplied for the fade in and fade out time\n"); exit(1); } fadeout(c1,c2,&input,arguement1); break; case'i': //converts the next thing stored in argv after 'i' to an float to be passed as an argument. arguement1 = atof(argv[++i]); //Gives an error message for invalid input. if(arguement1<=0) { fprintf( stderr,"A positive number must be supplied for the fade in and fade out time\n"); exit(1); } fadein(c1,c2,&input,arguement1); break; case'v': //converts the next thing stored in argv after 'v' to an float to be passed as an argument. arguement1 = atof(argv[++i]); //Gives an error message for invalid input. if(arguement1<=0) { fprintf( stderr,"A positive number must be supplied for the volume scale\n"); exit(1); } volume(c1,c2,&input,arguement1); break; case'e': //converts the next two things stored in argv after 'e' to an float to be passed as arguments. arguement1 = atof(argv[++i]); arguement2 = atof(argv[++i]); if(arguement1<=0 || arguement2<=0) { fprintf( stderr,"A positive number must be supplied for the echo delay and scale parameters\n"); exit(1); } echo(&c1,&c2,c1,c2,&input,arguement1,arguement2); break; default: //error message if the command is invalid. fprintf( stderr, "Usage: wave [[-r][-s factor][-f][-o delay][-i delay][-v scale][-e delay scale] < input > output"); exit(1); break; } } i++; } //Function call to write the wav file information. writeHeader(&input); //Converts shorts back into char data type so that the arguments are compatible with the putchar() function used to write the data. for(i=0;i<input.dataChunk.size/4;i++){ putchar((c1[i]) & 255); putchar((c1[i]>>8)); putchar((c2[i]) & 255); putchar((c2[i]>>8)); } fprintf(stderr,"Output Wave Header Information\n\n"); printHeader(&input); //Frees up the allocated memory. free(channel1); free(channel2); }
void frider (int select,int kleur,int tijd) //Select : 1=aan-links,2=uit-links,3=aan-rechts,4=uit-rechts,5=loop-links,6=loop-rechts,7=rider-links,8=rider-rechts Kleur : 1=blauw,2=groen,3=cyaan,4=rood,5=paars,6=geel,7=wit { switch (select) { case 1 : fadein (1,kleur,tijd); fadein (2,kleur,tijd); fadein (3,kleur,tijd); fadein (4,kleur,tijd); break; case 2 : fadeout(1,kleur,tijd); fadeout(2,kleur,tijd); fadeout(3,kleur,tijd); fadeout(4,kleur,tijd); break; case 3 : fadein (4,kleur,tijd); fadein (3,kleur,tijd); fadein (2,kleur,tijd); fadein (1,kleur,tijd); break; case 4 : fadeout(4,kleur,tijd); fadeout(3,kleur,tijd); fadeout(2,kleur,tijd); fadeout(1,kleur,tijd); break; case 5 : fadein (1,kleur,tijd); fadeout(1,kleur,tijd); fadein (2,kleur,tijd); fadeout(2,kleur,tijd); fadein (3,kleur,tijd); fadeout(3,kleur,tijd); fadein (4,kleur,tijd); fadeout(4,kleur,tijd); break; case 6 : fadein (4,kleur,tijd); fadeout(4,kleur,tijd); fadein (3,kleur,tijd); fadeout(3,kleur,tijd); fadein (2,kleur,tijd); fadeout(2,kleur,tijd); fadein (1,kleur,tijd); fadeout(1,kleur,tijd); break; case 7 : fadein (1,kleur,tijd); fadein (2,kleur,tijd); fadein (3,kleur,tijd); fadein (4,kleur,tijd); fadeout(1,kleur,tijd); fadeout(2,kleur,tijd); fadeout(3,kleur,tijd); fadeout(4,kleur,tijd); break; case 8 : fadein (4,kleur,tijd); fadein (3,kleur,tijd); fadein (2,kleur,tijd); fadein (1,kleur,tijd); fadeout(4,kleur,tijd); fadeout(3,kleur,tijd); fadeout(2,kleur,tijd); fadeout(1,kleur,tijd); break; default: return; break; } }
//================================== // 函数:graphicRender() // 目的:图像渲染 // void graphicRender() { static float echoalpha = 0,backgroundalpha = 0,rolealpha = 0; static int mbi=0; if(moveback) { if(qpass) { mbi = mbcount; qpass = false; } else mbi++; backPic.move(mbxstep,mbystep); if(mbi==(int)mbcount) { mbi=0; moveback=false; } } if(backPicOn) { if(stop==3) //背景淡入状态 { if(qpass) { backgroundalpha = 255; qpass = false; } backPic.draw(backgroundalpha); if(fadein(backgroundalpha,backfadestep)) stop = 0; } else if(stop==-3) //背景淡出状态 { if(qpass) { backgroundalpha = 0; qpass = false; } backPic.draw(backgroundalpha); if(fadeout(backgroundalpha,backfadestep)) { backPicOn = false; echoalpha=0; rolealpha=0; mbi=0; moveback=false; stop = 0; } } else if(stop==4) //背景转换状态 { if(qpass) { backgroundalpha = 0; qpass = false; } backPic.draw(backgroundalpha); if(fadeout(backgroundalpha,backfadestep)) { backgroundalpha = 255; echoalpha=0; stop = 0; } } else backPic.draw(); } //====================================================== if(stop==5) //role淡入状态 { if(qpass) { rolealpha = 255; qpass = false; } if(rolePicOn) rolePic.draw(rolealpha); if(rolePic2On) rolePic2.draw(rolealpha); if(fadein(rolealpha)) stop = 0; //变为读取指令状态 } else if(stop==-5) //role淡出状态 { if(qpass) { rolealpha = 0; qpass = false; } if(rolePicOn) rolePic.draw(rolealpha); else { rolealpha=0; stop=0; } if(rolePic2On) rolePic2.draw(rolealpha); if(fadeout(rolealpha)) { rolePicOn = false; rolePic2On = false; stop = 0; //变为读取指令状态 } } else if(stop==6) //role转换状态 { if(qpass) { rolealpha = 0; qpass = false; } if(rolePicOn) rolePic.draw(rolealpha); if(rolePic2On) rolePic2.draw(rolealpha); if(fadeout(rolealpha)) { rolealpha = 255; stop = 0; } } else if(stop==-7) //role数量减少 { if(qpass) { rolealpha = 0; qpass = false; } roletemp.draw(255-rolealpha); rolePic.draw(rolealpha); rolePic2.draw(rolealpha); if(fadeout(rolealpha)) { changeImg(&rolePic,&roletemp); rolePic2On = false; rolealpha = 255; stop = 0; //变为读取指令状态 } } else if(stop==7) //role数量增多 { if(qpass) { rolealpha = 0; qpass = false; } rolePic.draw(rolealpha); rolePic2.draw(255-rolealpha); roletemp.draw(255-rolealpha); if(fadeout(rolealpha)) { changeImg(&rolePic,&roletemp); rolealpha = 255; stop = 0; //变为读取指令状态 } } else //常规状态 { if(rolePicOn) rolePic.draw(); if(rolePic2On) rolePic2.draw(); } //====================================================== if(stop==2) //echo淡入状态 { if(qpass) { echoalpha = 255; qpass = false; } if(echoOn) { echoPic.draw(echoalpha); if(fadein(echoalpha)) { stop=1; //变为等待按键状态 } } } else if(stop==-2) //echo淡出状态 { if(qpass) { echoalpha = 0; qpass = false; } if(echoOn) { echoPic.draw(echoalpha); if(fadeout(echoalpha)) { echoOn = false; stop=0; //变为读取指令状态 } } else { echoalpha=0; stop=0; } } else { if(echoOn) echoPic.draw(); } if(rolenamePicOn&&(stop!=2&&stop!=-2)) rolenamePic.draw(); }
int main(){ //variaveis que tem alguma coisa a ver com o jogados, como exp recebida e level int game_status = 0, option = 0, school = 0; //--------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------- //Variaveis internas relacionadas as bibliotecas usadas e erros do jogo em si. int status_allegro = 0, tecla = 0; //A variavel teclado tem 5 estados /* 0 - Neutro 1 - Tecla para cima 2 - Tecla para Baixo 3 - Tecla para Direita 4 - Tecla para Esquerda */ //iniciando o Allegro e todos as suas bibliotecas e funções usadas. al_init(); al_init_image_addon(); al_init_font_addon(); al_init_ttf_addon(); al_install_keyboard(); //Iniciando o jogo. display = al_create_display(SCREEN_W, SCREEN_H); background = al_load_bitmap("img/background.jpg"); start_menu_img = al_load_bitmap("img/start_screen.jpg"); font_text = al_load_font("font/font.ttf", 50, 0); timer = al_create_timer(0.1); tcont = al_create_timer(1.0); sections_event = al_create_event_queue(); al_set_window_title(display, "M.I.P. - Matemática, Português e Inglês"); al_start_timer(timer); al_start_timer(tcont); //Qualquer valor que seja colocado apos a imagem, ira interferir na sua posição em relação a tela. fadeout(7, SCREEN_W, SCREEN_H, display); al_draw_bitmap(background, 0,0,0); al_flip_display(); //Verificando erros no allegro e suas bibliotecas. status_allegro = check_allegro(background, start_menu_img, sections_event, display, font_text, timer, tcont); if(status_allegro == -1){ close_game(background, start_menu_img, sections_event, display, timer, tcont); return 0; } al_register_event_source(sections_event, al_get_keyboard_event_source()); al_register_event_source(sections_event, al_get_display_event_source(display)); //--------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------- //menu_background(); fadeout(1, SCREEN_W, SCREEN_H, display); al_draw_bitmap(start_menu_img, 0,0,0); printf("Menu Principal\n"); //capture_event(); al_flip_display(); al_draw_textf(font_text, al_map_rgb(0, 255, 255), SCREEN_H / 4, SCREEN_W / 4, ALLEGRO_ALIGN_LEFT, "Novo Jogo"); al_draw_textf(font_text, al_map_rgb(0, 255, 255), SCREEN_H / (3.7), SCREEN_W / 3, ALLEGRO_ALIGN_LEFT, "Continuar"); al_draw_textf(font_text, al_map_rgb(0, 255, 255), SCREEN_H / (3.4), SCREEN_W / (2.5), ALLEGRO_ALIGN_LEFT, "Sair do jogo"); al_flip_display(); option = capture_event_queue(SCREEN_H, SCREEN_W, keyboard, display, sections_event, tecla, font_text); if(option == -1){ close_game(background, start_menu_img, sections_event, display, timer, tcont); return 0; } switch(option){ case 0: game_start(); printf("game_start\n"); break; case 1: game_load(); printf("game_load\n"); break; case 2: printf("Finalizando Jogo\n"); close_game(background, start_menu_img, sections_event, display, timer, tcont); return 0; break; } //--------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------- //Apos a escolha entre continuar ou começar novamente o usuário estará na tela de seleção de escolas printf("Selecione a escola\n"); scanf("%d", &school); switch(school){ case 0: open_math(); break; case 1: open_ing(); break; case 2: open_port(); break; } //--------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------- return 0; }
void SplitBomb::onRangeOut(){ fadeout(); }