2
\$\begingroup\$

What are the possible compiler directives for MonoGame?

For example, XNA contained directives for WINDOWS, XBOX/XBOX360, and WINDOWS_PHONE.

I've also seen DIRECTX and OPENGL, but when would you need to leverage those?


Supported Platforms:

  • PC
  • Windows 8 Store App
  • Linux
  • Android
  • OUYA
  • Mac
  • iOS
  • Playstation Mobile
\$\endgroup\$
5
\$\begingroup\$

If you look inside each project file on github you can see the constants defined for each platform. I've extracted them here:

  • Android - TRACE;ANDROID;GLES;OPENGL
  • Linux - LINUX;OPENGL
  • MacOS - MONOMAC;OPENGL
  • Ouya - TRACE;ANDROID;GLES;OPENGL;OUYA
  • PSMobile - DEBUG;PSM
  • Windows - DEBUG;TRACE;WINDOWS;DIRECTX;WINDOWS_MEDIA_SESSION
  • Windows8 - TRACE;NETFX_CORE;WINRT;WINDOWS_STOREAPP;DIRECTX;DIRECTX11_1;WINDOWS_MEDIA_ENGINE
  • WindowsGL - TRACE;WINDOWS;OPENGL
  • WindowsPhone - TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;WINRT;DIRECTX
  • iOS - IOS;GLES;OPENGL
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I never knew those were stored in the project files. They hold all kinds of goodies! \$\endgroup\$ – Jim Buck May 17 '13 at 14:20
1
\$\begingroup\$

in addition to the other answer for windows UWP apps you can use:

#if WINDOWS_UAP
    // windows UWP specific code
#endif
| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.