CocosSharp on WP8.1 WinRT - open game from second page (not the first startup page) ?

zahikramerzahikramer ILMember ✭✭✭

Hi.
i'm trying to create game that will have normal firstPage.xaml on the start. on Windows Phone 8.1 WinRT
Not like the template which have App.xaml root directly to GamePage.xaml

(I want first page to do some stuff , like intro text , few labels and buttons etc...)
i tried to dot this with Navigate:
if (rootFrame != null && !rootFrame.Navigate(typeof(GamePage),"")) { throw new Exception("Failed to create Game page"); }

but i get Error:
{SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
at SharpDX.Result.CheckError()

on the file at monogame: CocosSharp\MonoGame\MonoGame.Framework\Graphics\GraphicsDevice.DirectX.cs

line 442:
#if WINDOWS_PHONE81 || WINDOWS_UAP _swapChain = new SwapChain1(dxgiFactory2, dxgiDevice2, comWindow, ref desc); '#else

why?

Does anyone know how to start the game like on android or ios ?
(there from anywhere i can start CCApplication.Create(new AppDelegate()) etc.)

Answers

  • kjpou1kjpou1 LUMember, Xamarin Team Xamurai

    Zahi

    What seems to be happening is that MonoGame seems to take over the panel and creates the swapChain from the GamePanel. I do not know of any workarounds for this. These are some of the technical issues that are having to be worked out with the XF implementation as well.

  • zahikramerzahikramer ILMember ✭✭✭

    @kjpou1
    Thanks Kenneth.
    This bug is not on WP8.1 Silverlight. I succeeded there also to enable first page from XF to 2nd page of Cocossharp.
    So it must be only on WP8.1 WinRT implementation of monogame/cocossharp.

    Isn't there anyone from monogame/cocossharp who can help me?
    Should i open a bug on Bugzilla?
    Thanks.

  • RamiTabbaraRamiTabbara AUMember, Xamarin Team Xamurai

    Hi Zahi,

    The underlying WindowsPhone implementation provided by MonoGame makes use of a DrawingSurfaceBackgroundGrid to perform rendering. As described here, this must be the root element of the XAML tree. So this suggests that what you're trying to achieve in general isn't possible. I'm not entirely sure how you were successful when using Silverlight, but I wouldn't recommend trying to crowbar this functionality when targeting WinRT.

    As I mentioned in another post, we're in the midst of bringing true XF support into CocosSharp, which would make what you're trying to achieve far more straight-forward.

  • zahikramerzahikramer ILMember ✭✭✭
    edited July 2015

    @RamiTabbara

    Thanks Rami.
    But i'm not questioning the fact that DrawingSurfaceBackgroundGrid will be the Root of the page.
    I'm trying to say it will be on ANOTHER page.

    forget about XF. forget about cross platform.
    suppose I very like Cocossharp and i want to create Native Game only for WP8.1 winrt.
    Can't i begin with Normal Xaml Page with some buttons and labels?
    and with pressing one button for example , i'll move to the cocossharp page.
    This basic thing can't be done?

    (i'm looking forward to XF with Cocossharp, but i think this request should be done regardless of XF)
    I'ts very very working with WP8.1 Silverlight, I believe there is a way (should be) to do it also on WinRT, or there is a bug.....
    what you think?

  • zahikramerzahikramer ILMember ✭✭✭

    check this Xap on emulator.
    WP8.1 SL
    XF -->CC

  • RamiTabbaraRamiTabbara AUMember, Xamarin Team Xamurai

    Hi Zahi,

    While I agree that in the context of XF, navigating to a native page should theoretically be possible, the issue is that MonoGame (and hence CocosSharp) were originally designed assuming single view game instances that occupy the entire screen. So I would argue that your setup is not actually as straight-forward as you claim. For example, other users have attempted something similar purely with MonoGame and have encountered issues when navigating to and from pages.

    We can certainly take a closer look at this, but I think that any fix that we propose is going to either overlap or be superseded by our forms support. And I think the ability to combine multiple UI elements with CocosSharp on the same page is likely something that is much more valuable to our users and worth focusing our efforts on.

  • zahikramerzahikramer ILMember ✭✭✭

    Thanks Rami.
    I see the others have exact problem (it's also only on wp8.1 WinRT)
    and they found some way (not 100% to work)
    maybe i'm a genius :blush: , but you can look my XAP i posted by yourself. It's working (on WP8.1 SL)
    LOOK IT WITH YOUR OWN EYES (as Darth wader said... :smile: )

    Anyway.
    I don't want to be picky, but the question if CC should work only with XF , or it can be standalone.
    And if it can be standalone , if it should be only it or should it interact with native pages.

    of course , this is xamarin to decide.
    i thought that till XF+CC will work together, maybe a small fix will enable to do the basic Native-->CC.

    And , again , it's your decision.
    Thanks

Sign In or Register to comment.