C++ > Bug avec SDL_LoadBMP

TitreBug avec SDL_LoadBMP
Postée le01-02-2009
Affichée1267
Mini-lien
Description

Avec ce code, s->format->BytesPerPixel vaut tjrs 1

EtatContient des erreurs. Contient des erreurs.
Code d'insertion
Options
Afficher les numéros de lignes  Mettre la source en plein ecran  Selectionner la source  Partager sur Facebook 
Téléchargement Telecharger en format txt  Telecharger en format pdf  Telecharger en format cpp
Plein ecran
#include <iostream>
#include <SDL/SDL.h>

int main(int argc, char* argv[])
{
        if(SDL_Init(SDL_INIT_VIDEO) < 0)
                std::cerr << "Error while initialising SDL : " << SDL_GetError() << std::endl;

        if(SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE) == NULL)
                std::cerr << "Error while initialising SDL : " << SDL_GetError() << std::endl;


        SDL_Surface *s = IMG_Load("../../gfx/chipset.bmp");
        printf("s : %d\n", s->format->BytesPerPixel);

        return 0;
}

// Compilation :
// g++ -Wall -pedantic main.cpp -o test -lSDLmain -lSDL -lSDL_image