SDL 矩形未出现

SDL rect not appearing

我正在尝试让 SDL_Rect 以位图纹理出现在屏幕上。我运行这个程序,屏幕只是白色,没有图像。

#include "SDL.h"

int main(int argc, char** args) {

    SDL_Init(SDL_INIT_EVERYTHING);

    SDL_Window* window = NULL;
    
    window = SDL_CreateWindow("window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1280, 720, SDL_WINDOW_SHOWN);

    SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, 0);

    SDL_Surface* surface = SDL_LoadBMP("car.bmp");

    SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface);

    SDL_Rect rect;

    rect.x = 0;
    rect.y = 0;
    rect.w = 1280;
    rect.h = 720;

    SDL_RenderCopy(renderer, texture, NULL, &rect);

    SDL_Delay(2000);

    SDL_DestroyWindow(window);

    SDL_Quit();

    return 0;

}

我让它工作了,我只需要添加 SDL_RenderPresent()