[Solved] SDL_GetVideoInfo: PixelFormat ausgeben



  • Hi

    Wollt mit "GetVideoInfo()" die Farbtiefe auslesen, doch die Testausgabe gibt nichts aus:

    SDL_Surface *display;
        cout << "Getting videoinfo...      ";
        const SDL_VideoInfo* video_info = SDL_GetVideoInfo();
        if( !video_info ) {
            cout << "[FAILED]\n" << SDL_GetError() << endl;
            cout << "Setting default...    ";
    //..
        }
        else {
            cout << "[  OK  ]" << endl;
            cout << "Resolution is " << video_info->current_w << "x" 
                 << video_info->current_h << " pixels\n";
            cout << "Colordepth is " << video_info->vfmt->BitsPerPixel << " bits\n";
    //..
    

    Ausgabe:

    Initializing SDL
    Initializing Video... [ OK ]
    Initializing Timer... [ OK ]
    Getting videoinfo... [ OK ]
    Resolution is 1280x1024 pixels
    Colordepth is bits

    Im Debugger beobachtet:

    video_info -> vfmt ->
    { "BitsPerPixel", "Uint8", "32 ' '" }

    😕

    Warum gibt er die 32 nicht aus?

    Danke im voraus für jegliche Art von Hilfe!



  • Für die die es interessiert:

    Ich musste nach int casten oder mit 1 multiplizieren, dann gings..

    cout << "Colordepth is " << video_info->vfmt->BitsPerPixel * 1 << " bits\n";
    

Anmelden zum Antworten