SDL SDL_ListModes () Problem
-
Hey.
Und zwar ist das das Bsp. aus der SDL Dokumentation, und ich bekomme folgenden Laufzeitfehler :
Eine Ausnahme (erste Chance) bei 0x68129b02 in SDL test.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x00000134. Unbehandelte Ausnahme bei 0x68129b02 in SDL test.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x00000134. Das Programm "[4720] SDL test.exe: Systemeigen" wurde mit Code -1073741819 (0xc0000005) beendet.
Ich versteh nicht ganz, was falsch sein soll, da es ja das Bsp. aus der Doku ist.
Hoffe jemand hat ne Lösung.
#include <SDL.h> #include <iostream> using namespace std; int SDL_main(int argc, char **argv) { /* SDL_Surface *g_pBackBuffer = SDL_SetVideoMode( 800, 600, 16, SDL_HWSURFACE | SDL_DOUBLEBUF |SDL_FULLSCREEN ); if( 0 == g_pBackBuffer ) { SDL_Quit(); return 0; } */ SDL_Rect **modes; int i; /* Get available fullscreen/hardware modes */ modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); /* Check is there are any modes available */ if(modes == (SDL_Rect **)0){ printf("No modes available!\n"); exit(-1); } /* Check if or resolution is restricted */ if(modes == (SDL_Rect **)-1){ printf("All resolutions available.\n"); } else{ /* Print valid modes */ printf("Available Modes\n"); for(i=0 ; modes[i] ; ++i) printf(" %d x %d\n", modes[i]->w, modes[i]->h); } while (1) { //cout << "nur ein test" << endl; //SDL_Delay (1000); } SDL_Quit(); return 0; }
EDIT:
Peinlich, hab vergessen SLD zu Initialisieren
SDL_Init (SDL_INIT_VIDEO);
mfg
-
SDL_Init ?
-
Ist mir eben auch aufgefallen, aber thx