Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Declarar librerias
- #include <SDL/SDL.h>
- int main() {
- //Inicilización
- SDL_Surface* hello = NULL;
- SDL_Surface* screen = NULL;
- SDL_Rect posicion_imagen;
- posicion_imagen.x = 50;
- posicion_imagen.y = 50;
- int i = 0;
- //Comenzar SDL
- SDL_Init( SDL_INIT_EVERYTHING );
- //Set up de variables
- hello = SDL_LoadBMP( "hello.bmp" );
- screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );
- while (true) {
- i++;
- posicion_imagen.x = posicion_imagen.x + 10;
- posicion_imagen.y = posicion_imagen.y + 10;
- SDL_BlitSurface( hello, NULL, screen, &posicion_imagen);
- SDL_Flip( screen );
- SDL_Delay( 10 );
- if ( i > 100 ) {
- SDL_FreeSurface( hello );
- SDL_Quit();
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment