Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualuglybdavis

Posted 11 October 2012 - 11:38 AM

Sounds like you're on the right path. As far as pre-processor, think a python script that looks for:
#StartIPhone
....
#StopIPhone

#StartBrowser
...
#EndBrowser

Then spits out a file only including the code between the proper #defines.
You would keep a source folder, and the preprocessor would spit copies of the file out into your build directories
So, you would probably want to set up a folder hierarchy like:
Project
+- Source
+- BrowserVersion
+- iPhoneVersion
+-+- Support files
+-+- Js Files
So, lets say you have game.js, in there you would have

function DoSomeStuff() {
CallingMoreFunctions();
#StartIPhone
iPhoneSpecificNumber += 1;
#EndIPhone
#StartBrowser
IncreaseBrowserNumber();
#EndBrowser
DumbExampleIKnow();
}

then you could run your python script
python preprocessor.py somefile.js
which would copy somefile.js to both your html and ios build directories. The iPhone version does not contain the Start/End Browser block, and the browser version does not contain the Start/End IPhone block.

Run, test, edit, rinse repeat.

I only say python because it's what we use at work, any language would work.

#1uglybdavis

Posted 11 October 2012 - 11:37 AM

Sounds like you're on the right path. As far as pre-processor, think a python script that looks for:
#StartIPhone
....
#StopIPhone

#StartBrowser
...
#EndBrowser

Then spits out a file only including the code between the proper #defines.
You would keep a source folder, and the preprocessor would spit copies of the file out into your build directories
So, you would probably want to set up a folder hierarchy like:
Project
+- Source
+- BrowserVersion
+- iPhoneVersion
+-+- Support files
+-+- Js Files
So, lets say you have game.js, in there you would have

function DoSomeStuff() {
CallingMoreFunctions();
#StartIPhone
iPhoneSpecificNumber += 1;
#EndIPhone
#StartBrowser
IncreaseBrowserNumber();
#EndBrowser
DumbExampleIKnow();
}

then you could run your python script
python preprocessor.py somefile.js
which would copy somefile.js to both your html and ios build directories. Run, test, edit, rinse repeat.

I only say python because it's what we use at work, any language would work.

PARTNERS