/* gyv by kestaz v.0.1 */ /* for any bugs: kestas111@yahoo.com */ #include #include #include #include #include using namespace std; int draw(SDL_Surface * image, SDL_Surface *source_src, int x, int y, int x1, int y1); SDL_Surface * load(SDL_Surface * image, string s); struct node { int x, y; }; vector make(vector & t, int x, int y) { vector p; node r; r.x = x; r.y = y; int unsigned i=0; p.push_back(r); // first element for (i=0; i < t.size()-1;i++) p.push_back(t[i]); t.clear(); for (i=0; i < p.size(); i++) t.push_back(p[i]); return t; } int main() { int m=20, n=15; int i,j; int x_pradzia=0, y_pradzia=0; int x1, y1; int unsigned k=0; vector g; node p; vector > matrix; srand(time(0)); x1 = rand() % 12+1; y1 = rand() % 13+1; int x=0,y=0; matrix.resize(m); for (i=0;i < m; i++) for (j=0; jw; src.h = image->h; dst.x = x; dst.y = y; dst.w = image->w; dst.h = image->h; SDL_BlitSurface(image, &src, source_src, &dst); return 0; } SDL_Surface * load(SDL_Surface * image, string s) { SDL_Surface *tmp; tmp = SDL_LoadBMP(s.c_str()); if (tmp == NULL) exit(0); image = SDL_DisplayFormat(tmp); SDL_FreeSurface(tmp); if (image !=NULL) { Uint32 colorkey = SDL_MapRGB(image->format, 0xFF,0xFF,0xFF); SDL_SetColorKey( image, SDL_RLEACCEL | SDL_SRCCOLORKEY, colorkey ); } return image; }