You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
Testing around a bit, an app using XF and CocosSharp as simple as below, fails on iOS:
publicclassApp:Application{publicApp(){// The root page of your applicationMainPage=new ContentPage {Content=new StackLayout {VerticalOptions= LayoutOptions.Start,// This line is the culprit.Children={new Label {XAlign= TextAlignment.Center,Text="Welcome to Xamarin Forms!"},new CocosSharpView {HorizontalOptions= LayoutOptions.FillAndExpand,VerticalOptions= LayoutOptions.FillAndExpand,DesignResolution=new Size (1024,768),ViewCreated=LoadGame,},}}};}staticvoidLoadGame(objectsender,EventArgse){vargameView= sender as CCGameView;if(gameView!=null){// Set world dimensions
gameView.DesignResolution =new CCSizeI (1024,768);
gameView.ContentManager.SearchPaths =newList<string>{"Fonts","Sounds","Images"};CCScenegameScene=new CCScene (gameView);
gameScene.AddLayer(new MainLayer ());
gameView.RunWithScene(gameScene);}}
System.InvalidOperationException: Error with EAGLContext.RenderBufferStorage!
at at OpenTK.Platform.iPhoneOS.iPhoneOSGameView.CreateFrameBuffer () in <filename unknown>:line 0
at at CocosSharp.CCGameView.CreateFrameBuffer () in <filename unknown>:line 0
at at CocosSharp.CCGameView.LayoutSubviews () in <filename unknown>:line 0
at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/src/UIKit/UIApplication.cs:line 77
at at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/src/UIKit/UIApplication.cs:line 61
at at TestCCS.iOS.Application.Main (System.String[] args) in /Users/therzok/Personal/TestCCS/iOS/Main.cs:line 17
The text was updated successfully, but these errors were encountered:
@Therzok Can you try setting an explicit HeightRequest for the CocosSharpView to see if that helps?
As a test, I tried replacing CocosSharpView with the Xam.Forms OpenGLView using the same layout options, and while no exception was thrown, nothing was displayed either.
I think the issue is that a StackLayout implicitly has no height when setting VerticalOptions = LayoutOptions.Start --- those dimensions are dictated by its children. For a Label control, the height dimensions are driven by the native label dimensions. But for a CocosSharpView and more generally, a OpenGLView, we require the opposite situation. That is, we need the CocosSharpView dimensions to be set before we can create the native frame buffer.
Testing around a bit, an app using XF and CocosSharp as simple as below, fails on iOS:
The text was updated successfully, but these errors were encountered: