Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 1 Support › MultitouchArea only 2 points

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #4981

    Philipp

    Hi!

    Is there any chance to get four MultitouchAreas working? In fact I also want on not iOS devices to give the possibility for four players to play at once. This requires four Player objects of which everyone has a MultitouchArea. I found in the documentation that MultitouchAreas only support 2 Points on Android. Is there anyway to avoid this limitation on Android?

    #4982

    Christian
    Felgo Team

    The doc states the limitiation to 2 touch points only holds true for lower-end android devices:

    Multi-touch capabilities are restricted to the specific target platform and device. Especially on Symbian and lower-end Android devices, there is a maximum of 2 touch points being detectable simultaneously. iPhones and iPod Touches support 5 multiple touch points, and the iPad supports up to 11. Consider this limitation when you design your game. If you require for example 3 touch points, your game is not guaranteed to work across all devices!

    You are limited to device restrictions here, we cannot change that.

    #5009

    Philipp

    Then I’m doing sth. wrong, as on the Nexus 7 (which supports 10 finger multitouch) only three multitouch areas work. I defined a MultitouchArea per Player, is this correct?

    #5010

    Christian
    Felgo Team

    Could you please share the code here for testing 4 MultiTouchAreas? We’ll then have a look at this issue.

    Cheers, Chris

    #5106

    Philipp

    Hi!

     

    This is the code of the MultiTouchArea found in our Player.qml file. In four player mode, four Player objects exist.

     

    MultiTouchArea {
            id: mouse
            enabled: !ai
            anchors.centerIn: parent
            width: scene.level.fourPlayers? parent.width * 2 : parent.width * 5
            height: scene.level.fourPlayers? parent.width * 1.1 : parent.height * 5
    
            multiTouch.target: parent
            multiTouch.dragAxis: MultiTouch.YAxis
            multiTouch.maximumY: scene.height-parent.height
            multiTouch.minimumY: 0
    
            //onPressed: playerLeft.state = "MOVE"
            //onPositionChanged: console.log("Player X/Y: " + playerLeft.x + "/" + playerLeft.y);
            onReleased: {
                if(shootAllowed){
                    PlayerLogic.shootSnowball(parent)
                    snowballsShot++;
                }
            }
        }

     

    #5110

    Alex
    Felgo Team

    Hi,

    i took your code and made a little test project. When testing on our Nexus 7, all 4 MultiTouchAreas were working fine. Please test this code on your device and tell me if it works.

    main.qml

    import VPlay 1.0
    import QtQuick 1.1
    
    GameWindow {
      Scene {
        id: scene
    
        Player {x: 50; y: 50}
    
        Player {x: 200; y: 50}
    
        Player {x: 50; y: 200}
    
        Player {x: 200; y: 200}
      }
    }

    Player.qml

    import VPlay 1.0
    import QtQuick 1.1
    
    EntityBase {
      width: 100
      height: 100
    
      Rectangle {
        id: rectangle
        anchors.fill: parent
        color: "red"
      }
    
      MultiTouchArea {
        id: mouse
        anchors.fill: parent
    
        multiTouch.target: parent
        multiTouch.dragAxis: MultiTouch.YAxis
        multiTouch.maximumY: scene.height-parent.height
        multiTouch.minimumY: 0
    
        onPressed: rectangle.color = "blue"
        onReleased: rectangle.color = "red"
      }
    }

    Cheers, Alex

    #5200

    Philipp

    Thanks for your example but I found out what the issue is. Unfortunately I cannot resolve this issue or at least I don’t know how to do it. The problem is that my Player shoots on the onReleased:{} Actually this means that when four people are playing things get messy and the onRelease{} method of other MultiTouchAreas are invoked. If all players are just moving, everything is fine. The problem starts when someone starts to shoot. As far as I figured out, the release of the first finger triggers the snowball of the first MultiTouchArea that was touched. This one does then furthermore not react to user input anymore as long as this player lifts his finger. What I would need now to resolve this issue would be a method like on UIButton for iOS, namely a touchUpInside.

    #5205

    Alex
    Felgo Team

    Hi,

    the equivalent to touchUpInside would be MouseArea’s / MultiTouchArea’s onReleased so I don’t quite get your demanded functionality. 😉 The onReleased signal of multiple MultiTouchAreas should however not overlap each other, so there might be a bug. Is this only happening on Android (like you stated above)?

    Thanks,

    Alex

     

Viewing 8 posts - 1 through 8 (of 8 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded