int main(int argc, char **argv) { if ((IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0))) { if ((GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0))) { if ((LayersBase = OpenLibrary("layers.library", 0))) { if ((DOSBase = (struct DosLibrary *) OpenLibrary("dos.library",0))) { if ((screen = openscreen())) { doall(); closescreen(screen); } CloseLibrary((struct Library *)DOSBase); } CloseLibrary(LayersBase); } CloseLibrary((struct Library *)GfxBase); } CloseLibrary((struct Library *) IntuitionBase); } return 0; } /* main */
int main(int argc, char **argv) { /* Intialize debugging */ SDInit(); if ((IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0))) { if ((GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0))) { if ((DOSBase = (struct DosLibrary *) OpenLibrary("dos.library",0))) { struct Screen *screen; struct Window *w1; if ((screen = openscreen())) { w1 = openwindow(screen, "Window 1", W1_LEFT, W1_TOP, W1_WIDTH, W1_HEIGHT); if (w1) { #ifdef USE_TWO_WINDOWS struct Window *w2; w2 = openwindow(screen, "Window 2", W2_LEFT, W2_TOP, W2_WIDTH, W2_HEIGHT); if (w2) { #endif /* Wait forever */ // test_readpixel(w1); /* SetAPen(w1->RPort, 3); SetBPen(w1->RPort, 4); test_blttemplate(w1); */ test_linedrawing(w1, w2); /* handleevents(w1, 0);*/ #ifdef USE_TWO_WINDOWS CloseWindow(w2); } #endif CloseWindow(w1); } CloseScreen(screen); } CloseLibrary((struct Library *)DOSBase); } CloseLibrary((struct Library *)GfxBase); } CloseLibrary((struct Library *) IntuitionBase); } return 0; } /* main */
void pingpong_score() { if(for_scoring==2) count2++; else if(for_scoring==1) count1++; textprintf(screen,font,60,2,makecol(255,255,255), "P1=%d", count1); textprintf(screen,font,540,2,makecol(255,255,255), "P2=%d", count2); if(count1==5 || count2==5) { declare_winner(); stop_sample(samSong); openscreen(); } startNew(); }
void movemissile() { samExplosion2 = load_sample("C:\\Sanchit\\Game Pack\\Sprites\\explosion2.wav"); int x = points[curpoint].x ; int y = points[curpoint].y ; scare_mouse(); rectfill(buffer,x-6,y-3,x+6,y+1,BLACK); if (getpixel(screen,x,y) == GREEN) { destroyed++; updatescore(); rectfill(buffer, 2, 14, 636, 352, BLACK); } else { putpixel(buffer,x,y-3,SMOKE); circlefill(buffer,x,y,2,BLUE); } unscare_mouse(); curpoint++; if (curpoint >= totalpoints) { play_sample(samExplosion2, 128, 128, 1000, 0); destroyed++; explosion2(screen, x, y, BLACK); textout_ex( screen, font, "Game Over", 300, 230, makecol( 255, 0, 0), makecol( 0, 0, 0)); rest(2000); textprintf(screen,font,300,245,makecol(255,255,255), "Final Score=%d", score); rest(2000); stop_sample(samSong); stop_sample(samExplosion2); score=-1; openscreen(); } }
int pingpong() { buffer = create_bitmap( 640, 480); BITMAP *BGpong = load_bitmap("C:\\Sanchit\\Game Pack\\Sprites\\BGpong.bmp", NULL); samSong = load_sample("C:\\Sanchit\\Game Pack\\Sprites\\pingpong.wav"); play_sample(samSong, 128, 128, 1000, 1); setupGame(); while( !key[KEY_ESC]) { draw_sprite(buffer, BGpong, 0,0); textprintf(buffer,font,60,2,makecol(255,255,255), "P1=%d", count1); textprintf(buffer,font,540,2,makecol(255,255,255), "P2=%d", count2); p1Move(); p2Move(); moveBall(); checkWin(); if(scored==1) pingpong_score(); if(key[KEY_BACKSPACE]) { count1=0; count2=0; ball_x=320; ball_y=240; p1_x = 20; p1_y = 210; p2_x = 620; p2_y = 210; stop_sample(samSong); openscreen(); } } return 0; }
int savecity() { buffer = create_bitmap(640,480); samSong = load_sample("C:\\Sanchit\\Game Pack\\Sprites\\savecity.wav"); samExplosion1 = load_sample("C:\\Sanchit\\Game Pack\\Sprites\\explosion1.wav"); textout(buffer,font,"Save City (ESC to quit)",0,1,WHITE); updatescore(); // rect(buffer, 0, 12, SCREEN_W-2, SCREEN_H-2, RED); city = load_bitmap("C:\\Sanchit\\Game Pack\\Sprites\\city.bmp", NULL); for (n = 0; n < 5; n++) masked_blit(city, buffer, 0, 0, 20+n*120, SCREEN_H-city->h-2, city->w, city->h); crosshair = load_bitmap("C:\\Sanchit\\Game Pack\\Sprites\\crosshair.bmp", NULL); set_mouse_sprite(crosshair); set_mouse_sprite_focus(15,15); show_mouse(buffer); play_sample(samSong, 128, 128, 1000, 1); while (!key[KEY_ESC]) { //above the red was border get destroyed rect(buffer, 0, 12, SCREEN_W-2, SCREEN_H-2, RED); mx = mouse_x; my = mouse_y; mb = (mouse_b & 1); if (destroyed) firenewmissile(); if (mb) { explosion1(screen,mx,my,GREEN); play_sample(samExplosion1, 40, 128, 1000, 0); } movemissile(); blit(buffer,screen,0,0,0,0,640,480); if(key[KEY_BACKSPACE]) { score=-1; firenewmissile(); stop_sample(samSong); openscreen(); } if(key[KEY_ESC]) { exit(1); } if(score>=0 && score <5) rest(10); else if(score>=5 && score<10) rest(9); else if(score>=10 && score<15) rest(8); else if(score>=15 && score<20) rest(7); else if(score>=20 && score<25) rest(6); else if(score>=25 && score<30) rest(5); else if(score>=30 && score<35) rest(4); else if(score>=35 && score<40) rest(3); else if(score>=40 && score<45) rest(2); else if(score>=45) rest(1); } set_mouse_sprite(NULL); destroy_bitmap(city); destroy_bitmap(crosshair); // openscreen(); return 0; }