使用SDL支持Retina显示屏

时间:2013-07-29 08:07:43

标签: c sdl retina-display

我无法从谷歌搜索中找到任何关于支持视网膜显示的SDL(2.0)的有用信息。有人能指出我正确的方向吗?

我正在使用此代码:

//Start SDL
    SDL_Init(SDL_INIT_EVERYTHING);
    SDL_Window *screen = NULL;
    SDL_Renderer *render = NULL;
    SDL_Texture *texture = NULL;
    SDL_Event e;
    bool quit = false;
    screen = SDL_CreateWindow("Sample Image",100,100,500,500,SDL_WINDOW_SHOWN);
    render = SDL_CreateRenderer(screen,-1,SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
    texture = IMG_LoadTexture(render,"image.bmp");
    if (texture == NULL)
    {
        printf("%s",IMG_GetError());
    }
    //Render all graphics
    SDL_RenderClear(render);
    SDL_RenderCopy(render,texture,NULL,NULL);
    SDL_RenderPresent(render);
    while (quit == false) {
        while (SDL_PollEvent(&e)) {
            if (e.type == SDL_QUIT)
                quit = true;
        }
    }
    //Remove all graphics from memory
    SDL_DestroyRenderer(render);
    SDL_DestroyTexture(texture);
    SDL_DestroyWindow(screen);
    //Quit SDL
    SDL_Quit();

1 个答案:

答案 0 :(得分:1)

SDL_Window* win = SDL_CreateWindow("test",
    SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 600, 480,
    SDL_WINDOW_RESIZABLE|SDL_WINDOW_OPENGL|SDL_WINDOW_ALLOW_HIGHDPI);

" SDL_WINDOW_ALLOW_HIGHDPI"国旗可以为你做。