Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Receiving Multi Touch Events with overlaying ViewController

$
0
0

@ronnycsharp wrote:

Hi,

I have a MG-App combined with Xamarin.Forms for the Layout.
Everything works fine, expect from multi touch events.
The TouchPanel didn't receive the second or third finger.

Need some help to solve that problem.
Regards
Ronny

` var pianoApp = new App();
LoadApplication(pianoApp);

        var result = base.FinishedLaunching(app, options);

        var formsVC = UIApplication.SharedApplication.KeyWindow.RootViewController;
        formsVC.View.BackgroundColor = UIColor.Clear;
        formsVC.View.Opaque = false;

        var audioEngine = DependencyService.Get<IAudioEngine>();

        var game = new PianoGame(audioEngine);
        game.Run();

        var gameVC = UIApplication.SharedApplication.KeyWindow.RootViewController;

        formsVC.View.RemoveFromSuperview();
        formsVC.RemoveFromParentViewController();

        gameVC.View.Opaque                  = false;
        gameVC.View.MultipleTouchEnabled    = true;
        gameVC.View.UserInteractionEnabled  = true;
        gameVC.View.ExclusiveTouch          = false;

        gameVC.RemoveFromParentViewController();
        gameVC.View.RemoveFromSuperview();

        var vc = new MyViewController();
        vc.View.ExclusiveTouch = false;
        vc.View.MultipleTouchEnabled = true;
        vc.View.UserInteractionEnabled = true;
        UIApplication.SharedApplication.KeyWindow.RootViewController = vc;

        gameVC.WillMoveToParentViewController(vc);
        vc.View.AddSubview(gameVC.View);
        vc.AddChildViewController(gameVC);
        gameVC.DidMoveToParentViewController(vc);

        vc.View.BackgroundColor = UIColor.Clear;
        vc.View.Frame = gameVC.View.Frame;
        
        formsVC.WillMoveToParentViewController(vc);
        vc.View.AddSubview(formsVC.View);
        vc.AddChildViewController(formsVC);
        formsVC.DidMoveToParentViewController(vc);

        formsVC.View.Opaque                 = true;
        formsVC.View.BackgroundColor        = UIColor.Clear;
        formsVC.View.MultipleTouchEnabled   = true;
        formsVC.View.UserInteractionEnabled = true;
        formsVC.View.ExclusiveTouch         = false;

        vc.GameViewController = gameVC;
        vc.FormsViewController = formsVC;

        return result;`

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles