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