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\$

2 Answers 2

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
\$\endgroup\$
1
  • \$\begingroup\$ I never knew those were stored in the project files. They hold all kinds of goodies! \$\endgroup\$
    – Jim Buck
    Commented May 17, 2013 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
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .