ENIGMA Forums

Contributing to ENIGMA => Proposals => Topic started by: Josh @ Dreamland on September 13, 2012, 11:13:41 AM

Title: Preprocessors
Post by: Josh @ Dreamland on September 13, 2012, 11:13:41 AM
Since ENIGMA supports compilation on a wide variety of platforms, and soon, a small variety of languages, it is going to become necessary to give the user a way to deal with that.

Now, C++ gives a fine way of doing that: Preprocessors. The issue with C preprocessors is that they are ugly. They must be the first thing on a line, and must consume the entire line. In EDL, we'll want to fix that.

My proposal is that preprocessors be given by {{}}. So, if you wanted a piece of code to run only on Mac, you'd use something like this:

Code: [Select]
{{if ENIGMA_Platform == "ios"}} gamecenter_initialize(); {{endif}} // Initialize the game center if we're on iOS
highscore_add(name, score);

That will bring up the game center on iOS, or something. Ask TGMG; I really have no clue about iOS.