Issue with Cocossharp and iOS

MTPsGameMTPsGame USMember

Hi,

I have been working on an app which includes a cocossharp game, and makes use of the cocossharp.forms package. I tested this game on android and it works fine, how ever when I tried it on iOS the ViewCreated cocossharp event is never invoked, even though the conditions are the exact same as they are on android. This results in a blank white page on the iOS simulator. Here is the GamePage file which is a content page within a tabbed page:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;

using CocosSharp;
using Xamarin.Forms;

namespace EnergiYorkTrampolinePark
{
public class GamePage : ContentPage
{
public GamePage()
{

        Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
        Title = "Game";
        var view = new CocosSharpView();
        view.HorizontalOptions = LayoutOptions.CenterAndExpand;
        view.VerticalOptions = LayoutOptions.CenterAndExpand;
        view.ViewCreated = LoadIt;
        Content = view;
    }

    void LoadIt(object sender, EventArgs args)
    {
        var gameView = sender as CCGameView;
        if (gameView != null)
        {
            gameView.DesignResolution = new CCSizeI(720, 1280);
            gameView.ResolutionPolicy = CCViewResolutionPolicy.ShowAll;
            var gameScene = new GameScene(gameView);
            gameView.RunWithScene(gameScene);
        }
    }


}

}

I have cocossharp and cocossharp.forms (1.7.1.0) installed on all of my projects, as well as xamarin.forms (2.3.1.114).

Answers

Sign In or Register to comment.