我有这个奇怪的问题,SFML的sf::VideoMode::getFullscreenModes()
方法,它应该只返回有效的视频模式,实际上只返回无效的视频模式。
当我将启动配置更改为Release时,它可以正常工作。
#include <SFML/Window.hpp>
#include <iostream>
int main(int argCount, char** argVector) {
std::vector<sf::VideoMode> videoModes;
videoModes = sf::VideoMode::getFullscreenModes();
sf::VideoMode videoMode;
for(unsigned i = 0; i < videoModes.size(); i++) {
if(videoModes[i].isValid())
std::cout << "Vanlid VideoMode: " << i << " - " << videoModes[i].width << "x" << videoModes[i].height << " b" << videoModes[i].bitsPerPixel << std::endl;
else
std::cout << "Invalid VideoMode: " << i << " - " << videoModes[i].width << "x" << videoModes[i].height << " b" << videoModes[i].bitsPerPixel << std::endl;
}
char input[1];
std::cin >> input;
return 0;
}
控制台输出:
无效的VideoMode:0 - 3131961357x3131961357 b3131961357
无效的VideoMode:1 - 3131961357x3131961357 b3131961357
无效的VideoMode:2 - 3131961357x3131961357 b3131961357
无效的VideoMode:3 - 3131961357x3131961357 b3131961357
答案 0 :(得分:0)
答案与此问题相同: https://stackoverflow.com/a/17777615/2558778
您必须在调试模式下使用调试库,并在发布模式下使用发布库。将它们混合可能会导致崩溃。