Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I execute the following code, the app can going to finish. but SDL background window is not visible. It is shadow screen only. SDL1.2.15 used.

#include <SDL/SDL.h>
#include <iostream>

using namespace std;

int main(int argc, char* args[])
{
    //声明表面
    SDL_Surface* hello = NULL;
    SDL_Surface* screen = NULL;

    //启动SDL
    int ret = SDL_Init(SDL_INIT_VIDEO);



//设置窗口
    screen = SDL_SetVideoMode(1366, 768, 0, SDL_SWSURFACE);
    if (!screen)
        cout << SDL_GetError() << endl;

    SDL_WM_SetCaption("Window Test", NULL);

    //加载图像
    hello = SDL_LoadBMP( "hello.bmp" );
    if (!hello)
        cout << SDL_GetError() << endl;

    //将图像应用到窗口上
    SDL_BlitSurface(hello, NULL, screen, NULL);

    //更新窗口
    SDL_Flip(screen);

    //释放已加载的图像
    SDL_FreeSurface(hello);

    //暂停
    SDL_Delay(4000);

    //退出SDL
    SDL_Quit();

    return 0;
}

What's happened? Help!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.