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

Author Topic: Touch position inconsistency on iOS with NSHighResolutionCapable  (Read 2730 times)

0 Members and 1 Guest are viewing this topic.

spacechase0

  • Newbie
  • *
  • Posts: 39
    • AOL Instant Messenger - thespacechase0
    • View Profile
    • http://spacechase0.com/
When NSHighResolutionCapable is set to true in the application plist, sf::Touch::getPosition is returning values that don't match the corresponding events. It doesn't seem to take the retina display into account.

#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Main.hpp>

int main( int argc, char* argv[] )
{
        sf::RenderWindow window( sf::VideoMode::getDesktopMode(), "Test" );

        while ( window.isOpen() )
        {
                sf::Event event;
                while ( window.pollEvent( event ) )
                {
                        if ( event.type == sf::Event::TouchBegan )
                        {
                                std::cout << "A: " << event.touch.x << ", " << event.touch.y << std::endl;
                                sf::Vector2i pos = sf::Touch::getPosition( event.touch.finger );
                                std::cout << "B: " << pos.x << ", " << pos.y << std::endl;
                        }
                }

                window.clear();
                window.display();
        }

        return 0;
}

I tested it in both the 4s and 6+ simulators (target SDK 8.1), using the bugfix/gles branch.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Touch position inconsistency on iOS with NSHighResolutionCapable
« Reply #1 on: April 29, 2015, 12:27:59 pm »
It seems that the backing factor is not taken into account when data is inserted in touchPositions (example: SFAppDelegate.mm:248, but there are other places, but is when the event is generated. I guess it should either be taken into account when stored, or when extracted from InputImpl.mm:102 . Keeping in mind that InputImpl::isTouchDown should still work, of course.

Could you try implementing a patch? I'm not sure Laurent has currently the time.
SFML / OS X developer

spacechase0

  • Newbie
  • *
  • Posts: 39
    • AOL Instant Messenger - thespacechase0
    • View Profile
    • http://spacechase0.com/
Re: Touch position inconsistency on iOS with NSHighResolutionCapable
« Reply #2 on: April 29, 2015, 05:56:44 pm »

 

anything