// #include "bibx.c" #include "SDL/SDL.h" #include "graphicswin.h" SDL_Surface* affichage; void detectgraph (int *pdriver, int *pmode) { } void initSDL(void) { if (SDL_Init(SDL_INIT_VIDEO) < 0) { fprintf(stderr, "Erreur à l'initialisation de la SDL : %s\n", SDL_GetError()); exit(EXIT_FAILURE); } atexit(SDL_Quit); affichage = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE); if (affichage == NULL) { fprintf(stderr, "Impossible d'activer le mode graphique : %s\n", SDL_GetError()); exit(EXIT_FAILURE); } SDL_WM_SetCaption("Graphique SDL", NULL); } void initgraph (int *pdriver, int *pmode, char *s) { //graphic_init(); initSDL(); } int graphresult(void) { return grOk; } void setPixel(int x, int y, Uint32 coul) { *((Uint32*)(affichage->pixels) + x + y * affichage->w) = coul; //actualiser(); } void putpixel (int x, int y, int c) { //setcolor (c % 16); //point (x, y); setPixel(x,y,0x090909*c); } void attendreTouche(void) { SDL_Event event; do SDL_WaitEvent(&event); while (event.type != SDL_QUIT && event.type != SDL_KEYDOWN); } void actualiser(void) { SDL_UpdateRect(affichage, 0, 0, 0, 0); } void restorecrtmode(void) { actualiser(); attendreTouche(); }