New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/compilerdefinitions #109
base: main
Are you sure you want to change the base?
Feature/compilerdefinitions #109
Conversation
> ```csharp | ||
> if(PlatformInfo.MonoGamePlatform == MonoGamePlatform.DesktopGL) | ||
> { | ||
> // The Client is running on the DesktopGL runtime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we note that not all api's are available across all platforms? When using this Runtime method you cannot use Android or Steam API's for example, since the assembly won't be available.
For platform specific code (i.e Play Store integration etc) you really need to use #defines or include specific files in the head project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it is the one limitation with this only runtime method. Ideally, MG should expose some defines that can be consumed similar to other engines, but without an actual runtime component, I'm not sure it is possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaik, each platform Nuget has a build Targets file. The DefineConstants
MSbuild property could be added to if they are not already like
<DefineConstants>$(DefineConstants);__MONOGAME_ANDROID__<DefineConstants>
or
<DefineConstants>$(DefineConstants);__MONOGAME_DESKTOPGL__<DefineConstants>
if that is what you are thinking of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harry-cpp said something similar but the conversation didn't progress beyond that.
If those features could give us compile-time constants for MonoGame Platforms, then yes, that would be the answer (along the style naming defined in the guide)
Summary
Added a new document describing the pre-compiler definitions supported in MonoGame projects.
Additionally, I have reordered the TOC for more clarity: