0

sf::VideoMode::getFullscreenModes()有効なビデオ モードのみを返すはずの SFML のメソッドが、実際には無効なビデオ モードしか返さないという奇妙な問題があります。

起動構成を 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