#include <stdio.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
int main(int argc, char* argv[])
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* window = SDL_CreateWindow("SDL Turtor 2", 100, 100, 800, 600, SDL_WINDOW_SHOWN);
SDL_Surface* surface_window = SDL_GetWindowSurface(window);
SDL_Surface* surface_test = SDL_LoadBMP("1.bmp");
SDL_BlitSurface(surface_test, NULL, surface_window, NULL);
SDL_UpdateWindowSurface(window);
SDL_Delay(3000);
SDL_FreeSurface(surface_test);
SDL_FreeSurface(surface_window);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
编译:
gcc -o test2 test2.c `pkg-config --libs --cflags sdl2`
离线