#include #include using namespace std; int main() { if (SDL_Init(SDL_INIT_EVERYTHING) != 0 ) { cout << "SDL_Init error\n"; return 1; } SDL_Window* window = SDL_CreateWindow("Hello World!", 100, 100, 640, 480, SDL_WINDOW_SHOWN); if (window == nullptr) { cout << "Window create error\n"; return 1; } SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED || SDL_RENDERER_PRESENTVSYNC); if (renderer == nullptr) { cout << "Renderer error\n"; return 1; } SDL_Surface* pic = SDL_LoadBMP("./hello.bmp"); if (pic == nullptr) { cout << "pic load error\n"; return 1; } SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, pic); SDL_FreeSurface(pic); if (texture == nullptr) { cout << "texture create error\n"; return 1; } SDL_RenderClear(renderer); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); SDL_Delay(3000); SDL_DestroyRenderer(renderer); SDL_DestroyTexture(texture); SDL_DestroyWindow(window); SDL_Quit; return 0; }