#include <stdio.h> #include <stdlib.h> #include <SDL.h>
void sdlon();//Carga SDL al sistema y coloca la superficie principal. void hall(); SDL_Surface *intro, *screen, *sign, *jugador1; SDL_Rect intror, signr, jugador1r; SDL_Event event, inicio; int done = 0; int inicioi; bool stop = false;
int main(int argc, char *argv[]) {
sdlon();
hall();
SDL_Flip(screen); // liberar superficie SDL_FreeSurface(intro); // Esperamos la pulsación de una tecla para salir
while(done == 0) { while ( SDL_PollEvent(&event) ) { if ( event.type == SDL_KEYUP )
done = 1;
} }
return 0;
} //////////////////////////////////////// void hall() { inicioi = 1; int step = 0; intro = SDL_LoadBMP("Inicio.bmp"); sign = SDL_LoadBMP("Intro.bmp"); jugador1 = SDL_LoadBMP("Jugador1.bmp"); if ( intro == NULL ) { printf("No pude cargar gráfico: %s\n", SDL_GetError()); exit(1); } if(sign == NULL) { printf("Error: Sign button%s\n", SDL_GetError()); exit(1); } intror.x = 211; intror.y = 166; intror.w = intro->w; intror.h = intro->h;
signr.x = 411; signr.y = 600; signr.w = sign->w; signr.h = sign->h;
jugador1r.x = 100; jugador1r.y = 100; jugador1r.w = jugador1->w; jugador1r.h = jugador1->h; SDL_SetColorKey(jugador1, SDL_SRCCOLORKEY|SDL_RLEACCEL, SDL_MapRGB(jugador1->format, 0, 0, 0)); SDL_SetColorKey(sign,SDL_SRCCOLORKEY|SDL_RLEACCEL,SDL_MapRGB(sign->format,0,0,0));
Uint8 *enter; enter = SDL_GetKeyState(NULL); SDL_BlitSurface(intro, NULL, screen, &intror); SDL_BlitSurface(sign, NULL, screen, &signr); SDL_Flip(screen); while(inicioi == 0) { while ( SDL_PollEvent(&inicio) ) { if ( event.type == SDL_KEYDOWN ){
step = step + 1; } } if(step == 1) { SDL_BlitSurface(jugador1, NULL, screen, &jugador1r); inicioi = 0; } }
}
void sdlon() { if (SDL_Init(SDL_INIT_VIDEO) < 0) { printf("No se pudo iniciar SDL: %s\n",SDL_GetError()); exit(1); } // Activamos modo de video screen = SDL_SetVideoMode(1022,710,24,SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN); if (screen == NULL) { screen = SDL_SetVideoMode(1022,710,24,SDL_HWSURFACE | SDL_DOUBLEBUF); } }
|