bijington / orbit

The Orbit engine is a game engine built on top of .NET MAUI Graphics. The objective is to firstly enjoy the journey of building a game engine and secondly providing a framework that allows us to utilise the best parts of a cross-platform framework while building a 'typical' game.
289 stars 37 forks source link

Orbit Not compiling for windows #4

Closed aliessmael closed 2 years ago

aliessmael commented 2 years ago

Compiling Orbit for windows machine gives theses errors.

image

bijington commented 2 years ago

Sorry it looks like I haven't ever tried to build this for Windows and also that I completely missed the banner on this documentation page: https://docs.microsoft.com/en-us/dotnet/maui/user-interface/graphics/images that states

Warning

The PlatformImage type isn't supported on Windows.

I haven't seen a clear way to load an image for this just yet. Are you able to build and run on a different target for now?

mattleibow commented 2 years ago

The issue is because the shared package does not actually support windows - and there is a separate nuget for windows: https://www.nuget.org/packages/Microsoft.Maui.Graphics.Win2D.WinUI.Desktop

However, this uses all different type names W2DImage and stuff :(

Hopefully I can get a combined package for net7 or sooner.

The reason this is like this is because technically there are 3 windows backends... So none are in the main package. There was XAML, SharpDX and Win2D. We picked Win2D for maui and are going to make that the default/in-box.

But for now, windows TFMs use that package instead.

bijington commented 2 years ago

@mattleibow thank you so much for the insight here!

I will have a play with that linked package for now to see if there is a way to make the image loading part work on Windows.

Thanks again

aliessmael commented 2 years ago

Sorry it looks like I haven't ever tried to build this for Windows and also that I completely missed the banner on this documentation page: https://docs.microsoft.com/en-us/dotnet/maui/user-interface/graphics/images that states

Warning The PlatformImage type isn't supported on Windows.

I haven't seen a clear way to load an image for this just yet. Are you able to build and run on a different target for now?

Yes it is building fine for android but still struggling with emulator deployment, also I had to remove windows support to skip the compile errors

image

aliessmael commented 2 years ago

Got it running on android emulator, but look like there is display issue. Any way thanks for the demo it is helpful.

image

bijington commented 2 years ago

@aliessmael thanks for that screenshot. I am in the process of trying to separate out state from display and this may well help to solve this issue.

It seems I have also been testing this in a landscape mode on my Mac so all of this stuff is really helpful to show issues with the rendering.

bijington commented 2 years ago

I should also have pointed out that this is very much a work in progress, I am hoping to get to an MVP release in the coming weeks/months. So feedback like this is really helpful

bijington commented 2 years ago

This should now be resolved since https://github.com/bijington/orbit/commit/c7c154a6ba19ac10a048a5ceaa683c04de052377

aluitink commented 2 years ago

This might not be completely fixed?

When invoking "new W2DImageLoadingService().FromStream(stream)" I see this exception:

System.Exception: 'No resource creator has been registered globally or for this thread.'

I found the following open issue: IImageLoadingServcie cannot load image on Windows

The suggested workaround to connect a GlobalCreator after the GraphicsView is loaded partially solves this issue.

Exception will be thrown until the GraphicView "Loaded" handler workaround is invoked, so you would need to defer resource loading until after Loaded is triggered.

I used a Lazy to load the resources on the first Render call to the GameObject.

bijington commented 2 years ago

Well it still compiles 😉. All jokes aside that bug doesn't look good but I really appreciate you sharing the underlying bug detail and potential workaround. I'm not on my computer right now but I'll open a new issue when I am including your details so it will be easier to track.