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
|
include <iostream>
#include <string>
#include <sdl/sdl_image.h>
#include <loadimage.h>
#include <SDL/SDL.h>
#include <applyimage.h>
SDL_Surface *screen = NULL;
SDL_Surface *blocks = NULL;
SDL_Rect clip [4];
clip[0].x = 0; //error here but for all clips
clip[0].y = 0;
clip[0].h = 50;
clip[0].w = 50
clip[1].x = 50;
clip[1].y = 50;
clip[1].h = 50;
clip[1].w = 50
clip[2].x = 100;
clip[2].y = 100;
clip[2].h = 50;
clip[2].w = 50
clip[3].x = 100;
clip[3].y = 200;
clip[3].h = 50;
clip[3].w = 50
int main ( int argc, char** argv )
{
SDL_Init(SDL_INIT_EVERYTHING);
screen = SDL_SetVideoMode (640,480,32,SDL_SWSURFACE);
blocks = SDL_LoadBMP ("cd.bmp");
apply_surface (10,10,blocks,screen, &clip[0]);
apply_surface (10,10,blocks,screen, &clip[1]);
apply_surface (10,10,blocks,screen, &clip[2]);
apply_surface (10,10,blocks,screen, &clip[3]);
SDL_Flip (screen);
SDL_Delay (2000);
return 0;
}
| |