1

从任何关于支持视网膜显示器的 SDL (2.0) 的 Google 搜索中,我都找不到任何有用的东西。谁能指出我正确的方向?

我正在使用这段代码:

//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();
4

1 回答 1

2
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”标志可以为您完成。

于 2016-11-20T16:57:09.237 回答