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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
   |  
void Moteur3D::initialiser_affichage_SDL()
{
 
    //===================
    // Initialiser la vidéo
    //===================
    if(SDL_Init(SDL_INIT_VIDEO)!=0)
    {
 printf("[ ERREUR  ]   Initialisation de la vidéo via SDL impossible.\n");
 SDL_Quit();
 exit(1);
    }
 
    //====================
    // Création de l'écran d'affichage
    //====================
    if(fullScreen==false)
    {
 ecran=SDL_SetVideoMode(resX,resY,nbBitParPixel,SDL_HWSURFACE);
    }
    else
    {
 ecran=SDL_SetVideoMode(resX,resY,nbBitParPixel,SDL_HWSURFACE|SDL_FULLSCREEN);
    }
 
    if(ecran==NULL)
    {
 SDL_Quit();
 printf("[ ERREUR  ]  La fenêtre n'a pas pu être créée.");
 SDL_Quit();
 exit(1);
    }
    else
    {
 printf("[    OK    ]  Création de la fenêtre %d x %d x %d\n",resX,resY,nbBitParPixel);
 // Donner un nom a la fenêtre
 SDL_WM_SetCaption("Mon Jeu","Mon Jeu"); 
    }  
    //=======================
    // Attributs SDL
    //=======================
    SDL_EnableKeyRepeat(1,1);  // Répétition des touches
    SDL_ShowCursor(SDL_ENABLE);  // Masquer le curseur de la souris
   // SDL_WM_GrabInput(SDL_GRAB_ON); // Autoriser la souris a dépasser les limites de l'écran
 
}
 
void Moteur3D::afficher_intro()
{
    SDL_Surface *surf_image1;
    SDL_Surface *surf_image2;
    SDL_Rect dest;
    SDL_Event event;
    float last_time = 0.0;
    float current_time=0.0;
 float temps;
    int compteur=1;
    bool encore=true;
    char * image1 = "images/titre.png";
    char * image2 = "images/titre_2.png";
 
    // Charger les images PNG en mémoire vidéo.
 
 
 
    surf_image1 = IMG_Load(image1);         //Ligne qui plabnte
    if ( surf_image1 == NULL ) 
    {
        printf("[  ERREUR  ] Le fichier %s est manquant",image1);
        SDL_Quit();
        exit(1);
    }
 
    surf_image2 = IMG_Load(image2);
    if ( surf_image2 == NULL ) 
    {
        printf("[  ERREUR  ] Le fichier %s est manquant",image2);
        SDL_Quit();
        exit(1);
    }
 
.
.
.
.
} | 
Partager