Nominate our 2022 Qt Champions!

Game with buttons and stuff...

  • I am a learner programmer trying to make a little game for my phone using QML. My game is controlled by a number of direction, speed and shoot buttons. I initially made my buttons out of images, using MouseArea inside them to respond to the user input, however have discovered that this means only one button will work at a time.

    I think I need to use MultiPointTouchArea in order to have more than one button working at once.
    My problem is how do I link the TouchPoints to the images on my buttons, so my application knows which button is pressed? There must be a simple way to do this...?

    Please can anybody help?

  • Problem solved:
    I used a number of MultiPointTouchAreas - one for each of my buttons. That way I was able to define the rectangle area for each MultiPointTouchArea corresponding to each button.
    It works perfectly and sends a signal for each time a MultiPointTouchArea is pressed, regardless of whether other ones are already being pressed.

Log in to reply