All pastes #182950 Raw Edit

Miscellany

public cpp v1 · immutable
#182950 ·published 2006-09-26 14:13 UTC
rendered paste body
void redrawImg(int frame_number, int x, int y, int delay = 75){  this->position.at(frame_number).x = x;  this->position.at(frame_number).y = y;        //Put the background on the old position of the frame in the grapicmemory  SDL_BlitSurface(this->background, &this->position.at(this->lastFrame), this->screen, &this->position.at(this->lastFrame));        //Put the new frame in the graphicmemory  SDL_BlitSurface(this->images.at(frame_number), NULL, screen, &this->position.at(frame_number));   //Update the Rect on the old position  SDL_UpdateRects(screen, 1, &this->position.at(this->lastFrame));  //Update the Rect on the new position  SDL_UpdateRects(screen, 1, &this->position.at(frame_number));       this->lastFrame = frame_number;        SDL_Delay(delay);              }void freeFall(int speed, int x = -1, int y = -1, int w = -1, int h = -1) {  SDL_Rect bufRect;  bufRect.x = x;  bufRect.y = this->position.at(lastFrame).y;     for(int n = 0; n < 50; n++) {    redrawImg(RUNLEFTSTART, bufRect.x, bufRect.y + n);    //bufRect.y += n;  }}