0

我有一个奇怪的问题,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;
}

Console Output:
Invalid VideoMode: 0 - 3131961357x3131961357 b3131961357
Invalid VideoMode: 1 - 3131961357x3131961357 b3131961357
Invalid VideoMode: 2 - 3131961357x3131961357 b3131961357
Invalid VideoMode: 3 - 3131961357x3131961357 b3131961357

4

1 回答 1

0

答案与此问题相同: https ://stackoverflow.com/a/17777615/2558778

您必须在调试模式下使用调试库,在发布模式下使用发布库。将它们混合在一起可能会导致崩溃。

于 2013-07-22T18:46:56.857 回答