You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
873 B
C++

#include "SDL.h"
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define SCREEN_DEPTH 16
int main(int argc, char *argv[]) {
SDL_Surface *screen;
SDL_Surface *bmp;
SDL_Rect targetarea;
/* Initialize SDL */
SDL_Init(SDL_INIT_VIDEO);
/* Initialize the screen / window */
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_DEPTH, SDL_SWSURFACE);
/* Load test.bmp */
bmp = SDL_LoadBMP("big_eyes.bmp");
int x = 0;
while(1)
{
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
/* Draw the image to 10, 20 */
targetarea.x = x;
targetarea.y = 20;
targetarea.w = bmp->w;
targetarea.h = bmp->h;
x++;
x%=160;
SDL_BlitSurface(bmp, NULL, screen, &targetarea);
/* update the screen (aka double buffering) */
SDL_Flip(screen);
}
}