我下载了Visual Studio并设置了SDL,并且正在初始化且没有错误。我试图创建一个窗口
#include "stdafx.h"
#include <iostream>
#include <SDL.h>
int main(int argc, char *argv[]) {
SDL_Window *window;
//Initializing SDL
SDL_Init(SDL_INIT_EVERYTHING);
window = SDL_CreateWindow(
"Name",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
800,
600,
SDL_WINDOW_SHOWN
);
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, 0);
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);
if (window == NULL) {
std::cout<<(SDL_GetError());
return 1;
}
SDL_Delay(3000);
SDL_DestroyWindow(window);
SDL_Quit();
}
对于我来说,该窗口只是没有显示,我知道它可能会快速闪烁,但是根据我的阅读,SDL_Delay应该将其保持几秒钟。我尝试将传递给它的值从3000更改为30000,但没有更改。