1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
int main(int argc, char* args[])
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_WM_SetCaption("Acid", NULL);
ball = IMG_Load("Ball.png");
back = IMG_Load("syre.png");
awe = IMG_Load("awesome.png");
pink = IMG_Load("BallPink.png");
Uint8 *key;
key = SDL_GetKeyState( NULL);
SDL_Event event;
bool quit = false;
while (quit == false){
while( SDL_PollEvent(&event) )
{
if(event.type == SDL_QUIT || key[SDLK_ESCAPE])
{
SDL_Quit;
quit = true;
return 1;
}
}
screenprint();
}
return 0;
}
void screenprint()
{
b1dir = getdir(b1x, b1y, b1dir);
b2dir = getdir(b2x, b2y, b2dir);
b3dir = getdir(b3x, b3y, b3dir);
b1x = getx(b1x, b1dir);
b1y = gety(b1y, b1dir);
b2x = getx(b2x, b2dir);
b2y = gety(b2y, b2dir);
b3x = getx(b3x, b3dir);
b3y = gety(b3y, b3dir);
offset1.x = b1x;
offset1.y = b1y;
offset2.x = b2x;
offset2.y = b2y;
offset3.x = b3x;
offset3.y = b3y;
buffer = SDL_SetVideoMode(640, 480, 32, SDL_FULLSCREEN );
SDL_BlitSurface(back, NULL, buffer, NULL);
SDL_BlitSurface(ball, NULL, buffer, &offset1 );
SDL_BlitSurface(pink, NULL, buffer, &offset3);
SDL_BlitSurface(awe, NULL, buffer, &offset2 );
SDL_Flip(buffer);
SDL_FreeSurface(buffer);
| |