0
votes

I need to develop a cross-platform app that ranges from mobile to desktop to TV. App includes a huge variety of 3D elements which are vital for application's correct display.

At first, I was going to use C++ and native compilers (utilizing directives) but I have gone that road many times, there are a lot of overlapping factors you can't unify (or find work, too much, arounds to overcome this issue), so I decided to try other alternatives.

I found Xamarin most outstanding cross-platform toolkit allowing native performance applications but I got lost in some terminology. In my application, there will be a base class called "GraphRenderer". I will override it for each platform and on each platform, I will include a different GPU library (eg. Metal for Mac, DirectX 12 for Windows, Vulkan for Android) and utilize it. If possible, I don't want to use directives, creating interfaces approach seem way more cleaner in the long run.

Is there a project type (as you can imagine Shared Library, PCL etc. left me confused) that allows this hierarchy:

  • App

    • Shared Code Files
      • GraphRenderer.cs : Definition of GraphRenderer with Empty Functions to make it compatible for other shared code
    • Platform-Specific Code Files
      • GraphRenderer.Windows.cs : Replaces GraphRenderer.cs when compiling App for Windows 10 platform, includes DirectX 12 headers and override functions with proper functionality

Thanks.

1

1 Answers

0
votes

There are two approaches one is shared and another PCL In shared approach you have to use directives as you will be using single shared file in all platforms. In PCL approach you need to have an interface created in PCL project and implement in platform specific projects.