add source code
This commit is contained in:
32
main.c
Normal file
32
main.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <SDL2/SDL_error.h>
|
||||
#include <SDL2/SDL_timer.h>
|
||||
#include <SDL2/SDL_video.h>
|
||||
#include <stdio.h>
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#undef main
|
||||
int main()
|
||||
{
|
||||
SDL_Window *window = NULL; // SDL窗口指针
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
|
||||
window = SDL_CreateWindow("Hello SDL Window",
|
||||
SDL_WINDOWPOS_UNDEFINED, // 不定义,让系统决定
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
640, // 宽
|
||||
480, // 高
|
||||
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
|
||||
|
||||
if (!window) {
|
||||
printf("SDL_CreateWindow() failed, err: %s\n", SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_Delay(10000); // 延迟10000ms
|
||||
|
||||
SDL_DestroyWindow(window); // 销毁窗口
|
||||
|
||||
SDL_Quit(); // 释放资源
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user