Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [iOS] RenderWindow turns 90° when using style-flags in constructor  (Read 2607 times)

0 Members and 1 Guest are viewing this topic.

BlueCobold

  • Full Member
  • ***
  • Posts: 105
    • View Profile
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:
  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:


I'm using latest trunk revision of SFML.
« Last Edit: November 25, 2014, 08:05:16 am by BlueCobold »