SFML community forums

Help => Window => Topic started by: BlueCobold on November 21, 2014, 10:36:36 am

Title: [iOS] RenderWindow turns 90° when using style-flags in constructor
Post by: BlueCobold on November 21, 2014, 10:36:36 am
Hi.
When using style flags in a RenderWindow-constructor, the screen turns 90° clockwise. If not specifying any flags, it looks fine.
Using iOS 8.1. In 7.x it looks different, but also wrong (with and without flags actually).

Minimal sample code:
#include <SFML/Graphics.hpp>
#include <SFML/Main.hpp>

int main(int argc, char *argv[])
{
    auto mode = sf::VideoMode::getFullscreenModes()[0];
    // the next line causes the problem if some sf::Style flags are passed as parameters (any)
    sf::RenderWindow window(mode, "SFML window", sf::Style::Titlebar );
   
    auto leftRect = sf::RectangleShape(sf::Vector2f(window.getSize().x/2, window.getSize().y));
    leftRect.setFillColor(sf::Color::Red);
    auto rightRect = sf::RectangleShape(sf::Vector2f(window.getSize().x/2, window.getSize().y));
    rightRect.setFillColor(sf::Color::Green);
    rightRect.move(window.getSize().x/2, 0);
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed) {
                window.close();
            }
        }
        window.clear();
        window.draw(leftRect);
        window.draw(rightRect);
        window.display();
    }
   
    return 0;
}
I have attached two screenshots showing the results of passing flags and not passing flags. When not passing flags, the two rects fill the entire screen:
(http://game-coding.de/upload/img/thumbnail/TNwithout_style_flags.png) (http://game-coding.de/upload/img/without_style_flags.png)  The red one on the left, the green one on the right - as the code suggests.
When passing flags to the window constructor, the rects get misaligned:
(http://game-coding.de/upload/img/thumbnail/TNwith_style_flags.png) (http://game-coding.de/upload/img/with_style_flags.png)

I'm using latest trunk revision of SFML.