[英]c++ sdl window freeze and issues with sdl
SDL just pisses me off, please help. SDL惹恼了我,请帮助。 I'm trying just to show a window, this is the code :
我正试图显示一个窗口,这是代码:
#include <iostream>
#define SDL_MAIN_HANDLED
#include "SDL.h"
int main()
{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Window *window = SDL_CreateWindow("Game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 600, 480, SDL_WINDOW_SHOWN);
if (window == NULL)
return 1;
SDL_Event event;
bool running = true;
while (running) {
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
running = false;
break;
}
}
}
SDL_Quit();
std::cout << "Hello :)" << std::endl;
return 0;
}
Now, the issue is that it says that the program now responding and I have a "loading" icon for the mouse. 现在,问题在于它说该程序现在正在响应,并且鼠标有一个“正在加载”图标。 Second issue is that I cannot use SDL_INIT_EVERYTHING for some reason, it just gets stuck and nothing outputs when I try to output after init.
第二个问题是由于某种原因我不能使用SDL_INIT_EVERYTHING,当我尝试在init之后输出时,它只会卡住并且没有输出。 I tried multiple sdl files x86 , x64.
我尝试了多个sdl文件x86和x64。 I have windows 10 64bit OS.
我有Windows 10 64位操作系统。 I really start to lose my sanity here , please help.
我真的开始失去理智,请帮助。
EDIT : 编辑:
the window works perfectly fine with SDL_INIT_EVERYTHING but it takes the computer to load everything for 1 minute and 50 seconds. 该窗口可以与SDL_INIT_EVERYTHING完美配合,但是计算机需要花1分钟50秒来加载所有内容。 which is a lot of time.
这是很多时间。
But when I only init SDL_INIT_VIDEO , it's not responding. 但是,当我仅初始化SDL_INIT_VIDEO时,它没有响应。 Any solution ?
有什么办法吗?
Okay, so I have downloaded an older version 2.0.5 instead of the new "stable" version and seems like it works. 好的,所以我下载了一个较旧的版本2.0.5,而不是新的“稳定”版本,似乎可以正常工作。 I guess the new version just have bugs that needs to be fixed.
我猜新版本只是存在需要修复的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.