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 50 51 52 53 54 55 56 57 58 59
|
/* variable globales : pas joli, mais, c'est dans le cahier des charges :( */
SDL_Surface * fond, * cafetiere, *tasse, * bouton, * resistance, *resistance_chaude;
signed short Init_Cafetiere()
{
/* initialisation SDL */
SDL_Rect dstrect; /* servira à placer les éléments */
// initialize SDL video
if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
printf( "Unable to init SDL: %s\n", SDL_GetError() );
return 2;
}
// make sure SDL cleans up before exit
atexit(SDL_Quit);
/* initialisation de l'image de la cafetiere */
cafetiere = IMG_Load("Photos/Cafetiere_Vide.jpg");
if (!cafetiere)
{
printf("Incapable d'ouvrir l'image Photos/Cafetiere_Vide.jpg : %s\n", SDL_GetError());
return 3;
}
/* initialisation du fond */
fond = SDL_SetVideoMode(cafetiere->w, cafetiere->h, 32,SDL_HWSURFACE|SDL_DOUBLEBUF); /* écran au format de l'image */
if ( !fond )
{
printf("Unable to set %dx%d video: %s\n",cafetiere->w, cafetiere->h, SDL_GetError());
return 4;
}
}
signed short Simu_Cafetiere()
{ /* gestion de boucle evenement */
int test=1;
signed short continuer=1, bp_ma=0;
SDL_Event event;
signed short x,y;
SDL_Rect dstrect; /* servira à placer les éléments */
SDL_Surface * niveau; /* T° et niveau d'eau */
/* préparation de la cafetière vierge */
dstrect.x=0;
dstrect.y=0;
SDL_BlitSurface(fond, 0, cafetiere, &dstrect);
SDL_Flip(fond);
} |
Partager