Getting started with NME

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting started with NME

Gamehaxe

Hi,
There have been a few questions about getting started with hxcpp/NME,
so I thought I would give a quick update on my current theories
for the next version on NME.

I have been working on a project system for NME.
The idea is that you write a "project" file instead of a .hxml file.
 From this file, all the boiler-plate project + code files are generated
for the various different targets.  These files are "disposable", so
you can blow them away every night if you wish and start again.
Your "precious" files are your source code, your assets and your
single project file, and I would expect these to be under source control,
and everything else can get trashed. I have only looked at NME sample 06
at this stage, but the project looks like this:


<?xml version="1.0" encoding="utf-8"?>
<project>

   <app
      file="Sample06"
      title="NME Sample 06 - Drums"
      package="org.haxe.nme.sample06"
      version="1.0"
      company="nme"
          main="Sample"
   />

   <window
       width="400"
       height="300"
       orientation="landscape"
       fps="60"
       background="0xffffff"
       resizeable="true"
       hardware="true"
        />


   <classpath name="." />
   <haxelib name="nme" />

   <assets>
      <asset name="Data/drum_kit.jpg" />
      <asset name="Data/bang.png"     />
      <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
      <sound name="Data/drum.ogg"     />
      <sound name="Data/bass.wav"     />
      <sound name="Data/drums.ogg"   />
   </assets>


   <ndll name="std" />
   <ndll name="regexp" />
   <ndll name="zlib" />
   <ndll name="nme" haxelib="nme" nekoapi="1"/>

   <certificates>
      <certificate file="signature.cer" name="mysign" password="ajkhsakjhf"  
/>
   </certificates>

</project>


As you may or may not see, I use pretty much the same architecture as
I did the the hxcpp build tool.

 From this, I can already create windows hxcpp or neko foilders and Android  
Apks.
I'm working on iPhone xcode projects and GHP/Caanoo installs.
I intend to push this with windows NSIS installers, mac dmgs, linux (tar  
files???)
and swf scp so you can go from haxe file to installer with one step.
The "certificates" part is crap at the moment - haven't quite worked out  
what
to do there.  Also thinking about having vector-based icons that can be
rendered to different resolutions.
I have not started the flash code, but it will probably use an external  
tool
such as swfmill, can create that project file from this one.
The haxe.Template code make most of this quite easy.

I am also moving the window creation code into the templates to make a  
direct port
of the flash code easier.

The procedure will go like this:
0. Install a whole bunch of thirdparty tools
1. write haxe code
2. write project file
3. run anywhere/profit.

Maybe with closer integration with FlashDevelop, or some kind of gui app,
step 2 may become trivial.

So if anyone has any comments on this, or would like to contribute  
(especially
with mac or linux installers) please speak up.

Hugh

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

m5no1
great idea,very useful for crossplatform project!
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

alexander.konotop
In reply to this post by Gamehaxe
В Mon, 21 Feb 2011 22:17:32 +0800
"Hugh Sanderson" <[hidden email]> пишет:

>
> Hi,
> There have been a few questions about getting started with hxcpp/NME,
> so I thought I would give a quick update on my current theories
> for the next version on NME.
>
> I have been working on a project system for NME.
> The idea is that you write a "project" file instead of a .hxml file.
>  From this file, all the boiler-plate project + code files are
> generated for the various different targets.  These files are
> "disposable", so you can blow them away every night if you wish and
> start again. Your "precious" files are your source code, your assets
> and your single project file, and I would expect these to be under
> source control, and everything else can get trashed. I have only
> looked at NME sample 06 at this stage, but the project looks like
> this:
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <project>
>
>    <app
>       file="Sample06"
>       title="NME Sample 06 - Drums"
>       package="org.haxe.nme.sample06"
>       version="1.0"
>       company="nme"
>  main="Sample"
>    />
>
>    <window
>        width="400"
>        height="300"
>        orientation="landscape"
>        fps="60"
>        background="0xffffff"
>        resizeable="true"
>        hardware="true"
> />
>
>
>    <classpath name="." />
>    <haxelib name="nme" />
>
>    <assets>
>       <asset name="Data/drum_kit.jpg" />
>       <asset name="Data/bang.png"     />
>       <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>       <sound name="Data/drum.ogg"     />
>       <sound name="Data/bass.wav"     />
>       <sound name="Data/drums.ogg"   />
>    </assets>
>
>
>    <ndll name="std" />
>    <ndll name="regexp" />
>    <ndll name="zlib" />
>    <ndll name="nme" haxelib="nme" nekoapi="1"/>
>
>    <certificates>
>       <certificate file="signature.cer" name="mysign"
> password="ajkhsakjhf" />
>    </certificates>
>
> </project>
>
>
> As you may or may not see, I use pretty much the same architecture as
> I did the the hxcpp build tool.
>
>  From this, I can already create windows hxcpp or neko foilders and
> Android Apks.
> I'm working on iPhone xcode projects and GHP/Caanoo installs.
> I intend to push this with windows NSIS installers, mac dmgs, linux
> (tar files???)
> and swf scp so you can go from haxe file to installer with one step.
> The "certificates" part is crap at the moment - haven't quite worked
> out what
> to do there.  Also thinking about having vector-based icons that can
> be rendered to different resolutions.
> I have not started the flash code, but it will probably use an
> external tool
> such as swfmill, can create that project file from this one.
> The haxe.Template code make most of this quite easy.
>
> I am also moving the window creation code into the templates to make
> a direct port
> of the flash code easier.
>
> The procedure will go like this:.
> 0. Install a whole bunch of thirdparty tools
> 1. write haxe code
> 2. write project file
> 3. run anywhere/profit.
>
> Maybe with closer integration with FlashDevelop, or some kind of gui
> app, step 2 may become trivial.
>
> So if anyone has any comments on this, or would like to contribute  
> (especially
> with mac or linux installers) please speak up.
>
> Hugh
>

Are You trying to make some autobuild script for Your program? The
script has to download all the needed haxe 3rdparty libraries, install
them, compile the project to multiple targets and install them to the
system. Haven't I misunderstood You?

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

Gamehaxe
Hi,
The script would assume the libraries/SDKs are installed.
But once that is done, you could build for multiple targets etc.

Hugh

> Are You trying to make some autobuild script for Your program? The
> script has to download all the needed haxe 3rdparty libraries, install
> them, compile the project to multiple targets and install them to the
> system. Haven't I misunderstood You?

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

davidedc
In reply to this post by Gamehaxe
Hi Hugh, All,

I recently made a java program that modifies the XCode project.pbxproj file so to correctly reference any files you may want to add to the App package.

There are two hashes that one needs to include in 4 places and a couple of extra fields like a filetype and file encoding.

Seems to work pretty well (considering that the reverse-engineering of the hashes is very crude - but apparently it's good enough), let me know if that could be useful to create the XCode project.

D

On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:

>
> Hi,
> There have been a few questions about getting started with hxcpp/NME,
> so I thought I would give a quick update on my current theories
> for the next version on NME.
>
> I have been working on a project system for NME.
> The idea is that you write a "project" file instead of a .hxml file.
> From this file, all the boiler-plate project + code files are generated
> for the various different targets.  These files are "disposable", so
> you can blow them away every night if you wish and start again.
> Your "precious" files are your source code, your assets and your
> single project file, and I would expect these to be under source control,
> and everything else can get trashed. I have only looked at NME sample 06
> at this stage, but the project looks like this:
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <project>
>
>  <app
>     file="Sample06"
>     title="NME Sample 06 - Drums"
>     package="org.haxe.nme.sample06"
>     version="1.0"
>     company="nme"
>  main="Sample"
>  />
>
>  <window
>      width="400"
>      height="300"
>      orientation="landscape"
>      fps="60"
>      background="0xffffff"
>      resizeable="true"
>      hardware="true"
> />
>
>
>  <classpath name="." />
>  <haxelib name="nme" />
>
>  <assets>
>     <asset name="Data/drum_kit.jpg" />
>     <asset name="Data/bang.png"     />
>     <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>     <sound name="Data/drum.ogg"     />
>     <sound name="Data/bass.wav"     />
>     <sound name="Data/drums.ogg"   />
>  </assets>
>
>
>  <ndll name="std" />
>  <ndll name="regexp" />
>  <ndll name="zlib" />
>  <ndll name="nme" haxelib="nme" nekoapi="1"/>
>
>  <certificates>
>     <certificate file="signature.cer" name="mysign" password="ajkhsakjhf" />
>  </certificates>
>
> </project>
>
>
> As you may or may not see, I use pretty much the same architecture as
> I did the the hxcpp build tool.
>
> From this, I can already create windows hxcpp or neko foilders and Android Apks.
> I'm working on iPhone xcode projects and GHP/Caanoo installs.
> I intend to push this with windows NSIS installers, mac dmgs, linux (tar files???)
> and swf scp so you can go from haxe file to installer with one step.
> The "certificates" part is crap at the moment - haven't quite worked out what
> to do there.  Also thinking about having vector-based icons that can be
> rendered to different resolutions.
> I have not started the flash code, but it will probably use an external tool
> such as swfmill, can create that project file from this one.
> The haxe.Template code make most of this quite easy.
>
> I am also moving the window creation code into the templates to make a direct port
> of the flash code easier.
>
> The procedure will go like this:
> 0. Install a whole bunch of thirdparty tools
> 1. write haxe code
> 2. write project file
> 3. run anywhere/profit.
>
> Maybe with closer integration with FlashDevelop, or some kind of gui app,
> step 2 may become trivial.
>
> So if anyone has any comments on this, or would like to contribute (especially
> with mac or linux installers) please speak up.
>
> Hugh
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

Paul Zirkle
I'm currently working on my own engine (instead of using NME, sorry!) for cross platform mobile development, however if this project file system seems beneficial, I may try to use it as well.

-Paul Zirkle

On Mon, Feb 21, 2011 at 9:34 AM, Davide Della Casa <[hidden email]> wrote:
Hi Hugh, All,

I recently made a java program that modifies the XCode project.pbxproj file so to correctly reference any files you may want to add to the App package.

There are two hashes that one needs to include in 4 places and a couple of extra fields like a filetype and file encoding.

Seems to work pretty well (considering that the reverse-engineering of the hashes is very crude - but apparently it's good enough), let me know if that could be useful to create the XCode project.

D

On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:

>
> Hi,
> There have been a few questions about getting started with hxcpp/NME,
> so I thought I would give a quick update on my current theories
> for the next version on NME.
>
> I have been working on a project system for NME.
> The idea is that you write a "project" file instead of a .hxml file.
> From this file, all the boiler-plate project + code files are generated
> for the various different targets.  These files are "disposable", so
> you can blow them away every night if you wish and start again.
> Your "precious" files are your source code, your assets and your
> single project file, and I would expect these to be under source control,
> and everything else can get trashed. I have only looked at NME sample 06
> at this stage, but the project looks like this:
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <project>
>
>  <app
>     file="Sample06"
>     title="NME Sample 06 - Drums"
>     package="org.haxe.nme.sample06"
>     version="1.0"
>     company="nme"
>         main="Sample"
>  />
>
>  <window
>      width="400"
>      height="300"
>      orientation="landscape"
>      fps="60"
>      background="0xffffff"
>      resizeable="true"
>      hardware="true"
>       />
>
>
>  <classpath name="." />
>  <haxelib name="nme" />
>
>  <assets>
>     <asset name="Data/drum_kit.jpg" />
>     <asset name="Data/bang.png"     />
>     <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>     <sound name="Data/drum.ogg"     />
>     <sound name="Data/bass.wav"     />
>     <sound name="Data/drums.ogg"   />
>  </assets>
>
>
>  <ndll name="std" />
>  <ndll name="regexp" />
>  <ndll name="zlib" />
>  <ndll name="nme" haxelib="nme" nekoapi="1"/>
>
>  <certificates>
>     <certificate file="signature.cer" name="mysign" password="ajkhsakjhf" />
>  </certificates>
>
> </project>
>
>
> As you may or may not see, I use pretty much the same architecture as
> I did the the hxcpp build tool.
>
> From this, I can already create windows hxcpp or neko foilders and Android Apks.
> I'm working on iPhone xcode projects and GHP/Caanoo installs.
> I intend to push this with windows NSIS installers, mac dmgs, linux (tar files???)
> and swf scp so you can go from haxe file to installer with one step.
> The "certificates" part is crap at the moment - haven't quite worked out what
> to do there.  Also thinking about having vector-based icons that can be
> rendered to different resolutions.
> I have not started the flash code, but it will probably use an external tool
> such as swfmill, can create that project file from this one.
> The haxe.Template code make most of this quite easy.
>
> I am also moving the window creation code into the templates to make a direct port
> of the flash code easier.
>
> The procedure will go like this:
> 0. Install a whole bunch of thirdparty tools
> 1. write haxe code
> 2. write project file
> 3. run anywhere/profit.
>
> Maybe with closer integration with FlashDevelop, or some kind of gui app,
> step 2 may become trivial.
>
> So if anyone has any comments on this, or would like to contribute (especially
> with mac or linux installers) please speak up.
>
> Hugh
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

davidedc
OK here is how I grokked it in case it helps.

(Caveat: I didn't cater for whitespaces in the filenames yet.)

There are three files in the XCode .xcodeproj project directory. The only important one is the project.pbxproj file, I trash the other two as they seem to contain satellite preferences and bookmarks, windows positions etc. and they are automatically created without problems. Four text blocks need to be added to the pbxproj file. Each text block contains one line for each file to be included in the package.

For each file to add in the App package there are two hashes that need to be calculated. XCode seems to be relaxed about those as far as they cross-reference correctly - I calculated them like this so they look pretty similar to what I saw XCode generate with an example I fed it.

              Vector selectedFilesToIncludeHex1 = new Vector();
              Vector selectedFilesToIncludeHex2 = new Vector();
              for (int k = 0; k < selectedFilesToIncludePath.size(); k++) {
                String completeHex1 = "C489DF"+Integer.toHexString(k+233).toUpperCase() +"130E90F900C81312";
                String completeHex2 = "C489DF"+Integer.toHexString(k+224).toUpperCase() +"130E90F800C81312";
                selectedFilesToIncludeHex1.add(completeHex1);
                selectedFilesToIncludeHex2.add(completeHex2);
              }

There are four text blocks that need to be inserted:

              String Change1 = "" ;
              String Change2 = "" ;
              String Change3 = "" ;
              String Change4 = "" ;

Also there are two additional fields that are needed in a couple of those blocks: filetype and file encoding. I prepare the strings based on the file extension (that I keep in the selectedFilesToIncludeExtension Vector) like this:


              String fileType = "" ;
              String fileEncoding = "" ;

              for (int k = 0; k < selectedFilesToIncludePath.size(); k++) {
                if (selectedFilesToIncludeExtension.get(k).equals("xml")) {
                  fileType = "text.xml";
                  fileEncoding = "fileEncoding = 4; ";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("txt")) {
                  fileType = "text";
                  fileEncoding = "fileEncoding = 4; ";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("mp3")) {
                  fileType = "audio.mp3";
                  fileEncoding = "";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("png")) {
                  fileType = "image.png";
                  fileEncoding = "";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("jpg")) {
                  fileType = "image.jpeg";
                  fileEncoding = "";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("gif")) {
                  fileType = "image.gif";
                  fileEncoding = "";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("aiff")) {
                  fileType = "audio.aiff";
                  fileEncoding = "";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("wav")) {
                  fileType = "audio.wav";
                  fileEncoding = "";
                }
                else{
                  fileType = "file";
                  fileEncoding = "";
                }

In the same loop as above, for each file I build 4 text blocks that need to be inserted in the project file:

                Change1 = Change1 +
                      " " + selectedFilesToIncludeHex1.get(k) + " /* " +
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      " in Resources */ = {isa = PBXBuildFile; "+
                      "fileRef = " +
                      selectedFilesToIncludeHex2.get(k) +
                      " /* " +
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      " */; };\n";

                Change2 = Change2 + " " +
                      selectedFilesToIncludeHex2.get(k) +
                       " /* " +
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      " */ = {isa = PBXFileReference; "+
                      fileEncoding +
                      "lastKnownFileType = " +
                      fileType +
                      "; path = "+
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      "; sourceTree = \"<group>\"; };\n";
                Change3 = Change3 + "\n " +
                      selectedFilesToIncludeHex2.get(k) +
                      " /* " +
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      " */,";
                Change4 = Change4 + "\n " +
                      selectedFilesToIncludeHex1.get(k) +
                      " /* " +
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      " in Resources */,";

              } // closed the for loop
   
Once the text blocks are built, these are the regexp I used to put them in the right place

              xCodeProjFileContents = FileLoaderAndSaver.loadFile(newXCodeProjFile, this); // this is my routine to load the file in a string
              xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXBuildFile\\ssection\\s\\*/", Change1 + "/* End PBXBuildFile section */");
              xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXFileReference\\ssection\\s\\*/", Change2 + "/* End PBXFileReference section */");
              xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sCustomTemplate\\s\\*/\\s\\=\\s\\{[\\n\\s\\t]*isa\\s\\=\\sPBXGroup\\;[\\n\\s\\t]*children\\s\\=\\s\\(", "/* CustomTemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (" + Change3);
              xCodeProjFileContents = xCodeProjFileContents.replaceAll("\\)\\;[\\n\\s\\t]*runOnlyForDeploymentPostprocessing\\s\\=\\s0\\;[\\n\\s\\t]*\\}\\;[\\n\\s\\t]*/\\*\\sEnd\\sPBXResourcesBuildPhase\\ssection\\s\\*/", Change4 + ");\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\t};\n/* End PBXResourcesBuildPhase section */");
              FileLoaderAndSaver.saveFile( newXCodeProjFile , xCodeProjFileContents , this); // another routine to save the file

Hope the formatting came out allright.

D
-
Davide Della Casa

On 21 Feb 2011, at 17:46, Paul Zirkle wrote:

I'm currently working on my own engine (instead of using NME, sorry!) for cross platform mobile development, however if this project file system seems beneficial, I may try to use it as well.

-Paul Zirkle

On Mon, Feb 21, 2011 at 9:34 AM, Davide Della Casa <[hidden email]> wrote:
Hi Hugh, All,

I recently made a java program that modifies the XCode project.pbxproj file so to correctly reference any files you may want to add to the App package.

There are two hashes that one needs to include in 4 places and a couple of extra fields like a filetype and file encoding.

Seems to work pretty well (considering that the reverse-engineering of the hashes is very crude - but apparently it's good enough), let me know if that could be useful to create the XCode project.

D

On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:

>
> Hi,
> There have been a few questions about getting started with hxcpp/NME,
> so I thought I would give a quick update on my current theories
> for the next version on NME.
>
> I have been working on a project system for NME.
> The idea is that you write a "project" file instead of a .hxml file.
> From this file, all the boiler-plate project + code files are generated
> for the various different targets.  These files are "disposable", so
> you can blow them away every night if you wish and start again.
> Your "precious" files are your source code, your assets and your
> single project file, and I would expect these to be under source control,
> and everything else can get trashed. I have only looked at NME sample 06
> at this stage, but the project looks like this:
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <project>
>
>  <app
>     file="Sample06"
>     title="NME Sample 06 - Drums"
>     package="org.haxe.nme.sample06"
>     version="1.0"
>     company="nme"
>         main="Sample"
>  />
>
>  <window
>      width="400"
>      height="300"
>      orientation="landscape"
>      fps="60"
>      background="0xffffff"
>      resizeable="true"
>      hardware="true"
>       />
>
>
>  <classpath name="." />
>  <haxelib name="nme" />
>
>  <assets>
>     <asset name="Data/drum_kit.jpg" />
>     <asset name="Data/bang.png"     />
>     <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>     <sound name="Data/drum.ogg"     />
>     <sound name="Data/bass.wav"     />
>     <sound name="Data/drums.ogg"   />
>  </assets>
>
>
>  <ndll name="std" />
>  <ndll name="regexp" />
>  <ndll name="zlib" />
>  <ndll name="nme" haxelib="nme" nekoapi="1"/>
>
>  <certificates>
>     <certificate file="signature.cer" name="mysign" password="ajkhsakjhf" />
>  </certificates>
>
> </project>
>
>
> As you may or may not see, I use pretty much the same architecture as
> I did the the hxcpp build tool.
>
> From this, I can already create windows hxcpp or neko foilders and Android Apks.
> I'm working on iPhone xcode projects and GHP/Caanoo installs.
> I intend to push this with windows NSIS installers, mac dmgs, linux (tar files???)
> and swf scp so you can go from haxe file to installer with one step.
> The "certificates" part is crap at the moment - haven't quite worked out what
> to do there.  Also thinking about having vector-based icons that can be
> rendered to different resolutions.
> I have not started the flash code, but it will probably use an external tool
> such as swfmill, can create that project file from this one.
> The haxe.Template code make most of this quite easy.
>
> I am also moving the window creation code into the templates to make a direct port
> of the flash code easier.
>
> The procedure will go like this:
> 0. Install a whole bunch of thirdparty tools
> 1. write haxe code
> 2. write project file
> 3. run anywhere/profit.
>
> Maybe with closer integration with FlashDevelop, or some kind of gui app,
> step 2 may become trivial.
>
> So if anyone has any comments on this, or would like to contribute (especially
> with mac or linux installers) please speak up.
>
> Hugh
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

davidedc
To give a specific name to an XCode project, this is how I did it (again, not catering for whitespaces):

 - rename the plist file to [projectName]-Info.plist
 - rename xcodeproj directory to [projectName].xcodeproj
 - replace all the occurrences of the old project name inside the pbxproj file in the xcodeproj directory

This grok and the previous grok so far produced functional XCode project directories correctly referencing files (the files were copied in the project folder by the way - the previous grok is likely not to work if you want to link files coming from other locations).

D

On 21 Feb 2011, at 18:44, Davide Della Casa wrote:

OK here is how I grokked it in case it helps.

(Caveat: I didn't cater for whitespaces in the filenames yet.)

There are three files in the XCode .xcodeproj project directory. The only important one is the project.pbxproj file, I trash the other two as they seem to contain satellite preferences and bookmarks, windows positions etc. and they are automatically created without problems. Four text blocks need to be added to the pbxproj file. Each text block contains one line for each file to be included in the package.

For each file to add in the App package there are two hashes that need to be calculated. XCode seems to be relaxed about those as far as they cross-reference correctly - I calculated them like this so they look pretty similar to what I saw XCode generate with an example I fed it.

              Vector selectedFilesToIncludeHex1 = new Vector();
              Vector selectedFilesToIncludeHex2 = new Vector();
              for (int k = 0; k < selectedFilesToIncludePath.size(); k++) {
                String completeHex1 = "C489DF"+Integer.toHexString(k+233).toUpperCase() +"130E90F900C81312";
                String completeHex2 = "C489DF"+Integer.toHexString(k+224).toUpperCase() +"130E90F800C81312";
                selectedFilesToIncludeHex1.add(completeHex1);
                selectedFilesToIncludeHex2.add(completeHex2);
              }

There are four text blocks that need to be inserted:

              String Change1 = "" ;
              String Change2 = "" ;
              String Change3 = "" ;
              String Change4 = "" ;

Also there are two additional fields that are needed in a couple of those blocks: filetype and file encoding. I prepare the strings based on the file extension (that I keep in the selectedFilesToIncludeExtension Vector) like this:


              String fileType = "" ;
              String fileEncoding = "" ;

              for (int k = 0; k < selectedFilesToIncludePath.size(); k++) {
                if (selectedFilesToIncludeExtension.get(k).equals("xml")) {
                  fileType = "text.xml";
                  fileEncoding = "fileEncoding = 4; ";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("txt")) {
                  fileType = "text";
                  fileEncoding = "fileEncoding = 4; ";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("mp3")) {
                  fileType = "audio.mp3";
                  fileEncoding = "";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("png")) {
                  fileType = "image.png";
                  fileEncoding = "";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("jpg")) {
                  fileType = "image.jpeg";
                  fileEncoding = "";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("gif")) {
                  fileType = "image.gif";
                  fileEncoding = "";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("aiff")) {
                  fileType = "audio.aiff";
                  fileEncoding = "";
                }
                else if (selectedFilesToIncludeExtension.get(k).equals("wav")) {
                  fileType = "audio.wav";
                  fileEncoding = "";
                }
                else{
                  fileType = "file";
                  fileEncoding = "";
                }

In the same loop as above, for each file I build 4 text blocks that need to be inserted in the project file:

                Change1 = Change1 +
                      " " + selectedFilesToIncludeHex1.get(k) + " /* " +
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      " in Resources */ = {isa = PBXBuildFile; "+
                      "fileRef = " +
                      selectedFilesToIncludeHex2.get(k) +
                      " /* " +
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      " */; };\n";

                Change2 = Change2 + " " +
                      selectedFilesToIncludeHex2.get(k) +
                       " /* " +
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      " */ = {isa = PBXFileReference; "+
                      fileEncoding +
                      "lastKnownFileType = " +
                      fileType +
                      "; path = "+
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      "; sourceTree = \"<group>\"; };\n";
                Change3 = Change3 + "\n " +
                      selectedFilesToIncludeHex2.get(k) +
                      " /* " +
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      " */,";
                Change4 = Change4 + "\n " +
                      selectedFilesToIncludeHex1.get(k) +
                      " /* " +
                      selectedFilesToIncludeNameWithExtension.get(k) +
                      " in Resources */,";

              } // closed the for loop
   
Once the text blocks are built, these are the regexp I used to put them in the right place

              xCodeProjFileContents = FileLoaderAndSaver.loadFile(newXCodeProjFile, this); // this is my routine to load the file in a string
              xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXBuildFile\\ssection\\s\\*/", Change1 + "/* End PBXBuildFile section */");
              xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXFileReference\\ssection\\s\\*/", Change2 + "/* End PBXFileReference section */");
              xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sCustomTemplate\\s\\*/\\s\\=\\s\\{[\\n\\s\\t]*isa\\s\\=\\sPBXGroup\\;[\\n\\s\\t]*children\\s\\=\\s\\(", "/* CustomTemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (" + Change3);
              xCodeProjFileContents = xCodeProjFileContents.replaceAll("\\)\\;[\\n\\s\\t]*runOnlyForDeploymentPostprocessing\\s\\=\\s0\\;[\\n\\s\\t]*\\}\\;[\\n\\s\\t]*/\\*\\sEnd\\sPBXResourcesBuildPhase\\ssection\\s\\*/", Change4 + ");\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\t};\n/* End PBXResourcesBuildPhase section */");
              FileLoaderAndSaver.saveFile( newXCodeProjFile , xCodeProjFileContents , this); // another routine to save the file

Hope the formatting came out allright.

D
-
Davide Della Casa

On 21 Feb 2011, at 17:46, Paul Zirkle wrote:

I'm currently working on my own engine (instead of using NME, sorry!) for cross platform mobile development, however if this project file system seems beneficial, I may try to use it as well.

-Paul Zirkle

On Mon, Feb 21, 2011 at 9:34 AM, Davide Della Casa <[hidden email]> wrote:
Hi Hugh, All,

I recently made a java program that modifies the XCode project.pbxproj file so to correctly reference any files you may want to add to the App package.

There are two hashes that one needs to include in 4 places and a couple of extra fields like a filetype and file encoding.

Seems to work pretty well (considering that the reverse-engineering of the hashes is very crude - but apparently it's good enough), let me know if that could be useful to create the XCode project.

D

On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:

>
> Hi,
> There have been a few questions about getting started with hxcpp/NME,
> so I thought I would give a quick update on my current theories
> for the next version on NME.
>
> I have been working on a project system for NME.
> The idea is that you write a "project" file instead of a .hxml file.
> From this file, all the boiler-plate project + code files are generated
> for the various different targets.  These files are "disposable", so
> you can blow them away every night if you wish and start again.
> Your "precious" files are your source code, your assets and your
> single project file, and I would expect these to be under source control,
> and everything else can get trashed. I have only looked at NME sample 06
> at this stage, but the project looks like this:
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <project>
>
>  <app
>     file="Sample06"
>     title="NME Sample 06 - Drums"
>     package="org.haxe.nme.sample06"
>     version="1.0"
>     company="nme"
>         main="Sample"
>  />
>
>  <window
>      width="400"
>      height="300"
>      orientation="landscape"
>      fps="60"
>      background="0xffffff"
>      resizeable="true"
>      hardware="true"
>       />
>
>
>  <classpath name="." />
>  <haxelib name="nme" />
>
>  <assets>
>     <asset name="Data/drum_kit.jpg" />
>     <asset name="Data/bang.png"     />
>     <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>     <sound name="Data/drum.ogg"     />
>     <sound name="Data/bass.wav"     />
>     <sound name="Data/drums.ogg"   />
>  </assets>
>
>
>  <ndll name="std" />
>  <ndll name="regexp" />
>  <ndll name="zlib" />
>  <ndll name="nme" haxelib="nme" nekoapi="1"/>
>
>  <certificates>
>     <certificate file="signature.cer" name="mysign" password="ajkhsakjhf" />
>  </certificates>
>
> </project>
>
>
> As you may or may not see, I use pretty much the same architecture as
> I did the the hxcpp build tool.
>
> From this, I can already create windows hxcpp or neko foilders and Android Apks.
> I'm working on iPhone xcode projects and GHP/Caanoo installs.
> I intend to push this with windows NSIS installers, mac dmgs, linux (tar files???)
> and swf scp so you can go from haxe file to installer with one step.
> The "certificates" part is crap at the moment - haven't quite worked out what
> to do there.  Also thinking about having vector-based icons that can be
> rendered to different resolutions.
> I have not started the flash code, but it will probably use an external tool
> such as swfmill, can create that project file from this one.
> The haxe.Template code make most of this quite easy.
>
> I am also moving the window creation code into the templates to make a direct port
> of the flash code easier.
>
> The procedure will go like this:
> 0. Install a whole bunch of thirdparty tools
> 1. write haxe code
> 2. write project file
> 3. run anywhere/profit.
>
> Maybe with closer integration with FlashDevelop, or some kind of gui app,
> step 2 may become trivial.
>
> So if anyone has any comments on this, or would like to contribute (especially
> with mac or linux installers) please speak up.
>
> Hugh
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

Gamehaxe
Hi Davide,
This is just the sort of info I was after - I'll see what I can make of it.
I wonder if any unique has will do, eg md5 of the filepath?

Paul Zirkle, the nme project should also be useful for other projects.
Currently it assumes an NME specific starting point, but that can easily  
be changed.
I have already though about using it for command-line apps,
so another graphics system should be no different.

Hugh

> To give a specific name to an XCode project, this is how I did it  
> (again, not catering for whitespaces):
>
>  - rename the plist file to [projectName]-Info.plist
>  - rename xcodeproj directory to [projectName].xcodeproj
>  - replace all the occurrences of the old project name inside the  
> pbxproj file in the xcodeproj directory
>
> This grok and the previous grok so far produced functional XCode project  
> directories correctly referencing files (the files were copied in the  
> project folder by the way - the previous grok is likely not to work if  
> you want to link files coming from other locations).
>
> D
>
> On 21 Feb 2011, at 18:44, Davide Della Casa wrote:
>
>> OK here is how I grokked it in case it helps.
>>
>> (Caveat: I didn't cater for whitespaces in the filenames yet.)
>>
>> There are three files in the XCode .xcodeproj project directory. The  
>> only important one is the project.pbxproj file, I trash the other two  
>> as they seem to contain satellite preferences and bookmarks, windows  
>> positions etc. and they are automatically created without problems.  
>> Four text blocks need to be added to the pbxproj file. Each text block  
>> contains one line for each file to be included in the package.
>>
>> For each file to add in the App package there are two hashes that need  
>> to be calculated. XCode seems to be relaxed about those as far as they  
>> cross-reference correctly - I calculated them like this so they look  
>> pretty similar to what I saw XCode generate with an example I fed it.
>>
>>               Vector selectedFilesToIncludeHex1 = new Vector();
>>               Vector selectedFilesToIncludeHex2 = new Vector();
>>               for (int k = 0; k < selectedFilesToIncludePath.size();  
>> k++) {
>>                 String completeHex1 =  
>> "C489DF"+Integer.toHexString(k+233).toUpperCase() +"130E90F900C81312";
>>                 String completeHex2 =  
>> "C489DF"+Integer.toHexString(k+224).toUpperCase() +"130E90F800C81312";
>>                 selectedFilesToIncludeHex1.add(completeHex1);
>>                 selectedFilesToIncludeHex2.add(completeHex2);
>>               }
>>
>> There are four text blocks that need to be inserted:
>>
>>               String Change1 = "" ;
>>               String Change2 = "" ;
>>               String Change3 = "" ;
>>               String Change4 = "" ;
>>
>> Also there are two additional fields that are needed in a couple of  
>> those blocks: filetype and file encoding. I prepare the strings based  
>> on the file extension (that I keep in the  
>> selectedFilesToIncludeExtension Vector) like this:
>>
>>
>>               String fileType = "" ;
>>               String fileEncoding = "" ;
>>
>>               for (int k = 0; k < selectedFilesToIncludePath.size();  
>> k++) {
>>                 if  
>> (selectedFilesToIncludeExtension.get(k).equals("xml")) {
>>                   fileType = "text.xml";
>>                   fileEncoding = "fileEncoding = 4; ";
>>                 }
>>                 else if  
>> (selectedFilesToIncludeExtension.get(k).equals("txt")) {
>>                   fileType = "text";
>>                   fileEncoding = "fileEncoding = 4; ";
>>                 }
>>                 else if  
>> (selectedFilesToIncludeExtension.get(k).equals("mp3")) {
>>                   fileType = "audio.mp3";
>>                   fileEncoding = "";
>>                 }
>>                 else if  
>> (selectedFilesToIncludeExtension.get(k).equals("png")) {
>>                   fileType = "image.png";
>>                   fileEncoding = "";
>>                 }
>>                 else if  
>> (selectedFilesToIncludeExtension.get(k).equals("jpg")) {
>>                   fileType = "image.jpeg";
>>                   fileEncoding = "";
>>                 }
>>                 else if  
>> (selectedFilesToIncludeExtension.get(k).equals("gif")) {
>>                   fileType = "image.gif";
>>                   fileEncoding = "";
>>                 }
>>                 else if  
>> (selectedFilesToIncludeExtension.get(k).equals("aiff")) {
>>                   fileType = "audio.aiff";
>>                   fileEncoding = "";
>>                 }
>>                 else if  
>> (selectedFilesToIncludeExtension.get(k).equals("wav")) {
>>                   fileType = "audio.wav";
>>                   fileEncoding = "";
>>                 }
>>                 else{
>>                   fileType = "file";
>>                   fileEncoding = "";
>>                 }
>>
>> In the same loop as above, for each file I build 4 text blocks that  
>> need to be inserted in the project file:
>>
>>                 Change1 = Change1 +
>>                       " " + selectedFilesToIncludeHex1.get(k) + " /* "  
>> +
>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>                       " in Resources */ = {isa = PBXBuildFile; "+
>>                       "fileRef = " +
>>                       selectedFilesToIncludeHex2.get(k) +
>>                       " /* " +
>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>                       " */; };\n";
>>
>>                 Change2 = Change2 + " " +
>>                       selectedFilesToIncludeHex2.get(k) +
>>                        " /* " +
>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>                       " */ = {isa = PBXFileReference; "+
>>                       fileEncoding +
>>                       "lastKnownFileType = " +
>>                       fileType +
>>                       "; path = "+
>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>                       "; sourceTree = \"<group>\"; };\n";
>>                 Change3 = Change3 + "\n " +
>>                       selectedFilesToIncludeHex2.get(k) +
>>                       " /* " +
>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>                       " */,";
>>                 Change4 = Change4 + "\n " +
>>                       selectedFilesToIncludeHex1.get(k) +
>>                       " /* " +
>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>                       " in Resources */,";
>>
>>               } // closed the for loop
>>
>> Once the text blocks are built, these are the regexp I used to put them  
>> in the right place
>>
>>               xCodeProjFileContents =  
>> FileLoaderAndSaver.loadFile(newXCodeProjFile, this); // this is my  
>> routine to load the file in a string
>>               xCodeProjFileContents =  
>> xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXBuildFile\\ssection\\s\\*/",  
>> Change1 + "/* End PBXBuildFile section */");
>>               xCodeProjFileContents =  
>> xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXFileReference\\ssection\\s\\*/",  
>> Change2 + "/* End PBXFileReference section */");
>>               xCodeProjFileContents =  
>> xCodeProjFileContents.replaceAll("/\\*\\sCustomTemplate\\s\\*/\\s\\=\\s\\{[\\n\\s\\t]*isa\\s\\=\\sPBXGroup\\;[\\n\\s\\t]*children\\s\\=\\s\\(",  
>> "/* CustomTemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (" +  
>> Change3);
>>               xCodeProjFileContents =  
>> xCodeProjFileContents.replaceAll("\\)\\;[\\n\\s\\t]*runOnlyForDeploymentPostprocessing\\s\\=\\s0\\;[\\n\\s\\t]*\\}\\;[\\n\\s\\t]*/\\*\\sEnd\\sPBXResourcesBuildPhase\\ssection\\s\\*/",  
>> Change4 + ");\n\t\t\trunOnlyForDeploymentPostprocessing =  
>> 0;\n\t\t\t};\n/* End PBXResourcesBuildPhase section */");
>>               FileLoaderAndSaver.saveFile( newXCodeProjFile ,  
>> xCodeProjFileContents , this); // another routine to save the file
>>
>> Hope the formatting came out allright.
>>
>> D
>> -
>> Davide Della Casa
>>
>> On 21 Feb 2011, at 17:46, Paul Zirkle wrote:
>>
>>> I'm currently working on my own engine (instead of using NME, sorry!)  
>>> for cross platform mobile development, however if this project file  
>>> system seems beneficial, I may try to use it as well.
>>>
>>> -Paul Zirkle
>>>
>>> On Mon, Feb 21, 2011 at 9:34 AM, Davide Della Casa  
>>> <[hidden email]> wrote:
>>> Hi Hugh, All,
>>>
>>> I recently made a java program that modifies the XCode project.pbxproj  
>>> file so to correctly reference any files you may want to add to the  
>>> App package.
>>>
>>> There are two hashes that one needs to include in 4 places and a  
>>> couple of extra fields like a filetype and file encoding.
>>>
>>> Seems to work pretty well (considering that the reverse-engineering of  
>>> the hashes is very crude - but apparently it's good enough), let me  
>>> know if that could be useful to create the XCode project.
>>>
>>> D
>>>
>>> On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:
>>>
>>> >
>>> > Hi,
>>> > There have been a few questions about getting started with hxcpp/NME,
>>> > so I thought I would give a quick update on my current theories
>>> > for the next version on NME.
>>> >
>>> > I have been working on a project system for NME.
>>> > The idea is that you write a "project" file instead of a .hxml file.
>>> > From this file, all the boiler-plate project + code files are  
>>> generated
>>> > for the various different targets.  These files are "disposable", so
>>> > you can blow them away every night if you wish and start again.
>>> > Your "precious" files are your source code, your assets and your
>>> > single project file, and I would expect these to be under source  
>>> control,
>>> > and everything else can get trashed. I have only looked at NME  
>>> sample 06
>>> > at this stage, but the project looks like this:
>>> >
>>> >
>>> > <?xml version="1.0" encoding="utf-8"?>
>>> > <project>
>>> >
>>> >  <app
>>> >     file="Sample06"
>>> >     title="NME Sample 06 - Drums"
>>> >     package="org.haxe.nme.sample06"
>>> >     version="1.0"
>>> >     company="nme"
>>> >         main="Sample"
>>> >  />
>>> >
>>> >  <window
>>> >      width="400"
>>> >      height="300"
>>> >      orientation="landscape"
>>> >      fps="60"
>>> >      background="0xffffff"
>>> >      resizeable="true"
>>> >      hardware="true"
>>> >       />
>>> >
>>> >
>>> >  <classpath name="." />
>>> >  <haxelib name="nme" />
>>> >
>>> >  <assets>
>>> >     <asset name="Data/drum_kit.jpg" />
>>> >     <asset name="Data/bang.png"     />
>>> >     <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>>> >     <sound name="Data/drum.ogg"     />
>>> >     <sound name="Data/bass.wav"     />
>>> >     <sound name="Data/drums.ogg"   />
>>> >  </assets>
>>> >
>>> >
>>> >  <ndll name="std" />
>>> >  <ndll name="regexp" />
>>> >  <ndll name="zlib" />
>>> >  <ndll name="nme" haxelib="nme" nekoapi="1"/>
>>> >
>>> >  <certificates>
>>> >     <certificate file="signature.cer" name="mysign"  
>>> password="ajkhsakjhf" />
>>> >  </certificates>
>>> >
>>> > </project>
>>> >
>>> >
>>> > As you may or may not see, I use pretty much the same architecture as
>>> > I did the the hxcpp build tool.
>>> >
>>> > From this, I can already create windows hxcpp or neko foilders and  
>>> Android Apks.
>>> > I'm working on iPhone xcode projects and GHP/Caanoo installs.
>>> > I intend to push this with windows NSIS installers, mac dmgs, linux  
>>> (tar files???)
>>> > and swf scp so you can go from haxe file to installer with one step.
>>> > The "certificates" part is crap at the moment - haven't quite worked  
>>> out what
>>> > to do there.  Also thinking about having vector-based icons that can  
>>> be
>>> > rendered to different resolutions.
>>> > I have not started the flash code, but it will probably use an  
>>> external tool
>>> > such as swfmill, can create that project file from this one.
>>> > The haxe.Template code make most of this quite easy.
>>> >
>>> > I am also moving the window creation code into the templates to make  
>>> a direct port
>>> > of the flash code easier.
>>> >
>>> > The procedure will go like this:
>>> > 0. Install a whole bunch of thirdparty tools
>>> > 1. write haxe code
>>> > 2. write project file
>>> > 3. run anywhere/profit.
>>> >
>>> > Maybe with closer integration with FlashDevelop, or some kind of gui  
>>> app,
>>> > step 2 may become trivial.
>>> >
>>> > So if anyone has any comments on this, or would like to contribute  
>>> (especially
>>> > with mac or linux installers) please speak up.
>>> >
>>> > Hugh
>>> >
>>> > --
>>> > haXe - an open source web programming language
>>> > http://haxe.org
>>>
>>>
>>> --
>>> haXe - an open source web programming language
>>> http://haxe.org
>>>
>>> --
>>> haXe - an open source web programming language
>>> http://haxe.org
>>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

davidedc
Yes any unique will do. If you have six files, the 12 "hashes" can just be the numbers 1...12, XCode re-writes those to correct values when opening.

Also, I noticed that the filetype can be set to "dummy" and XCode re-calculates that when opening too, so all that code that looks at the extension can be binned.

Not so with the file encoding string: I tried to put a dummy number there, XCode opened fine but re-calculated the dummies to 16 digits numbers that don't look too sane - so maybe it's worth putting that "fileEncoding = 4; " for all the text-type files (and other assets such as images/sounds don't seem to require the fileEncoding).

I've done some googling ( http://www.google.co.uk/search?q="fileEncoding+%3D"+~+"lastKnownFileType" ) and there seem to be the following encodings: 0,3,4,5,7,8,10,12,15,21,30 - it doesn't ring any bell to me (no it's not the "Lost" numbers :-).


On 21 Feb 2011, at 23:57, Hugh Sanderson wrote:

> Hi Davide,
> This is just the sort of info I was after - I'll see what I can make of it.
> I wonder if any unique has will do, eg md5 of the filepath?
>
> Paul Zirkle, the nme project should also be useful for other projects.
> Currently it assumes an NME specific starting point, but that can easily be changed.
> I have already though about using it for command-line apps,
> so another graphics system should be no different.
>
> Hugh
>
>> To give a specific name to an XCode project, this is how I did it (again, not catering for whitespaces):
>>
>> - rename the plist file to [projectName]-Info.plist
>> - rename xcodeproj directory to [projectName].xcodeproj
>> - replace all the occurrences of the old project name inside the pbxproj file in the xcodeproj directory
>>
>> This grok and the previous grok so far produced functional XCode project directories correctly referencing files (the files were copied in the project folder by the way - the previous grok is likely not to work if you want to link files coming from other locations).
>>
>> D
>>
>> On 21 Feb 2011, at 18:44, Davide Della Casa wrote:
>>
>>> OK here is how I grokked it in case it helps.
>>>
>>> (Caveat: I didn't cater for whitespaces in the filenames yet.)
>>>
>>> There are three files in the XCode .xcodeproj project directory. The only important one is the project.pbxproj file, I trash the other two as they seem to contain satellite preferences and bookmarks, windows positions etc. and they are automatically created without problems. Four text blocks need to be added to the pbxproj file. Each text block contains one line for each file to be included in the package.
>>>
>>> For each file to add in the App package there are two hashes that need to be calculated. XCode seems to be relaxed about those as far as they cross-reference correctly - I calculated them like this so they look pretty similar to what I saw XCode generate with an example I fed it.
>>>
>>>              Vector selectedFilesToIncludeHex1 = new Vector();
>>>              Vector selectedFilesToIncludeHex2 = new Vector();
>>>              for (int k = 0; k < selectedFilesToIncludePath.size(); k++) {
>>>                String completeHex1 = "C489DF"+Integer.toHexString(k+233).toUpperCase() +"130E90F900C81312";
>>>                String completeHex2 = "C489DF"+Integer.toHexString(k+224).toUpperCase() +"130E90F800C81312";
>>>                selectedFilesToIncludeHex1.add(completeHex1);
>>>                selectedFilesToIncludeHex2.add(completeHex2);
>>>              }
>>>
>>> There are four text blocks that need to be inserted:
>>>
>>>              String Change1 = "" ;
>>>              String Change2 = "" ;
>>>              String Change3 = "" ;
>>>              String Change4 = "" ;
>>>
>>> Also there are two additional fields that are needed in a couple of those blocks: filetype and file encoding. I prepare the strings based on the file extension (that I keep in the selectedFilesToIncludeExtension Vector) like this:
>>>
>>>
>>>              String fileType = "" ;
>>>              String fileEncoding = "" ;
>>>
>>>              for (int k = 0; k < selectedFilesToIncludePath.size(); k++) {
>>>                if (selectedFilesToIncludeExtension.get(k).equals("xml")) {
>>>                  fileType = "text.xml";
>>>                  fileEncoding = "fileEncoding = 4; ";
>>>                }
>>>                else if (selectedFilesToIncludeExtension.get(k).equals("txt")) {
>>>                  fileType = "text";
>>>                  fileEncoding = "fileEncoding = 4; ";
>>>                }
>>>                else if (selectedFilesToIncludeExtension.get(k).equals("mp3")) {
>>>                  fileType = "audio.mp3";
>>>                  fileEncoding = "";
>>>                }
>>>                else if (selectedFilesToIncludeExtension.get(k).equals("png")) {
>>>                  fileType = "image.png";
>>>                  fileEncoding = "";
>>>                }
>>>                else if (selectedFilesToIncludeExtension.get(k).equals("jpg")) {
>>>                  fileType = "image.jpeg";
>>>                  fileEncoding = "";
>>>                }
>>>                else if (selectedFilesToIncludeExtension.get(k).equals("gif")) {
>>>                  fileType = "image.gif";
>>>                  fileEncoding = "";
>>>                }
>>>                else if (selectedFilesToIncludeExtension.get(k).equals("aiff")) {
>>>                  fileType = "audio.aiff";
>>>                  fileEncoding = "";
>>>                }
>>>                else if (selectedFilesToIncludeExtension.get(k).equals("wav")) {
>>>                  fileType = "audio.wav";
>>>                  fileEncoding = "";
>>>                }
>>>                else{
>>>                  fileType = "file";
>>>                  fileEncoding = "";
>>>                }
>>>
>>> In the same loop as above, for each file I build 4 text blocks that need to be inserted in the project file:
>>>
>>>                Change1 = Change1 +
>>>                      " " + selectedFilesToIncludeHex1.get(k) + " /* " +
>>>                      selectedFilesToIncludeNameWithExtension.get(k) +
>>>                      " in Resources */ = {isa = PBXBuildFile; "+
>>>                      "fileRef = " +
>>>                      selectedFilesToIncludeHex2.get(k) +
>>>                      " /* " +
>>>                      selectedFilesToIncludeNameWithExtension.get(k) +
>>>                      " */; };\n";
>>>
>>>                Change2 = Change2 + " " +
>>>                      selectedFilesToIncludeHex2.get(k) +
>>>                       " /* " +
>>>                      selectedFilesToIncludeNameWithExtension.get(k) +
>>>                      " */ = {isa = PBXFileReference; "+
>>>                      fileEncoding +
>>>                      "lastKnownFileType = " +
>>>                      fileType +
>>>                      "; path = "+
>>>                      selectedFilesToIncludeNameWithExtension.get(k) +
>>>                      "; sourceTree = \"<group>\"; };\n";
>>>                Change3 = Change3 + "\n " +
>>>                      selectedFilesToIncludeHex2.get(k) +
>>>                      " /* " +
>>>                      selectedFilesToIncludeNameWithExtension.get(k) +
>>>                      " */,";
>>>                Change4 = Change4 + "\n " +
>>>                      selectedFilesToIncludeHex1.get(k) +
>>>                      " /* " +
>>>                      selectedFilesToIncludeNameWithExtension.get(k) +
>>>                      " in Resources */,";
>>>
>>>              } // closed the for loop
>>>
>>> Once the text blocks are built, these are the regexp I used to put them in the right place
>>>
>>>              xCodeProjFileContents = FileLoaderAndSaver.loadFile(newXCodeProjFile, this); // this is my routine to load the file in a string
>>>              xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXBuildFile\\ssection\\s\\*/", Change1 + "/* End PBXBuildFile section */");
>>>              xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXFileReference\\ssection\\s\\*/", Change2 + "/* End PBXFileReference section */");
>>>              xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sCustomTemplate\\s\\*/\\s\\=\\s\\{[\\n\\s\\t]*isa\\s\\=\\sPBXGroup\\;[\\n\\s\\t]*children\\s\\=\\s\\(", "/* CustomTemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (" + Change3);
>>>              xCodeProjFileContents = xCodeProjFileContents.replaceAll("\\)\\;[\\n\\s\\t]*runOnlyForDeploymentPostprocessing\\s\\=\\s0\\;[\\n\\s\\t]*\\}\\;[\\n\\s\\t]*/\\*\\sEnd\\sPBXResourcesBuildPhase\\ssection\\s\\*/", Change4 + ");\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\t};\n/* End PBXResourcesBuildPhase section */");
>>>              FileLoaderAndSaver.saveFile( newXCodeProjFile , xCodeProjFileContents , this); // another routine to save the file
>>>
>>> Hope the formatting came out allright.
>>>
>>> D
>>> -
>>> Davide Della Casa
>>>
>>> On 21 Feb 2011, at 17:46, Paul Zirkle wrote:
>>>
>>>> I'm currently working on my own engine (instead of using NME, sorry!) for cross platform mobile development, however if this project file system seems beneficial, I may try to use it as well.
>>>>
>>>> -Paul Zirkle
>>>>
>>>> On Mon, Feb 21, 2011 at 9:34 AM, Davide Della Casa <[hidden email]> wrote:
>>>> Hi Hugh, All,
>>>>
>>>> I recently made a java program that modifies the XCode project.pbxproj file so to correctly reference any files you may want to add to the App package.
>>>>
>>>> There are two hashes that one needs to include in 4 places and a couple of extra fields like a filetype and file encoding.
>>>>
>>>> Seems to work pretty well (considering that the reverse-engineering of the hashes is very crude - but apparently it's good enough), let me know if that could be useful to create the XCode project.
>>>>
>>>> D
>>>>
>>>> On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:
>>>>
>>>> >
>>>> > Hi,
>>>> > There have been a few questions about getting started with hxcpp/NME,
>>>> > so I thought I would give a quick update on my current theories
>>>> > for the next version on NME.
>>>> >
>>>> > I have been working on a project system for NME.
>>>> > The idea is that you write a "project" file instead of a .hxml file.
>>>> > From this file, all the boiler-plate project + code files are generated
>>>> > for the various different targets.  These files are "disposable", so
>>>> > you can blow them away every night if you wish and start again.
>>>> > Your "precious" files are your source code, your assets and your
>>>> > single project file, and I would expect these to be under source control,
>>>> > and everything else can get trashed. I have only looked at NME sample 06
>>>> > at this stage, but the project looks like this:
>>>> >
>>>> >
>>>> > <?xml version="1.0" encoding="utf-8"?>
>>>> > <project>
>>>> >
>>>> >  <app
>>>> >     file="Sample06"
>>>> >     title="NME Sample 06 - Drums"
>>>> >     package="org.haxe.nme.sample06"
>>>> >     version="1.0"
>>>> >     company="nme"
>>>> >         main="Sample"
>>>> >  />
>>>> >
>>>> >  <window
>>>> >      width="400"
>>>> >      height="300"
>>>> >      orientation="landscape"
>>>> >      fps="60"
>>>> >      background="0xffffff"
>>>> >      resizeable="true"
>>>> >      hardware="true"
>>>> >       />
>>>> >
>>>> >
>>>> >  <classpath name="." />
>>>> >  <haxelib name="nme" />
>>>> >
>>>> >  <assets>
>>>> >     <asset name="Data/drum_kit.jpg" />
>>>> >     <asset name="Data/bang.png"     />
>>>> >     <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>>>> >     <sound name="Data/drum.ogg"     />
>>>> >     <sound name="Data/bass.wav"     />
>>>> >     <sound name="Data/drums.ogg"   />
>>>> >  </assets>
>>>> >
>>>> >
>>>> >  <ndll name="std" />
>>>> >  <ndll name="regexp" />
>>>> >  <ndll name="zlib" />
>>>> >  <ndll name="nme" haxelib="nme" nekoapi="1"/>
>>>> >
>>>> >  <certificates>
>>>> >     <certificate file="signature.cer" name="mysign" password="ajkhsakjhf" />
>>>> >  </certificates>
>>>> >
>>>> > </project>
>>>> >
>>>> >
>>>> > As you may or may not see, I use pretty much the same architecture as
>>>> > I did the the hxcpp build tool.
>>>> >
>>>> > From this, I can already create windows hxcpp or neko foilders and Android Apks.
>>>> > I'm working on iPhone xcode projects and GHP/Caanoo installs.
>>>> > I intend to push this with windows NSIS installers, mac dmgs, linux (tar files???)
>>>> > and swf scp so you can go from haxe file to installer with one step.
>>>> > The "certificates" part is crap at the moment - haven't quite worked out what
>>>> > to do there.  Also thinking about having vector-based icons that can be
>>>> > rendered to different resolutions.
>>>> > I have not started the flash code, but it will probably use an external tool
>>>> > such as swfmill, can create that project file from this one.
>>>> > The haxe.Template code make most of this quite easy.
>>>> >
>>>> > I am also moving the window creation code into the templates to make a direct port
>>>> > of the flash code easier.
>>>> >
>>>> > The procedure will go like this:
>>>> > 0. Install a whole bunch of thirdparty tools
>>>> > 1. write haxe code
>>>> > 2. write project file
>>>> > 3. run anywhere/profit.
>>>> >
>>>> > Maybe with closer integration with FlashDevelop, or some kind of gui app,
>>>> > step 2 may become trivial.
>>>> >
>>>> > So if anyone has any comments on this, or would like to contribute (especially
>>>> > with mac or linux installers) please speak up.
>>>> >
>>>> > Hugh
>>>> >
>>>> > --
>>>> > haXe - an open source web programming language
>>>> > http://haxe.org
>>>>
>>>>
>>>> --
>>>> haXe - an open source web programming language
>>>> http://haxe.org
>>>>
>>>> --
>>>> haXe - an open source web programming language
>>>> http://haxe.org
>>>


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

justin_mills
It would be nice to start moving away from Xcode dependancy for IPhone,
first maybe get something working on textmate...
http://www.pathf.com/blogs/2008/11/iphone-sdk-testing-with-textmate-gtm/

Then move to maybe not even depending on a mac, i did find a pdf doc
that covered an approach.  Having XCode do too much does not seem ideal,
it's like sometimes I want to see the hxml file in flashdevelop and
really I am against editor being dictated by the tech.

Le 22/02/2011 14:28, Davide Della Casa a écrit :

> Yes any unique will do. If you have six files, the 12 "hashes" can just be the numbers 1...12, XCode re-writes those to correct values when opening.
>
> Also, I noticed that the filetype can be set to "dummy" and XCode re-calculates that when opening too, so all that code that looks at the extension can be binned.
>
> Not so with the file encoding string: I tried to put a dummy number there, XCode opened fine but re-calculated the dummies to 16 digits numbers that don't look too sane - so maybe it's worth putting that "fileEncoding = 4; " for all the text-type files (and other assets such as images/sounds don't seem to require the fileEncoding).
>
> I've done some googling ( http://www.google.co.uk/search?q="fileEncoding+%3D"+~+"lastKnownFileType" ) and there seem to be the following encodings: 0,3,4,5,7,8,10,12,15,21,30 - it doesn't ring any bell to me (no it's not the "Lost" numbers :-).
>
>
> On 21 Feb 2011, at 23:57, Hugh Sanderson wrote:
>
>> Hi Davide,
>> This is just the sort of info I was after - I'll see what I can make of it.
>> I wonder if any unique has will do, eg md5 of the filepath?
>>
>> Paul Zirkle, the nme project should also be useful for other projects.
>> Currently it assumes an NME specific starting point, but that can easily be changed.
>> I have already though about using it for command-line apps,
>> so another graphics system should be no different.
>>
>> Hugh
>>
>>> To give a specific name to an XCode project, this is how I did it (again, not catering for whitespaces):
>>>
>>> - rename the plist file to [projectName]-Info.plist
>>> - rename xcodeproj directory to [projectName].xcodeproj
>>> - replace all the occurrences of the old project name inside the pbxproj file in the xcodeproj directory
>>>
>>> This grok and the previous grok so far produced functional XCode project directories correctly referencing files (the files were copied in the project folder by the way - the previous grok is likely not to work if you want to link files coming from other locations).
>>>
>>> D
>>>
>>> On 21 Feb 2011, at 18:44, Davide Della Casa wrote:
>>>
>>>> OK here is how I grokked it in case it helps.
>>>>
>>>> (Caveat: I didn't cater for whitespaces in the filenames yet.)
>>>>
>>>> There are three files in the XCode .xcodeproj project directory. The only important one is the project.pbxproj file, I trash the other two as they seem to contain satellite preferences and bookmarks, windows positions etc. and they are automatically created without problems. Four text blocks need to be added to the pbxproj file. Each text block contains one line for each file to be included in the package.
>>>>
>>>> For each file to add in the App package there are two hashes that need to be calculated. XCode seems to be relaxed about those as far as they cross-reference correctly - I calculated them like this so they look pretty similar to what I saw XCode generate with an example I fed it.
>>>>
>>>>               Vector selectedFilesToIncludeHex1 = new Vector();
>>>>               Vector selectedFilesToIncludeHex2 = new Vector();
>>>>               for (int k = 0; k<  selectedFilesToIncludePath.size(); k++) {
>>>>                 String completeHex1 = "C489DF"+Integer.toHexString(k+233).toUpperCase() +"130E90F900C81312";
>>>>                 String completeHex2 = "C489DF"+Integer.toHexString(k+224).toUpperCase() +"130E90F800C81312";
>>>>                 selectedFilesToIncludeHex1.add(completeHex1);
>>>>                 selectedFilesToIncludeHex2.add(completeHex2);
>>>>               }
>>>>
>>>> There are four text blocks that need to be inserted:
>>>>
>>>>               String Change1 = "" ;
>>>>               String Change2 = "" ;
>>>>               String Change3 = "" ;
>>>>               String Change4 = "" ;
>>>>
>>>> Also there are two additional fields that are needed in a couple of those blocks: filetype and file encoding. I prepare the strings based on the file extension (that I keep in the selectedFilesToIncludeExtension Vector) like this:
>>>>
>>>>
>>>>               String fileType = "" ;
>>>>               String fileEncoding = "" ;
>>>>
>>>>               for (int k = 0; k<  selectedFilesToIncludePath.size(); k++) {
>>>>                 if (selectedFilesToIncludeExtension.get(k).equals("xml")) {
>>>>                   fileType = "text.xml";
>>>>                   fileEncoding = "fileEncoding = 4; ";
>>>>                 }
>>>>                 else if (selectedFilesToIncludeExtension.get(k).equals("txt")) {
>>>>                   fileType = "text";
>>>>                   fileEncoding = "fileEncoding = 4; ";
>>>>                 }
>>>>                 else if (selectedFilesToIncludeExtension.get(k).equals("mp3")) {
>>>>                   fileType = "audio.mp3";
>>>>                   fileEncoding = "";
>>>>                 }
>>>>                 else if (selectedFilesToIncludeExtension.get(k).equals("png")) {
>>>>                   fileType = "image.png";
>>>>                   fileEncoding = "";
>>>>                 }
>>>>                 else if (selectedFilesToIncludeExtension.get(k).equals("jpg")) {
>>>>                   fileType = "image.jpeg";
>>>>                   fileEncoding = "";
>>>>                 }
>>>>                 else if (selectedFilesToIncludeExtension.get(k).equals("gif")) {
>>>>                   fileType = "image.gif";
>>>>                   fileEncoding = "";
>>>>                 }
>>>>                 else if (selectedFilesToIncludeExtension.get(k).equals("aiff")) {
>>>>                   fileType = "audio.aiff";
>>>>                   fileEncoding = "";
>>>>                 }
>>>>                 else if (selectedFilesToIncludeExtension.get(k).equals("wav")) {
>>>>                   fileType = "audio.wav";
>>>>                   fileEncoding = "";
>>>>                 }
>>>>                 else{
>>>>                   fileType = "file";
>>>>                   fileEncoding = "";
>>>>                 }
>>>>
>>>> In the same loop as above, for each file I build 4 text blocks that need to be inserted in the project file:
>>>>
>>>>                 Change1 = Change1 +
>>>>                       " " + selectedFilesToIncludeHex1.get(k) + " /* " +
>>>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>>>                       " in Resources */ = {isa = PBXBuildFile; "+
>>>>                       "fileRef = " +
>>>>                       selectedFilesToIncludeHex2.get(k) +
>>>>                       " /* " +
>>>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>>>                       " */; };\n";
>>>>
>>>>                 Change2 = Change2 + " " +
>>>>                       selectedFilesToIncludeHex2.get(k) +
>>>>                        " /* " +
>>>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>>>                       " */ = {isa = PBXFileReference; "+
>>>>                       fileEncoding +
>>>>                       "lastKnownFileType = " +
>>>>                       fileType +
>>>>                       "; path = "+
>>>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>>>                       "; sourceTree = \"<group>\"; };\n";
>>>>                 Change3 = Change3 + "\n " +
>>>>                       selectedFilesToIncludeHex2.get(k) +
>>>>                       " /* " +
>>>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>>>                       " */,";
>>>>                 Change4 = Change4 + "\n " +
>>>>                       selectedFilesToIncludeHex1.get(k) +
>>>>                       " /* " +
>>>>                       selectedFilesToIncludeNameWithExtension.get(k) +
>>>>                       " in Resources */,";
>>>>
>>>>               } // closed the for loop
>>>>
>>>> Once the text blocks are built, these are the regexp I used to put them in the right place
>>>>
>>>>               xCodeProjFileContents = FileLoaderAndSaver.loadFile(newXCodeProjFile, this); // this is my routine to load the file in a string
>>>>               xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXBuildFile\\ssection\\s\\*/", Change1 + "/* End PBXBuildFile section */");
>>>>               xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXFileReference\\ssection\\s\\*/", Change2 + "/* End PBXFileReference section */");
>>>>               xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sCustomTemplate\\s\\*/\\s\\=\\s\\{[\\n\\s\\t]*isa\\s\\=\\sPBXGroup\\;[\\n\\s\\t]*children\\s\\=\\s\\(", "/* CustomTemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (" + Change3);
>>>>               xCodeProjFileContents = xCodeProjFileContents.replaceAll("\\)\\;[\\n\\s\\t]*runOnlyForDeploymentPostprocessing\\s\\=\\s0\\;[\\n\\s\\t]*\\}\\;[\\n\\s\\t]*/\\*\\sEnd\\sPBXResourcesBuildPhase\\ssection\\s\\*/", Change4 + ");\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\t};\n/* End PBXResourcesBuildPhase section */");
>>>>               FileLoaderAndSaver.saveFile( newXCodeProjFile , xCodeProjFileContents , this); // another routine to save the file
>>>>
>>>> Hope the formatting came out allright.
>>>>
>>>> D
>>>> -
>>>> Davide Della Casa
>>>>
>>>> On 21 Feb 2011, at 17:46, Paul Zirkle wrote:
>>>>
>>>>> I'm currently working on my own engine (instead of using NME, sorry!) for cross platform mobile development, however if this project file system seems beneficial, I may try to use it as well.
>>>>>
>>>>> -Paul Zirkle
>>>>>
>>>>> On Mon, Feb 21, 2011 at 9:34 AM, Davide Della Casa<[hidden email]>  wrote:
>>>>> Hi Hugh, All,
>>>>>
>>>>> I recently made a java program that modifies the XCode project.pbxproj file so to correctly reference any files you may want to add to the App package.
>>>>>
>>>>> There are two hashes that one needs to include in 4 places and a couple of extra fields like a filetype and file encoding.
>>>>>
>>>>> Seems to work pretty well (considering that the reverse-engineering of the hashes is very crude - but apparently it's good enough), let me know if that could be useful to create the XCode project.
>>>>>
>>>>> D
>>>>>
>>>>> On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:
>>>>>
>>>>>> Hi,
>>>>>> There have been a few questions about getting started with hxcpp/NME,
>>>>>> so I thought I would give a quick update on my current theories
>>>>>> for the next version on NME.
>>>>>>
>>>>>> I have been working on a project system for NME.
>>>>>> The idea is that you write a "project" file instead of a .hxml file.
>>>>>>  From this file, all the boiler-plate project + code files are generated
>>>>>> for the various different targets.  These files are "disposable", so
>>>>>> you can blow them away every night if you wish and start again.
>>>>>> Your "precious" files are your source code, your assets and your
>>>>>> single project file, and I would expect these to be under source control,
>>>>>> and everything else can get trashed. I have only looked at NME sample 06
>>>>>> at this stage, but the project looks like this:
>>>>>>
>>>>>>
>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>> <project>
>>>>>>
>>>>>>   <app
>>>>>>      file="Sample06"
>>>>>>      title="NME Sample 06 - Drums"
>>>>>>      package="org.haxe.nme.sample06"
>>>>>>      version="1.0"
>>>>>>      company="nme"
>>>>>>          main="Sample"
>>>>>>   />
>>>>>>
>>>>>>   <window
>>>>>>       width="400"
>>>>>>       height="300"
>>>>>>       orientation="landscape"
>>>>>>       fps="60"
>>>>>>       background="0xffffff"
>>>>>>       resizeable="true"
>>>>>>       hardware="true"
>>>>>>        />
>>>>>>
>>>>>>
>>>>>>   <classpath name="." />
>>>>>>   <haxelib name="nme" />
>>>>>>
>>>>>>   <assets>
>>>>>>      <asset name="Data/drum_kit.jpg" />
>>>>>>      <asset name="Data/bang.png"     />
>>>>>>      <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>>>>>>      <sound name="Data/drum.ogg"     />
>>>>>>      <sound name="Data/bass.wav"     />
>>>>>>      <sound name="Data/drums.ogg"   />
>>>>>>   </assets>
>>>>>>
>>>>>>
>>>>>>   <ndll name="std" />
>>>>>>   <ndll name="regexp" />
>>>>>>   <ndll name="zlib" />
>>>>>>   <ndll name="nme" haxelib="nme" nekoapi="1"/>
>>>>>>
>>>>>>   <certificates>
>>>>>>      <certificate file="signature.cer" name="mysign" password="ajkhsakjhf" />
>>>>>>   </certificates>
>>>>>>
>>>>>> </project>
>>>>>>
>>>>>>
>>>>>> As you may or may not see, I use pretty much the same architecture as
>>>>>> I did the the hxcpp build tool.
>>>>>>
>>>>>>  From this, I can already create windows hxcpp or neko foilders and Android Apks.
>>>>>> I'm working on iPhone xcode projects and GHP/Caanoo installs.
>>>>>> I intend to push this with windows NSIS installers, mac dmgs, linux (tar files???)
>>>>>> and swf scp so you can go from haxe file to installer with one step.
>>>>>> The "certificates" part is crap at the moment - haven't quite worked out what
>>>>>> to do there.  Also thinking about having vector-based icons that can be
>>>>>> rendered to different resolutions.
>>>>>> I have not started the flash code, but it will probably use an external tool
>>>>>> such as swfmill, can create that project file from this one.
>>>>>> The haxe.Template code make most of this quite easy.
>>>>>>
>>>>>> I am also moving the window creation code into the templates to make a direct port
>>>>>> of the flash code easier.
>>>>>>
>>>>>> The procedure will go like this:
>>>>>> 0. Install a whole bunch of thirdparty tools
>>>>>> 1. write haxe code
>>>>>> 2. write project file
>>>>>> 3. run anywhere/profit.
>>>>>>
>>>>>> Maybe with closer integration with FlashDevelop, or some kind of gui app,
>>>>>> step 2 may become trivial.
>>>>>>
>>>>>> So if anyone has any comments on this, or would like to contribute (especially
>>>>>> with mac or linux installers) please speak up.
>>>>>>
>>>>>> Hugh
>>>>>>
>>>>>> --
>>>>>> haXe - an open source web programming language
>>>>>> http://haxe.org
>>>>>
>>>>> --
>>>>> haXe - an open source web programming language
>>>>> http://haxe.org
>>>>>
>>>>> --
>>>>> haXe - an open source web programming language
>>>>> http://haxe.org
>


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

justin_mills
I don't have an iphone but certainly intend to have a go at Android
using just textmate and document steps, I so far only tried compiling
java and it was not difficult with the textmate bundle.

Le 22/02/2011 14:48, justin_mills a écrit :

> It would be nice to start moving away from Xcode dependancy for
> IPhone, first maybe get something working on textmate...
> http://www.pathf.com/blogs/2008/11/iphone-sdk-testing-with-textmate-gtm/
>
> Then move to maybe not even depending on a mac, i did find a pdf doc
> that covered an approach.  Having XCode do too much does not seem
> ideal, it's like sometimes I want to see the hxml file in flashdevelop
> and really I am against editor being dictated by the tech.
>
> Le 22/02/2011 14:28, Davide Della Casa a écrit :
>> Yes any unique will do. If you have six files, the 12 "hashes" can
>> just be the numbers 1...12, XCode re-writes those to correct values
>> when opening.
>>
>> Also, I noticed that the filetype can be set to "dummy" and XCode
>> re-calculates that when opening too, so all that code that looks at
>> the extension can be binned.
>>
>> Not so with the file encoding string: I tried to put a dummy number
>> there, XCode opened fine but re-calculated the dummies to 16 digits
>> numbers that don't look too sane - so maybe it's worth putting that
>> "fileEncoding = 4; " for all the text-type files (and other assets
>> such as images/sounds don't seem to require the fileEncoding).
>>
>> I've done some googling (
>> http://www.google.co.uk/search?q="fileEncoding+%3D"+~+"lastKnownFileType"
>> ) and there seem to be the following encodings:
>> 0,3,4,5,7,8,10,12,15,21,30 - it doesn't ring any bell to me (no it's
>> not the "Lost" numbers :-).
>>
>>
>> On 21 Feb 2011, at 23:57, Hugh Sanderson wrote:
>>
>>> Hi Davide,
>>> This is just the sort of info I was after - I'll see what I can make
>>> of it.
>>> I wonder if any unique has will do, eg md5 of the filepath?
>>>
>>> Paul Zirkle, the nme project should also be useful for other projects.
>>> Currently it assumes an NME specific starting point, but that can
>>> easily be changed.
>>> I have already though about using it for command-line apps,
>>> so another graphics system should be no different.
>>>
>>> Hugh
>>>
>>>> To give a specific name to an XCode project, this is how I did it
>>>> (again, not catering for whitespaces):
>>>>
>>>> - rename the plist file to [projectName]-Info.plist
>>>> - rename xcodeproj directory to [projectName].xcodeproj
>>>> - replace all the occurrences of the old project name inside the
>>>> pbxproj file in the xcodeproj directory
>>>>
>>>> This grok and the previous grok so far produced functional XCode
>>>> project directories correctly referencing files (the files were
>>>> copied in the project folder by the way - the previous grok is
>>>> likely not to work if you want to link files coming from other
>>>> locations).
>>>>
>>>> D
>>>>
>>>> On 21 Feb 2011, at 18:44, Davide Della Casa wrote:
>>>>
>>>>> OK here is how I grokked it in case it helps.
>>>>>
>>>>> (Caveat: I didn't cater for whitespaces in the filenames yet.)
>>>>>
>>>>> There are three files in the XCode .xcodeproj project directory.
>>>>> The only important one is the project.pbxproj file, I trash the
>>>>> other two as they seem to contain satellite preferences and
>>>>> bookmarks, windows positions etc. and they are automatically
>>>>> created without problems. Four text blocks need to be added to the
>>>>> pbxproj file. Each text block contains one line for each file to
>>>>> be included in the package.
>>>>>
>>>>> For each file to add in the App package there are two hashes that
>>>>> need to be calculated. XCode seems to be relaxed about those as
>>>>> far as they cross-reference correctly - I calculated them like
>>>>> this so they look pretty similar to what I saw XCode generate with
>>>>> an example I fed it.
>>>>>
>>>>>               Vector selectedFilesToIncludeHex1 = new Vector();
>>>>>               Vector selectedFilesToIncludeHex2 = new Vector();
>>>>>               for (int k = 0; k<  
>>>>> selectedFilesToIncludePath.size(); k++) {
>>>>>                 String completeHex1 =
>>>>> "C489DF"+Integer.toHexString(k+233).toUpperCase()
>>>>> +"130E90F900C81312";
>>>>>                 String completeHex2 =
>>>>> "C489DF"+Integer.toHexString(k+224).toUpperCase()
>>>>> +"130E90F800C81312";
>>>>>                 selectedFilesToIncludeHex1.add(completeHex1);
>>>>>                 selectedFilesToIncludeHex2.add(completeHex2);
>>>>>               }
>>>>>
>>>>> There are four text blocks that need to be inserted:
>>>>>
>>>>>               String Change1 = "" ;
>>>>>               String Change2 = "" ;
>>>>>               String Change3 = "" ;
>>>>>               String Change4 = "" ;
>>>>>
>>>>> Also there are two additional fields that are needed in a couple
>>>>> of those blocks: filetype and file encoding. I prepare the strings
>>>>> based on the file extension (that I keep in the
>>>>> selectedFilesToIncludeExtension Vector) like this:
>>>>>
>>>>>
>>>>>               String fileType = "" ;
>>>>>               String fileEncoding = "" ;
>>>>>
>>>>>               for (int k = 0; k<  
>>>>> selectedFilesToIncludePath.size(); k++) {
>>>>>                 if
>>>>> (selectedFilesToIncludeExtension.get(k).equals("xml")) {
>>>>>                   fileType = "text.xml";
>>>>>                   fileEncoding = "fileEncoding = 4; ";
>>>>>                 }
>>>>>                 else if
>>>>> (selectedFilesToIncludeExtension.get(k).equals("txt")) {
>>>>>                   fileType = "text";
>>>>>                   fileEncoding = "fileEncoding = 4; ";
>>>>>                 }
>>>>>                 else if
>>>>> (selectedFilesToIncludeExtension.get(k).equals("mp3")) {
>>>>>                   fileType = "audio.mp3";
>>>>>                   fileEncoding = "";
>>>>>                 }
>>>>>                 else if
>>>>> (selectedFilesToIncludeExtension.get(k).equals("png")) {
>>>>>                   fileType = "image.png";
>>>>>                   fileEncoding = "";
>>>>>                 }
>>>>>                 else if
>>>>> (selectedFilesToIncludeExtension.get(k).equals("jpg")) {
>>>>>                   fileType = "image.jpeg";
>>>>>                   fileEncoding = "";
>>>>>                 }
>>>>>                 else if
>>>>> (selectedFilesToIncludeExtension.get(k).equals("gif")) {
>>>>>                   fileType = "image.gif";
>>>>>                   fileEncoding = "";
>>>>>                 }
>>>>>                 else if
>>>>> (selectedFilesToIncludeExtension.get(k).equals("aiff")) {
>>>>>                   fileType = "audio.aiff";
>>>>>                   fileEncoding = "";
>>>>>                 }
>>>>>                 else if
>>>>> (selectedFilesToIncludeExtension.get(k).equals("wav")) {
>>>>>                   fileType = "audio.wav";
>>>>>                   fileEncoding = "";
>>>>>                 }
>>>>>                 else{
>>>>>                   fileType = "file";
>>>>>                   fileEncoding = "";
>>>>>                 }
>>>>>
>>>>> In the same loop as above, for each file I build 4 text blocks
>>>>> that need to be inserted in the project file:
>>>>>
>>>>>                 Change1 = Change1 +
>>>>>                       "        " +
>>>>> selectedFilesToIncludeHex1.get(k) + " /* " +
>>>>>                      
>>>>> selectedFilesToIncludeNameWithExtension.get(k) +
>>>>>                       " in Resources */ = {isa = PBXBuildFile; "+
>>>>>                       "fileRef = " +
>>>>>                       selectedFilesToIncludeHex2.get(k) +
>>>>>                       " /* " +
>>>>>                      
>>>>> selectedFilesToIncludeNameWithExtension.get(k) +
>>>>>                       " */; };\n";
>>>>>
>>>>>                 Change2 = Change2 + "        " +
>>>>>                       selectedFilesToIncludeHex2.get(k) +
>>>>>                        " /* " +
>>>>>                      
>>>>> selectedFilesToIncludeNameWithExtension.get(k) +
>>>>>                       " */ = {isa = PBXFileReference; "+
>>>>>                       fileEncoding +
>>>>>                       "lastKnownFileType = " +
>>>>>                       fileType +
>>>>>                       "; path = "+
>>>>>                      
>>>>> selectedFilesToIncludeNameWithExtension.get(k) +
>>>>>                       "; sourceTree = \"<group>\"; };\n";
>>>>>                 Change3 = Change3 + "\n                " +
>>>>>                       selectedFilesToIncludeHex2.get(k) +
>>>>>                       " /* " +
>>>>>                      
>>>>> selectedFilesToIncludeNameWithExtension.get(k) +
>>>>>                       " */,";
>>>>>                 Change4 = Change4 + "\n                " +
>>>>>                       selectedFilesToIncludeHex1.get(k) +
>>>>>                       " /* " +
>>>>>                      
>>>>> selectedFilesToIncludeNameWithExtension.get(k) +
>>>>>                       " in Resources */,";
>>>>>
>>>>>               } // closed the for loop
>>>>>
>>>>> Once the text blocks are built, these are the regexp I used to put
>>>>> them in the right place
>>>>>
>>>>>               xCodeProjFileContents =
>>>>> FileLoaderAndSaver.loadFile(newXCodeProjFile, this); // this is my
>>>>> routine to load the file in a string
>>>>>               xCodeProjFileContents =
>>>>> xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXBuildFile\\ssection\\s\\*/",
>>>>> Change1 + "/* End PBXBuildFile section */");
>>>>>               xCodeProjFileContents =
>>>>> xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXFileReference\\ssection\\s\\*/",
>>>>> Change2 + "/* End PBXFileReference section */");
>>>>>               xCodeProjFileContents =
>>>>> xCodeProjFileContents.replaceAll("/\\*\\sCustomTemplate\\s\\*/\\s\\=\\s\\{[\\n\\s\\t]*isa\\s\\=\\sPBXGroup\\;[\\n\\s\\t]*children\\s\\=\\s\\(",
>>>>> "/* CustomTemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren =
>>>>> (" + Change3);
>>>>>               xCodeProjFileContents =
>>>>> xCodeProjFileContents.replaceAll("\\)\\;[\\n\\s\\t]*runOnlyForDeploymentPostprocessing\\s\\=\\s0\\;[\\n\\s\\t]*\\}\\;[\\n\\s\\t]*/\\*\\sEnd\\sPBXResourcesBuildPhase\\ssection\\s\\*/",
>>>>> Change4 + ");\n\t\t\trunOnlyForDeploymentPostprocessing =
>>>>> 0;\n\t\t\t};\n/* End PBXResourcesBuildPhase section */");
>>>>>               FileLoaderAndSaver.saveFile( newXCodeProjFile ,
>>>>> xCodeProjFileContents , this); // another routine to save the file
>>>>>
>>>>> Hope the formatting came out allright.
>>>>>
>>>>> D
>>>>> -
>>>>> Davide Della Casa
>>>>>
>>>>> On 21 Feb 2011, at 17:46, Paul Zirkle wrote:
>>>>>
>>>>>> I'm currently working on my own engine (instead of using NME,
>>>>>> sorry!) for cross platform mobile development, however if this
>>>>>> project file system seems beneficial, I may try to use it as well.
>>>>>>
>>>>>> -Paul Zirkle
>>>>>>
>>>>>> On Mon, Feb 21, 2011 at 9:34 AM, Davide Della
>>>>>> Casa<[hidden email]>  wrote:
>>>>>> Hi Hugh, All,
>>>>>>
>>>>>> I recently made a java program that modifies the XCode
>>>>>> project.pbxproj file so to correctly reference any files you may
>>>>>> want to add to the App package.
>>>>>>
>>>>>> There are two hashes that one needs to include in 4 places and a
>>>>>> couple of extra fields like a filetype and file encoding.
>>>>>>
>>>>>> Seems to work pretty well (considering that the
>>>>>> reverse-engineering of the hashes is very crude - but apparently
>>>>>> it's good enough), let me know if that could be useful to create
>>>>>> the XCode project.
>>>>>>
>>>>>> D
>>>>>>
>>>>>> On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>> There have been a few questions about getting started with
>>>>>>> hxcpp/NME,
>>>>>>> so I thought I would give a quick update on my current theories
>>>>>>> for the next version on NME.
>>>>>>>
>>>>>>> I have been working on a project system for NME.
>>>>>>> The idea is that you write a "project" file instead of a .hxml
>>>>>>> file.
>>>>>>>  From this file, all the boiler-plate project + code files are
>>>>>>> generated
>>>>>>> for the various different targets.  These files are
>>>>>>> "disposable", so
>>>>>>> you can blow them away every night if you wish and start again.
>>>>>>> Your "precious" files are your source code, your assets and your
>>>>>>> single project file, and I would expect these to be under source
>>>>>>> control,
>>>>>>> and everything else can get trashed. I have only looked at NME
>>>>>>> sample 06
>>>>>>> at this stage, but the project looks like this:
>>>>>>>
>>>>>>>
>>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>>> <project>
>>>>>>>
>>>>>>> <app
>>>>>>>      file="Sample06"
>>>>>>>      title="NME Sample 06 - Drums"
>>>>>>>      package="org.haxe.nme.sample06"
>>>>>>>      version="1.0"
>>>>>>>      company="nme"
>>>>>>>          main="Sample"
>>>>>>>   />
>>>>>>>
>>>>>>> <window
>>>>>>>       width="400"
>>>>>>>       height="300"
>>>>>>>       orientation="landscape"
>>>>>>>       fps="60"
>>>>>>>       background="0xffffff"
>>>>>>>       resizeable="true"
>>>>>>>       hardware="true"
>>>>>>>        />
>>>>>>>
>>>>>>>
>>>>>>> <classpath name="." />
>>>>>>> <haxelib name="nme" />
>>>>>>>
>>>>>>> <assets>
>>>>>>> <asset name="Data/drum_kit.jpg" />
>>>>>>> <asset name="Data/bang.png"     />
>>>>>>> <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>>>>>>> <sound name="Data/drum.ogg"     />
>>>>>>> <sound name="Data/bass.wav"     />
>>>>>>> <sound name="Data/drums.ogg"   />
>>>>>>> </assets>
>>>>>>>
>>>>>>>
>>>>>>> <ndll name="std" />
>>>>>>> <ndll name="regexp" />
>>>>>>> <ndll name="zlib" />
>>>>>>> <ndll name="nme" haxelib="nme" nekoapi="1"/>
>>>>>>>
>>>>>>> <certificates>
>>>>>>> <certificate file="signature.cer" name="mysign"
>>>>>>> password="ajkhsakjhf" />
>>>>>>> </certificates>
>>>>>>>
>>>>>>> </project>
>>>>>>>
>>>>>>>
>>>>>>> As you may or may not see, I use pretty much the same
>>>>>>> architecture as
>>>>>>> I did the the hxcpp build tool.
>>>>>>>
>>>>>>>  From this, I can already create windows hxcpp or neko foilders
>>>>>>> and Android Apks.
>>>>>>> I'm working on iPhone xcode projects and GHP/Caanoo installs.
>>>>>>> I intend to push this with windows NSIS installers, mac dmgs,
>>>>>>> linux (tar files???)
>>>>>>> and swf scp so you can go from haxe file to installer with one
>>>>>>> step.
>>>>>>> The "certificates" part is crap at the moment - haven't quite
>>>>>>> worked out what
>>>>>>> to do there.  Also thinking about having vector-based icons that
>>>>>>> can be
>>>>>>> rendered to different resolutions.
>>>>>>> I have not started the flash code, but it will probably use an
>>>>>>> external tool
>>>>>>> such as swfmill, can create that project file from this one.
>>>>>>> The haxe.Template code make most of this quite easy.
>>>>>>>
>>>>>>> I am also moving the window creation code into the templates to
>>>>>>> make a direct port
>>>>>>> of the flash code easier.
>>>>>>>
>>>>>>> The procedure will go like this:
>>>>>>> 0. Install a whole bunch of thirdparty tools
>>>>>>> 1. write haxe code
>>>>>>> 2. write project file
>>>>>>> 3. run anywhere/profit.
>>>>>>>
>>>>>>> Maybe with closer integration with FlashDevelop, or some kind of
>>>>>>> gui app,
>>>>>>> step 2 may become trivial.
>>>>>>>
>>>>>>> So if anyone has any comments on this, or would like to
>>>>>>> contribute (especially
>>>>>>> with mac or linux installers) please speak up.
>>>>>>>
>>>>>>> Hugh
>>>>>>>
>>>>>>> --
>>>>>>> haXe - an open source web programming language
>>>>>>> http://haxe.org
>>>>>>
>>>>>> --
>>>>>> haXe - an open source web programming language
>>>>>> http://haxe.org
>>>>>>
>>>>>> --
>>>>>> haXe - an open source web programming language
>>>>>> http://haxe.org
>>
>
>


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

Tarwin Stroh-Spijer
In reply to this post by justin_mills
I'm pretty sure you need XCode to do iPhone stuff. There's a whole lot of code-signing and such involved - maybe some smart person can do it without but I doubt it - this is Apple we're talking about.


Tarwin Stroh-Spijer
_______________________

Touch My Pixel
http://www.touchmypixel.com/
phone: +61 3 8060 5321
_______________________


On Wed, Feb 23, 2011 at 12:48 AM, justin_mills <[hidden email]> wrote:
It would be nice to start moving away from Xcode dependancy for IPhone, first maybe get something working on textmate...
http://www.pathf.com/blogs/2008/11/iphone-sdk-testing-with-textmate-gtm/

Then move to maybe not even depending on a mac, i did find a pdf doc that covered an approach.  Having XCode do too much does not seem ideal, it's like sometimes I want to see the hxml file in flashdevelop and really I am against editor being dictated by the tech.

Le 22/02/2011 14:28, Davide Della Casa a écrit :

Yes any unique will do. If you have six files, the 12 "hashes" can just be the numbers 1...12, XCode re-writes those to correct values when opening.

Also, I noticed that the filetype can be set to "dummy" and XCode re-calculates that when opening too, so all that code that looks at the extension can be binned.

Not so with the file encoding string: I tried to put a dummy number there, XCode opened fine but re-calculated the dummies to 16 digits numbers that don't look too sane - so maybe it's worth putting that "fileEncoding = 4; " for all the text-type files (and other assets such as images/sounds don't seem to require the fileEncoding).

I've done some googling ( http://www.google.co.uk/search?q="fileEncoding+%3D"+~+"lastKnownFileType" ) and there seem to be the following encodings: 0,3,4,5,7,8,10,12,15,21,30 - it doesn't ring any bell to me (no it's not the "Lost" numbers :-).


On 21 Feb 2011, at 23:57, Hugh Sanderson wrote:

Hi Davide,
This is just the sort of info I was after - I'll see what I can make of it.
I wonder if any unique has will do, eg md5 of the filepath?

Paul Zirkle, the nme project should also be useful for other projects.
Currently it assumes an NME specific starting point, but that can easily be changed.
I have already though about using it for command-line apps,
so another graphics system should be no different.

Hugh

To give a specific name to an XCode project, this is how I did it (again, not catering for whitespaces):

- rename the plist file to [projectName]-Info.plist
- rename xcodeproj directory to [projectName].xcodeproj
- replace all the occurrences of the old project name inside the pbxproj file in the xcodeproj directory

This grok and the previous grok so far produced functional XCode project directories correctly referencing files (the files were copied in the project folder by the way - the previous grok is likely not to work if you want to link files coming from other locations).

D

On 21 Feb 2011, at 18:44, Davide Della Casa wrote:

OK here is how I grokked it in case it helps.

(Caveat: I didn't cater for whitespaces in the filenames yet.)

There are three files in the XCode .xcodeproj project directory. The only important one is the project.pbxproj file, I trash the other two as they seem to contain satellite preferences and bookmarks, windows positions etc. and they are automatically created without problems. Four text blocks need to be added to the pbxproj file. Each text block contains one line for each file to be included in the package.

For each file to add in the App package there are two hashes that need to be calculated. XCode seems to be relaxed about those as far as they cross-reference correctly - I calculated them like this so they look pretty similar to what I saw XCode generate with an example I fed it.

             Vector selectedFilesToIncludeHex1 = new Vector();
             Vector selectedFilesToIncludeHex2 = new Vector();
             for (int k = 0; k<  selectedFilesToIncludePath.size(); k++) {
               String completeHex1 = "C489DF"+Integer.toHexString(k+233).toUpperCase() +"130E90F900C81312";
               String completeHex2 = "C489DF"+Integer.toHexString(k+224).toUpperCase() +"130E90F800C81312";
               selectedFilesToIncludeHex1.add(completeHex1);
               selectedFilesToIncludeHex2.add(completeHex2);
             }

There are four text blocks that need to be inserted:

             String Change1 = "" ;
             String Change2 = "" ;
             String Change3 = "" ;
             String Change4 = "" ;

Also there are two additional fields that are needed in a couple of those blocks: filetype and file encoding. I prepare the strings based on the file extension (that I keep in the selectedFilesToIncludeExtension Vector) like this:


             String fileType = "" ;
             String fileEncoding = "" ;

             for (int k = 0; k<  selectedFilesToIncludePath.size(); k++) {
               if (selectedFilesToIncludeExtension.get(k).equals("xml")) {
                 fileType = "text.xml";
                 fileEncoding = "fileEncoding = 4; ";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("txt")) {
                 fileType = "text";
                 fileEncoding = "fileEncoding = 4; ";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("mp3")) {
                 fileType = "audio.mp3";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("png")) {
                 fileType = "image.png";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("jpg")) {
                 fileType = "image.jpeg";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("gif")) {
                 fileType = "image.gif";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("aiff")) {
                 fileType = "audio.aiff";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("wav")) {
                 fileType = "audio.wav";
                 fileEncoding = "";
               }
               else{
                 fileType = "file";
                 fileEncoding = "";
               }

In the same loop as above, for each file I build 4 text blocks that need to be inserted in the project file:

               Change1 = Change1 +
                     "         " + selectedFilesToIncludeHex1.get(k) + " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " in Resources */ = {isa = PBXBuildFile; "+
                     "fileRef = " +
                     selectedFilesToIncludeHex2.get(k) +
                     " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " */; };\n";

               Change2 = Change2 + "           " +
                     selectedFilesToIncludeHex2.get(k) +
                      " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " */ = {isa = PBXFileReference; "+
                     fileEncoding +
                     "lastKnownFileType = " +
                     fileType +
                     "; path = "+
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     "; sourceTree = \"<group>\"; };\n";
               Change3 = Change3 + "\n                         " +
                     selectedFilesToIncludeHex2.get(k) +
                     " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " */,";
               Change4 = Change4 + "\n                         " +
                     selectedFilesToIncludeHex1.get(k) +
                     " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " in Resources */,";

             } // closed the for loop

Once the text blocks are built, these are the regexp I used to put them in the right place

             xCodeProjFileContents = FileLoaderAndSaver.loadFile(newXCodeProjFile, this); // this is my routine to load the file in a string
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXBuildFile\\ssection\\s\\*/", Change1 + "/* End PBXBuildFile section */");
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXFileReference\\ssection\\s\\*/", Change2 + "/* End PBXFileReference section */");
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sCustomTemplate\\s\\*/\\s\\=\\s\\{[\\n\\s\\t]*isa\\s\\=\\sPBXGroup\\;[\\n\\s\\t]*children\\s\\=\\s\\(", "/* CustomTemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (" + Change3);
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("\\)\\;[\\n\\s\\t]*runOnlyForDeploymentPostprocessing\\s\\=\\s0\\;[\\n\\s\\t]*\\}\\;[\\n\\s\\t]*/\\*\\sEnd\\sPBXResourcesBuildPhase\\ssection\\s\\*/", Change4 + ");\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\t};\n/* End PBXResourcesBuildPhase section */");
             FileLoaderAndSaver.saveFile( newXCodeProjFile , xCodeProjFileContents , this); // another routine to save the file

Hope the formatting came out allright.

D
-
Davide Della Casa

On 21 Feb 2011, at 17:46, Paul Zirkle wrote:

I'm currently working on my own engine (instead of using NME, sorry!) for cross platform mobile development, however if this project file system seems beneficial, I may try to use it as well.

-Paul Zirkle

On Mon, Feb 21, 2011 at 9:34 AM, Davide Della Casa<[hidden email]>  wrote:
Hi Hugh, All,

I recently made a java program that modifies the XCode project.pbxproj file so to correctly reference any files you may want to add to the App package.

There are two hashes that one needs to include in 4 places and a couple of extra fields like a filetype and file encoding.

Seems to work pretty well (considering that the reverse-engineering of the hashes is very crude - but apparently it's good enough), let me know if that could be useful to create the XCode project.

D

On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:

Hi,
There have been a few questions about getting started with hxcpp/NME,
so I thought I would give a quick update on my current theories
for the next version on NME.

I have been working on a project system for NME.
The idea is that you write a "project" file instead of a .hxml file.
 From this file, all the boiler-plate project + code files are generated
for the various different targets.  These files are "disposable", so
you can blow them away every night if you wish and start again.
Your "precious" files are your source code, your assets and your
single project file, and I would expect these to be under source control,
and everything else can get trashed. I have only looked at NME sample 06
at this stage, but the project looks like this:


<?xml version="1.0" encoding="utf-8"?>
<project>

 <app
    file="Sample06"
    title="NME Sample 06 - Drums"
    package="org.haxe.nme.sample06"
    version="1.0"
    company="nme"
        main="Sample"
 />

 <window
     width="400"
     height="300"
     orientation="landscape"
     fps="60"
     background="0xffffff"
     resizeable="true"
     hardware="true"
      />


 <classpath name="." />
 <haxelib name="nme" />

 <assets>
    <asset name="Data/drum_kit.jpg" />
    <asset name="Data/bang.png"     />
    <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
    <sound name="Data/drum.ogg"     />
    <sound name="Data/bass.wav"     />
    <sound name="Data/drums.ogg"   />
 </assets>


 <ndll name="std" />
 <ndll name="regexp" />
 <ndll name="zlib" />
 <ndll name="nme" haxelib="nme" nekoapi="1"/>

 <certificates>
    <certificate file="signature.cer" name="mysign" password="ajkhsakjhf" />
 </certificates>

</project>


As you may or may not see, I use pretty much the same architecture as
I did the the hxcpp build tool.

 From this, I can already create windows hxcpp or neko foilders and Android Apks.
I'm working on iPhone xcode projects and GHP/Caanoo installs.
I intend to push this with windows NSIS installers, mac dmgs, linux (tar files???)
and swf scp so you can go from haxe file to installer with one step.
The "certificates" part is crap at the moment - haven't quite worked out what
to do there.  Also thinking about having vector-based icons that can be
rendered to different resolutions.
I have not started the flash code, but it will probably use an external tool
such as swfmill, can create that project file from this one.
The haxe.Template code make most of this quite easy.

I am also moving the window creation code into the templates to make a direct port
of the flash code easier.

The procedure will go like this:
0. Install a whole bunch of thirdparty tools
1. write haxe code
2. write project file
3. run anywhere/profit.

Maybe with closer integration with FlashDevelop, or some kind of gui app,
step 2 may become trivial.

So if anyone has any comments on this, or would like to contribute (especially
with mac or linux installers) please speak up.

Hugh

--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

singmajesty
Yeah, don't mess with Apple


On Tue, 22 Feb 2011 10:38:36 -0800, Tarwin Stroh-Spijer  
<[hidden email]> wrote:

> I'm pretty sure you need XCode to do iPhone stuff. There's a whole lot of
> code-signing and such involved - maybe some smart person can do it  
> without
> but I doubt it - this is Apple we're talking about.
>
>
> Tarwin Stroh-Spijer
> _______________________
>
> Touch My Pixel
> http://www.touchmypixel.com/
> phone: +61 3 8060 5321
> _______________________
>
>
> On Wed, Feb 23, 2011 at 12:48 AM, justin_mills  
> <[hidden email]>wrote:
>
>> It would be nice to start moving away from Xcode dependancy for IPhone,
>> first maybe get something working on textmate...
>> http://www.pathf.com/blogs/2008/11/iphone-sdk-testing-with-textmate-gtm/
>>
>> Then move to maybe not even depending on a mac, i did find a pdf doc  
>> that
>> covered an approach.  Having XCode do too much does not seem ideal, it's
>> like sometimes I want to see the hxml file in flashdevelop and really I  
>> am
>> against editor being dictated by the tech.
>>
>> Le 22/02/2011 14:28, Davide Della Casa a écrit :
>>
>>  Yes any unique will do. If you have six files, the 12 "hashes" can  
>> just be
>>> the numbers 1...12, XCode re-writes those to correct values when  
>>> opening.
>>>
>>> Also, I noticed that the filetype can be set to "dummy" and XCode
>>> re-calculates that when opening too, so all that code that looks at the
>>> extension can be binned.
>>>
>>> Not so with the file encoding string: I tried to put a dummy number  
>>> there,
>>> XCode opened fine but re-calculated the dummies to 16 digits numbers  
>>> that
>>> don't look too sane - so maybe it's worth putting that "fileEncoding =  
>>> 4; "
>>> for all the text-type files (and other assets such as images/sounds  
>>> don't
>>> seem to require the fileEncoding).
>>>
>>> I've done some googling (  
>>> http://www.google.co.uk/search?q="fileEncoding+%3D"+~+"lastKnownFileType"
>>> ) and there seem to be the following encodings:  
>>> 0,3,4,5,7,8,10,12,15,21,30 -
>>> it doesn't ring any bell to me (no it's not the "Lost" numbers :-).
>>>
>>>
>>> On 21 Feb 2011, at 23:57, Hugh Sanderson wrote:
>>>
>>>  Hi Davide,
>>>> This is just the sort of info I was after - I'll see what I can make  
>>>> of
>>>> it.
>>>> I wonder if any unique has will do, eg md5 of the filepath?
>>>>
>>>> Paul Zirkle, the nme project should also be useful for other projects.
>>>> Currently it assumes an NME specific starting point, but that can  
>>>> easily
>>>> be changed.
>>>> I have already though about using it for command-line apps,
>>>> so another graphics system should be no different.
>>>>
>>>> Hugh
>>>>
>>>>  To give a specific name to an XCode project, this is how I did it
>>>>> (again, not catering for whitespaces):
>>>>>
>>>>> - rename the plist file to [projectName]-Info.plist
>>>>> - rename xcodeproj directory to [projectName].xcodeproj
>>>>> - replace all the occurrences of the old project name inside the  
>>>>> pbxproj
>>>>> file in the xcodeproj directory
>>>>>
>>>>> This grok and the previous grok so far produced functional XCode  
>>>>> project
>>>>> directories correctly referencing files (the files were copied in the
>>>>> project folder by the way - the previous grok is likely not to work  
>>>>> if you
>>>>> want to link files coming from other locations).
>>>>>
>>>>> D
>>>>>
>>>>> On 21 Feb 2011, at 18:44, Davide Della Casa wrote:
>>>>>
>>>>>  OK here is how I grokked it in case it helps.
>>>>>>
>>>>>> (Caveat: I didn't cater for whitespaces in the filenames yet.)
>>>>>>
>>>>>> There are three files in the XCode .xcodeproj project directory. The
>>>>>> only important one is the project.pbxproj file, I trash the other  
>>>>>> two as
>>>>>> they seem to contain satellite preferences and bookmarks, windows  
>>>>>> positions
>>>>>> etc. and they are automatically created without problems. Four text  
>>>>>> blocks
>>>>>> need to be added to the pbxproj file. Each text block contains one  
>>>>>> line for
>>>>>> each file to be included in the package.
>>>>>>
>>>>>> For each file to add in the App package there are two hashes that  
>>>>>> need
>>>>>> to be calculated. XCode seems to be relaxed about those as far as  
>>>>>> they
>>>>>> cross-reference correctly - I calculated them like this so they  
>>>>>> look pretty
>>>>>> similar to what I saw XCode generate with an example I fed it.
>>>>>>
>>>>>>              Vector selectedFilesToIncludeHex1 = new Vector();
>>>>>>              Vector selectedFilesToIncludeHex2 = new Vector();
>>>>>>              for (int k = 0; k<  selectedFilesToIncludePath.size();
>>>>>> k++) {
>>>>>>                String completeHex1 =
>>>>>> "C489DF"+Integer.toHexString(k+233).toUpperCase()  
>>>>>> +"130E90F900C81312";
>>>>>>                String completeHex2 =
>>>>>> "C489DF"+Integer.toHexString(k+224).toUpperCase()  
>>>>>> +"130E90F800C81312";
>>>>>>                selectedFilesToIncludeHex1.add(completeHex1);
>>>>>>                selectedFilesToIncludeHex2.add(completeHex2);
>>>>>>              }
>>>>>>
>>>>>> There are four text blocks that need to be inserted:
>>>>>>
>>>>>>              String Change1 = "" ;
>>>>>>              String Change2 = "" ;
>>>>>>              String Change3 = "" ;
>>>>>>              String Change4 = "" ;
>>>>>>
>>>>>> Also there are two additional fields that are needed in a couple of
>>>>>> those blocks: filetype and file encoding. I prepare the strings  
>>>>>> based on the
>>>>>> file extension (that I keep in the selectedFilesToIncludeExtension  
>>>>>> Vector)
>>>>>> like this:
>>>>>>
>>>>>>
>>>>>>              String fileType = "" ;
>>>>>>              String fileEncoding = "" ;
>>>>>>
>>>>>>              for (int k = 0; k<  selectedFilesToIncludePath.size();
>>>>>> k++) {
>>>>>>                if
>>>>>> (selectedFilesToIncludeExtension.get(k).equals("xml")) {
>>>>>>                  fileType = "text.xml";
>>>>>>                  fileEncoding = "fileEncoding = 4; ";
>>>>>>                }
>>>>>>                else if
>>>>>> (selectedFilesToIncludeExtension.get(k).equals("txt")) {
>>>>>>                  fileType = "text";
>>>>>>                  fileEncoding = "fileEncoding = 4; ";
>>>>>>                }
>>>>>>                else if
>>>>>> (selectedFilesToIncludeExtension.get(k).equals("mp3")) {
>>>>>>                  fileType = "audio.mp3";
>>>>>>                  fileEncoding = "";
>>>>>>                }
>>>>>>                else if
>>>>>> (selectedFilesToIncludeExtension.get(k).equals("png")) {
>>>>>>                  fileType = "image.png";
>>>>>>                  fileEncoding = "";
>>>>>>                }
>>>>>>                else if
>>>>>> (selectedFilesToIncludeExtension.get(k).equals("jpg")) {
>>>>>>                  fileType = "image.jpeg";
>>>>>>                  fileEncoding = "";
>>>>>>                }
>>>>>>                else if
>>>>>> (selectedFilesToIncludeExtension.get(k).equals("gif")) {
>>>>>>                  fileType = "image.gif";
>>>>>>                  fileEncoding = "";
>>>>>>                }
>>>>>>                else if
>>>>>> (selectedFilesToIncludeExtension.get(k).equals("aiff")) {
>>>>>>                  fileType = "audio.aiff";
>>>>>>                  fileEncoding = "";
>>>>>>                }
>>>>>>                else if
>>>>>> (selectedFilesToIncludeExtension.get(k).equals("wav")) {
>>>>>>                  fileType = "audio.wav";
>>>>>>                  fileEncoding = "";
>>>>>>                }
>>>>>>                else{
>>>>>>                  fileType = "file";
>>>>>>                  fileEncoding = "";
>>>>>>                }
>>>>>>
>>>>>> In the same loop as above, for each file I build 4 text blocks that
>>>>>> need to be inserted in the project file:
>>>>>>
>>>>>>                Change1 = Change1 +
>>>>>>                      "         " +  
>>>>>> selectedFilesToIncludeHex1.get(k) +
>>>>>> " /* " +
>>>>>>                      selectedFilesToIncludeNameWithExtension.get(k)  
>>>>>> +
>>>>>>                      " in Resources */ = {isa = PBXBuildFile; "+
>>>>>>                      "fileRef = " +
>>>>>>                      selectedFilesToIncludeHex2.get(k) +
>>>>>>                      " /* " +
>>>>>>                      selectedFilesToIncludeNameWithExtension.get(k)  
>>>>>> +
>>>>>>                      " */; };\n";
>>>>>>
>>>>>>                Change2 = Change2 + "           " +
>>>>>>                      selectedFilesToIncludeHex2.get(k) +
>>>>>>                       " /* " +
>>>>>>                      selectedFilesToIncludeNameWithExtension.get(k)  
>>>>>> +
>>>>>>                      " */ = {isa = PBXFileReference; "+
>>>>>>                      fileEncoding +
>>>>>>                      "lastKnownFileType = " +
>>>>>>                      fileType +
>>>>>>                      "; path = "+
>>>>>>                      selectedFilesToIncludeNameWithExtension.get(k)  
>>>>>> +
>>>>>>                      "; sourceTree = \"<group>\"; };\n";
>>>>>>                Change3 = Change3 + "\n                         " +
>>>>>>                      selectedFilesToIncludeHex2.get(k) +
>>>>>>                      " /* " +
>>>>>>                      selectedFilesToIncludeNameWithExtension.get(k)  
>>>>>> +
>>>>>>                      " */,";
>>>>>>                Change4 = Change4 + "\n                         " +
>>>>>>                      selectedFilesToIncludeHex1.get(k) +
>>>>>>                      " /* " +
>>>>>>                      selectedFilesToIncludeNameWithExtension.get(k)  
>>>>>> +
>>>>>>                      " in Resources */,";
>>>>>>
>>>>>>              } // closed the for loop
>>>>>>
>>>>>> Once the text blocks are built, these are the regexp I used to put  
>>>>>> them
>>>>>> in the right place
>>>>>>
>>>>>>              xCodeProjFileContents =
>>>>>> FileLoaderAndSaver.loadFile(newXCodeProjFile, this); // this is my  
>>>>>> routine
>>>>>> to load the file in a string
>>>>>>              xCodeProjFileContents =
>>>>>> xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXBuildFile\\ssection\\s\\*/",
>>>>>> Change1 + "/* End PBXBuildFile section */");
>>>>>>              xCodeProjFileContents =
>>>>>> xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXFileReference\\ssection\\s\\*/",
>>>>>> Change2 + "/* End PBXFileReference section */");
>>>>>>              xCodeProjFileContents =
>>>>>> xCodeProjFileContents.replaceAll("/\\*\\sCustomTemplate\\s\\*/\\s\\=\\s\\{[\\n\\s\\t]*isa\\s\\=\\sPBXGroup\\;[\\n\\s\\t]*children\\s\\=\\s\\(",
>>>>>> "/* CustomTemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren =  
>>>>>> (" +
>>>>>> Change3);
>>>>>>              xCodeProjFileContents =
>>>>>> xCodeProjFileContents.replaceAll("\\)\\;[\\n\\s\\t]*runOnlyForDeploymentPostprocessing\\s\\=\\s0\\;[\\n\\s\\t]*\\}\\;[\\n\\s\\t]*/\\*\\sEnd\\sPBXResourcesBuildPhase\\ssection\\s\\*/",
>>>>>> Change4 + ");\n\t\t\trunOnlyForDeploymentPostprocessing =  
>>>>>> 0;\n\t\t\t};\n/*
>>>>>> End PBXResourcesBuildPhase section */");
>>>>>>              FileLoaderAndSaver.saveFile( newXCodeProjFile ,
>>>>>> xCodeProjFileContents , this); // another routine to save the file
>>>>>>
>>>>>> Hope the formatting came out allright.
>>>>>>
>>>>>> D
>>>>>> -
>>>>>> Davide Della Casa
>>>>>>
>>>>>> On 21 Feb 2011, at 17:46, Paul Zirkle wrote:
>>>>>>
>>>>>>  I'm currently working on my own engine (instead of using NME,  
>>>>>> sorry!)
>>>>>>> for cross platform mobile development, however if this project  
>>>>>>> file system
>>>>>>> seems beneficial, I may try to use it as well.
>>>>>>>
>>>>>>> -Paul Zirkle
>>>>>>>
>>>>>>> On Mon, Feb 21, 2011 at 9:34 AM, Davide Della  
>>>>>>> Casa<[hidden email]>
>>>>>>>  wrote:
>>>>>>> Hi Hugh, All,
>>>>>>>
>>>>>>> I recently made a java program that modifies the XCode  
>>>>>>> project.pbxproj
>>>>>>> file so to correctly reference any files you may want to add to  
>>>>>>> the App
>>>>>>> package.
>>>>>>>
>>>>>>> There are two hashes that one needs to include in 4 places and a
>>>>>>> couple of extra fields like a filetype and file encoding.
>>>>>>>
>>>>>>> Seems to work pretty well (considering that the  
>>>>>>> reverse-engineering of
>>>>>>> the hashes is very crude - but apparently it's good enough), let  
>>>>>>> me know if
>>>>>>> that could be useful to create the XCode project.
>>>>>>>
>>>>>>> D
>>>>>>>
>>>>>>> On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:
>>>>>>>
>>>>>>>  Hi,
>>>>>>>> There have been a few questions about getting started with  
>>>>>>>> hxcpp/NME,
>>>>>>>> so I thought I would give a quick update on my current theories
>>>>>>>> for the next version on NME.
>>>>>>>>
>>>>>>>> I have been working on a project system for NME.
>>>>>>>> The idea is that you write a "project" file instead of a .hxml  
>>>>>>>> file.
>>>>>>>>  From this file, all the boiler-plate project + code files are
>>>>>>>> generated
>>>>>>>> for the various different targets.  These files are "disposable",  
>>>>>>>> so
>>>>>>>> you can blow them away every night if you wish and start again.
>>>>>>>> Your "precious" files are your source code, your assets and your
>>>>>>>> single project file, and I would expect these to be under source
>>>>>>>> control,
>>>>>>>> and everything else can get trashed. I have only looked at NME  
>>>>>>>> sample
>>>>>>>> 06
>>>>>>>> at this stage, but the project looks like this:
>>>>>>>>
>>>>>>>>
>>>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>>>> <project>
>>>>>>>>
>>>>>>>>  <app
>>>>>>>>     file="Sample06"
>>>>>>>>     title="NME Sample 06 - Drums"
>>>>>>>>     package="org.haxe.nme.sample06"
>>>>>>>>     version="1.0"
>>>>>>>>     company="nme"
>>>>>>>>         main="Sample"
>>>>>>>>  />
>>>>>>>>
>>>>>>>>  <window
>>>>>>>>      width="400"
>>>>>>>>      height="300"
>>>>>>>>      orientation="landscape"
>>>>>>>>      fps="60"
>>>>>>>>      background="0xffffff"
>>>>>>>>      resizeable="true"
>>>>>>>>      hardware="true"
>>>>>>>>       />
>>>>>>>>
>>>>>>>>
>>>>>>>>  <classpath name="." />
>>>>>>>>  <haxelib name="nme" />
>>>>>>>>
>>>>>>>>  <assets>
>>>>>>>>     <asset name="Data/drum_kit.jpg" />
>>>>>>>>     <asset name="Data/bang.png"     />
>>>>>>>>     <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>>>>>>>>     <sound name="Data/drum.ogg"     />
>>>>>>>>     <sound name="Data/bass.wav"     />
>>>>>>>>     <sound name="Data/drums.ogg"   />
>>>>>>>>  </assets>
>>>>>>>>
>>>>>>>>
>>>>>>>>  <ndll name="std" />
>>>>>>>>  <ndll name="regexp" />
>>>>>>>>  <ndll name="zlib" />
>>>>>>>>  <ndll name="nme" haxelib="nme" nekoapi="1"/>
>>>>>>>>
>>>>>>>>  <certificates>
>>>>>>>>     <certificate file="signature.cer" name="mysign"
>>>>>>>> password="ajkhsakjhf" />
>>>>>>>>  </certificates>
>>>>>>>>
>>>>>>>> </project>
>>>>>>>>
>>>>>>>>
>>>>>>>> As you may or may not see, I use pretty much the same  
>>>>>>>> architecture as
>>>>>>>> I did the the hxcpp build tool.
>>>>>>>>
>>>>>>>>  From this, I can already create windows hxcpp or neko foilders  
>>>>>>>> and
>>>>>>>> Android Apks.
>>>>>>>> I'm working on iPhone xcode projects and GHP/Caanoo installs.
>>>>>>>> I intend to push this with windows NSIS installers, mac dmgs,  
>>>>>>>> linux
>>>>>>>> (tar files???)
>>>>>>>> and swf scp so you can go from haxe file to installer with one  
>>>>>>>> step.
>>>>>>>> The "certificates" part is crap at the moment - haven't quite  
>>>>>>>> worked
>>>>>>>> out what
>>>>>>>> to do there.  Also thinking about having vector-based icons that  
>>>>>>>> can
>>>>>>>> be
>>>>>>>> rendered to different resolutions.
>>>>>>>> I have not started the flash code, but it will probably use an
>>>>>>>> external tool
>>>>>>>> such as swfmill, can create that project file from this one.
>>>>>>>> The haxe.Template code make most of this quite easy.
>>>>>>>>
>>>>>>>> I am also moving the window creation code into the templates to  
>>>>>>>> make
>>>>>>>> a direct port
>>>>>>>> of the flash code easier.
>>>>>>>>
>>>>>>>> The procedure will go like this:
>>>>>>>> 0. Install a whole bunch of thirdparty tools
>>>>>>>> 1. write haxe code
>>>>>>>> 2. write project file
>>>>>>>> 3. run anywhere/profit.
>>>>>>>>
>>>>>>>> Maybe with closer integration with FlashDevelop, or some kind of  
>>>>>>>> gui
>>>>>>>> app,
>>>>>>>> step 2 may become trivial.
>>>>>>>>
>>>>>>>> So if anyone has any comments on this, or would like to contribute
>>>>>>>> (especially
>>>>>>>> with mac or linux installers) please speak up.
>>>>>>>>
>>>>>>>> Hugh
>>>>>>>>
>>>>>>>> --
>>>>>>>> haXe - an open source web programming language
>>>>>>>> http://haxe.org
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> haXe - an open source web programming language
>>>>>>> http://haxe.org
>>>>>>>
>>>>>>> --
>>>>>>> haXe - an open source web programming language
>>>>>>> http://haxe.org
>>>>>>>
>>>>>>
>>>
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
--
haXe - an open source web programming language
http://haxe.org

soup-nazi-jobs-no-flash.jpg (48K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

jlm@justinfront.net
In reply to this post by Tarwin Stroh-Spijer
I don't know probably take some effort and some googling but I am not convinced

On 22 Feb 2011, at 19:38, Tarwin Stroh-Spijer wrote:

I'm pretty sure you need XCode to do iPhone stuff. There's a whole lot of code-signing and such involved - maybe some smart person can do it without but I doubt it - this is Apple we're talking about.


Tarwin Stroh-Spijer
_______________________

Touch My Pixel
http://www.touchmypixel.com/
phone: +61 3 8060 5321
_______________________


On Wed, Feb 23, 2011 at 12:48 AM, justin_mills <[hidden email]> wrote:
It would be nice to start moving away from Xcode dependancy for IPhone, first maybe get something working on textmate...
http://www.pathf.com/blogs/2008/11/iphone-sdk-testing-with-textmate-gtm/

Then move to maybe not even depending on a mac, i did find a pdf doc that covered an approach.  Having XCode do too much does not seem ideal, it's like sometimes I want to see the hxml file in flashdevelop and really I am against editor being dictated by the tech.

Le 22/02/2011 14:28, Davide Della Casa a écrit :

Yes any unique will do. If you have six files, the 12 "hashes" can just be the numbers 1...12, XCode re-writes those to correct values when opening.

Also, I noticed that the filetype can be set to "dummy" and XCode re-calculates that when opening too, so all that code that looks at the extension can be binned.

Not so with the file encoding string: I tried to put a dummy number there, XCode opened fine but re-calculated the dummies to 16 digits numbers that don't look too sane - so maybe it's worth putting that "fileEncoding = 4; " for all the text-type files (and other assets such as images/sounds don't seem to require the fileEncoding).

I've done some googling ( http://www.google.co.uk/search?q="fileEncoding+%3D"+~+"lastKnownFileType" ) and there seem to be the following encodings: 0,3,4,5,7,8,10,12,15,21,30 - it doesn't ring any bell to me (no it's not the "Lost" numbers :-).


On 21 Feb 2011, at 23:57, Hugh Sanderson wrote:

Hi Davide,
This is just the sort of info I was after - I'll see what I can make of it.
I wonder if any unique has will do, eg md5 of the filepath?

Paul Zirkle, the nme project should also be useful for other projects.
Currently it assumes an NME specific starting point, but that can easily be changed.
I have already though about using it for command-line apps,
so another graphics system should be no different.

Hugh

To give a specific name to an XCode project, this is how I did it (again, not catering for whitespaces):

- rename the plist file to [projectName]-Info.plist
- rename xcodeproj directory to [projectName].xcodeproj
- replace all the occurrences of the old project name inside the pbxproj file in the xcodeproj directory

This grok and the previous grok so far produced functional XCode project directories correctly referencing files (the files were copied in the project folder by the way - the previous grok is likely not to work if you want to link files coming from other locations).

D

On 21 Feb 2011, at 18:44, Davide Della Casa wrote:

OK here is how I grokked it in case it helps.

(Caveat: I didn't cater for whitespaces in the filenames yet.)

There are three files in the XCode .xcodeproj project directory. The only important one is the project.pbxproj file, I trash the other two as they seem to contain satellite preferences and bookmarks, windows positions etc. and they are automatically created without problems. Four text blocks need to be added to the pbxproj file. Each text block contains one line for each file to be included in the package.

For each file to add in the App package there are two hashes that need to be calculated. XCode seems to be relaxed about those as far as they cross-reference correctly - I calculated them like this so they look pretty similar to what I saw XCode generate with an example I fed it.

             Vector selectedFilesToIncludeHex1 = new Vector();
             Vector selectedFilesToIncludeHex2 = new Vector();
             for (int k = 0; k<  selectedFilesToIncludePath.size(); k++) {
               String completeHex1 = "C489DF"+Integer.toHexString(k+233).toUpperCase() +"130E90F900C81312";
               String completeHex2 = "C489DF"+Integer.toHexString(k+224).toUpperCase() +"130E90F800C81312";
               selectedFilesToIncludeHex1.add(completeHex1);
               selectedFilesToIncludeHex2.add(completeHex2);
             }

There are four text blocks that need to be inserted:

             String Change1 = "" ;
             String Change2 = "" ;
             String Change3 = "" ;
             String Change4 = "" ;

Also there are two additional fields that are needed in a couple of those blocks: filetype and file encoding. I prepare the strings based on the file extension (that I keep in the selectedFilesToIncludeExtension Vector) like this:


             String fileType = "" ;
             String fileEncoding = "" ;

             for (int k = 0; k<  selectedFilesToIncludePath.size(); k++) {
               if (selectedFilesToIncludeExtension.get(k).equals("xml")) {
                 fileType = "text.xml";
                 fileEncoding = "fileEncoding = 4; ";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("txt")) {
                 fileType = "text";
                 fileEncoding = "fileEncoding = 4; ";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("mp3")) {
                 fileType = "audio.mp3";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("png")) {
                 fileType = "image.png";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("jpg")) {
                 fileType = "image.jpeg";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("gif")) {
                 fileType = "image.gif";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("aiff")) {
                 fileType = "audio.aiff";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("wav")) {
                 fileType = "audio.wav";
                 fileEncoding = "";
               }
               else{
                 fileType = "file";
                 fileEncoding = "";
               }

In the same loop as above, for each file I build 4 text blocks that need to be inserted in the project file:

               Change1 = Change1 +
                     "         " + selectedFilesToIncludeHex1.get(k) + " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " in Resources */ = {isa = PBXBuildFile; "+
                     "fileRef = " +
                     selectedFilesToIncludeHex2.get(k) +
                     " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " */; };\n";

               Change2 = Change2 + "           " +
                     selectedFilesToIncludeHex2.get(k) +
                      " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " */ = {isa = PBXFileReference; "+
                     fileEncoding +
                     "lastKnownFileType = " +
                     fileType +
                     "; path = "+
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     "; sourceTree = \"<group>\"; };\n";
               Change3 = Change3 + "\n                         " +
                     selectedFilesToIncludeHex2.get(k) +
                     " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " */,";
               Change4 = Change4 + "\n                         " +
                     selectedFilesToIncludeHex1.get(k) +
                     " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " in Resources */,";

             } // closed the for loop

Once the text blocks are built, these are the regexp I used to put them in the right place

             xCodeProjFileContents = FileLoaderAndSaver.loadFile(newXCodeProjFile, this); // this is my routine to load the file in a string
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXBuildFile\\ssection\\s\\*/", Change1 + "/* End PBXBuildFile section */");
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXFileReference\\ssection\\s\\*/", Change2 + "/* End PBXFileReference section */");
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sCustomTemplate\\s\\*/\\s\\=\\s\\{[\\n\\s\\t]*isa\\s\\=\\sPBXGroup\\;[\\n\\s\\t]*children\\s\\=\\s\\(", "/* CustomTemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (" + Change3);
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("\\)\\;[\\n\\s\\t]*runOnlyForDeploymentPostprocessing\\s\\=\\s0\\;[\\n\\s\\t]*\\}\\;[\\n\\s\\t]*/\\*\\sEnd\\sPBXResourcesBuildPhase\\ssection\\s\\*/", Change4 + ");\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\t};\n/* End PBXResourcesBuildPhase section */");
             FileLoaderAndSaver.saveFile( newXCodeProjFile , xCodeProjFileContents , this); // another routine to save the file

Hope the formatting came out allright.

D
-
Davide Della Casa

On 21 Feb 2011, at 17:46, Paul Zirkle wrote:

I'm currently working on my own engine (instead of using NME, sorry!) for cross platform mobile development, however if this project file system seems beneficial, I may try to use it as well.

-Paul Zirkle

On Mon, Feb 21, 2011 at 9:34 AM, Davide Della Casa<[hidden email]>  wrote:
Hi Hugh, All,

I recently made a java program that modifies the XCode project.pbxproj file so to correctly reference any files you may want to add to the App package.

There are two hashes that one needs to include in 4 places and a couple of extra fields like a filetype and file encoding.

Seems to work pretty well (considering that the reverse-engineering of the hashes is very crude - but apparently it's good enough), let me know if that could be useful to create the XCode project.

D

On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:

Hi,
There have been a few questions about getting started with hxcpp/NME,
so I thought I would give a quick update on my current theories
for the next version on NME.

I have been working on a project system for NME.
The idea is that you write a "project" file instead of a .hxml file.
 From this file, all the boiler-plate project + code files are generated
for the various different targets.  These files are "disposable", so
you can blow them away every night if you wish and start again.
Your "precious" files are your source code, your assets and your
single project file, and I would expect these to be under source control,
and everything else can get trashed. I have only looked at NME sample 06
at this stage, but the project looks like this:


<?xml version="1.0" encoding="utf-8"?>
<project>

 <app
    file="Sample06"
    title="NME Sample 06 - Drums"
    package="org.haxe.nme.sample06"
    version="1.0"
    company="nme"
        main="Sample"
 />

 <window
     width="400"
     height="300"
     orientation="landscape"
     fps="60"
     background="0xffffff"
     resizeable="true"
     hardware="true"
      />


 <classpath name="." />
 <haxelib name="nme" />

 <assets>
    <asset name="Data/drum_kit.jpg" />
    <asset name="Data/bang.png"     />
    <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
    <sound name="Data/drum.ogg"     />
    <sound name="Data/bass.wav"     />
    <sound name="Data/drums.ogg"   />
 </assets>


 <ndll name="std" />
 <ndll name="regexp" />
 <ndll name="zlib" />
 <ndll name="nme" haxelib="nme" nekoapi="1"/>

 <certificates>
    <certificate file="signature.cer" name="mysign" password="ajkhsakjhf" />
 </certificates>

</project>


As you may or may not see, I use pretty much the same architecture as
I did the the hxcpp build tool.

 From this, I can already create windows hxcpp or neko foilders and Android Apks.
I'm working on iPhone xcode projects and GHP/Caanoo installs.
I intend to push this with windows NSIS installers, mac dmgs, linux (tar files???)
and swf scp so you can go from haxe file to installer with one step.
The "certificates" part is crap at the moment - haven't quite worked out what
to do there.  Also thinking about having vector-based icons that can be
rendered to different resolutions.
I have not started the flash code, but it will probably use an external tool
such as swfmill, can create that project file from this one.
The haxe.Template code make most of this quite easy.

I am also moving the window creation code into the templates to make a direct port
of the flash code easier.

The procedure will go like this:
0. Install a whole bunch of thirdparty tools
1. write haxe code
2. write project file
3. run anywhere/profit.

Maybe with closer integration with FlashDevelop, or some kind of gui app,
step 2 may become trivial.

So if anyone has any comments on this, or would like to contribute (especially
with mac or linux installers) please speak up.

Hugh

--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

Tarwin Stroh-Spijer
Alas, it says, as expected:

"a Jailbroken iPhone"


Tarwin Stroh-Spijer
_______________________

Touch My Pixel
http://www.touchmypixel.com/
phone: +61 3 8060 5321
_______________________


On Wed, Feb 23, 2011 at 7:28 AM, [hidden email] <[hidden email]> wrote:
I don't know probably take some effort and some googling but I am not convinced

On 22 Feb 2011, at 19:38, Tarwin Stroh-Spijer wrote:

I'm pretty sure you need XCode to do iPhone stuff. There's a whole lot of code-signing and such involved - maybe some smart person can do it without but I doubt it - this is Apple we're talking about.


Tarwin Stroh-Spijer
_______________________

Touch My Pixel
http://www.touchmypixel.com/
phone: +61 3 8060 5321
_______________________


On Wed, Feb 23, 2011 at 12:48 AM, justin_mills <[hidden email]> wrote:
It would be nice to start moving away from Xcode dependancy for IPhone, first maybe get something working on textmate...
http://www.pathf.com/blogs/2008/11/iphone-sdk-testing-with-textmate-gtm/

Then move to maybe not even depending on a mac, i did find a pdf doc that covered an approach.  Having XCode do too much does not seem ideal, it's like sometimes I want to see the hxml file in flashdevelop and really I am against editor being dictated by the tech.

Le 22/02/2011 14:28, Davide Della Casa a écrit :

Yes any unique will do. If you have six files, the 12 "hashes" can just be the numbers 1...12, XCode re-writes those to correct values when opening.

Also, I noticed that the filetype can be set to "dummy" and XCode re-calculates that when opening too, so all that code that looks at the extension can be binned.

Not so with the file encoding string: I tried to put a dummy number there, XCode opened fine but re-calculated the dummies to 16 digits numbers that don't look too sane - so maybe it's worth putting that "fileEncoding = 4; " for all the text-type files (and other assets such as images/sounds don't seem to require the fileEncoding).

I've done some googling ( http://www.google.co.uk/search?q="fileEncoding+%3D"+~+"lastKnownFileType" ) and there seem to be the following encodings: 0,3,4,5,7,8,10,12,15,21,30 - it doesn't ring any bell to me (no it's not the "Lost" numbers :-).


On 21 Feb 2011, at 23:57, Hugh Sanderson wrote:

Hi Davide,
This is just the sort of info I was after - I'll see what I can make of it.
I wonder if any unique has will do, eg md5 of the filepath?

Paul Zirkle, the nme project should also be useful for other projects.
Currently it assumes an NME specific starting point, but that can easily be changed.
I have already though about using it for command-line apps,
so another graphics system should be no different.

Hugh

To give a specific name to an XCode project, this is how I did it (again, not catering for whitespaces):

- rename the plist file to [projectName]-Info.plist
- rename xcodeproj directory to [projectName].xcodeproj
- replace all the occurrences of the old project name inside the pbxproj file in the xcodeproj directory

This grok and the previous grok so far produced functional XCode project directories correctly referencing files (the files were copied in the project folder by the way - the previous grok is likely not to work if you want to link files coming from other locations).

D

On 21 Feb 2011, at 18:44, Davide Della Casa wrote:

OK here is how I grokked it in case it helps.

(Caveat: I didn't cater for whitespaces in the filenames yet.)

There are three files in the XCode .xcodeproj project directory. The only important one is the project.pbxproj file, I trash the other two as they seem to contain satellite preferences and bookmarks, windows positions etc. and they are automatically created without problems. Four text blocks need to be added to the pbxproj file. Each text block contains one line for each file to be included in the package.

For each file to add in the App package there are two hashes that need to be calculated. XCode seems to be relaxed about those as far as they cross-reference correctly - I calculated them like this so they look pretty similar to what I saw XCode generate with an example I fed it.

             Vector selectedFilesToIncludeHex1 = new Vector();
             Vector selectedFilesToIncludeHex2 = new Vector();
             for (int k = 0; k<  selectedFilesToIncludePath.size(); k++) {
               String completeHex1 = "C489DF"+Integer.toHexString(k+233).toUpperCase() +"130E90F900C81312";
               String completeHex2 = "C489DF"+Integer.toHexString(k+224).toUpperCase() +"130E90F800C81312";
               selectedFilesToIncludeHex1.add(completeHex1);
               selectedFilesToIncludeHex2.add(completeHex2);
             }

There are four text blocks that need to be inserted:

             String Change1 = "" ;
             String Change2 = "" ;
             String Change3 = "" ;
             String Change4 = "" ;

Also there are two additional fields that are needed in a couple of those blocks: filetype and file encoding. I prepare the strings based on the file extension (that I keep in the selectedFilesToIncludeExtension Vector) like this:


             String fileType = "" ;
             String fileEncoding = "" ;

             for (int k = 0; k<  selectedFilesToIncludePath.size(); k++) {
               if (selectedFilesToIncludeExtension.get(k).equals("xml")) {
                 fileType = "text.xml";
                 fileEncoding = "fileEncoding = 4; ";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("txt")) {
                 fileType = "text";
                 fileEncoding = "fileEncoding = 4; ";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("mp3")) {
                 fileType = "audio.mp3";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("png")) {
                 fileType = "image.png";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("jpg")) {
                 fileType = "image.jpeg";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("gif")) {
                 fileType = "image.gif";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("aiff")) {
                 fileType = "audio.aiff";
                 fileEncoding = "";
               }
               else if (selectedFilesToIncludeExtension.get(k).equals("wav")) {
                 fileType = "audio.wav";
                 fileEncoding = "";
               }
               else{
                 fileType = "file";
                 fileEncoding = "";
               }

In the same loop as above, for each file I build 4 text blocks that need to be inserted in the project file:

               Change1 = Change1 +
                     "         " + selectedFilesToIncludeHex1.get(k) + " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " in Resources */ = {isa = PBXBuildFile; "+
                     "fileRef = " +
                     selectedFilesToIncludeHex2.get(k) +
                     " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " */; };\n";

               Change2 = Change2 + "           " +
                     selectedFilesToIncludeHex2.get(k) +
                      " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " */ = {isa = PBXFileReference; "+
                     fileEncoding +
                     "lastKnownFileType = " +
                     fileType +
                     "; path = "+
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     "; sourceTree = \"<group>\"; };\n";
               Change3 = Change3 + "\n                         " +
                     selectedFilesToIncludeHex2.get(k) +
                     " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " */,";
               Change4 = Change4 + "\n                         " +
                     selectedFilesToIncludeHex1.get(k) +
                     " /* " +
                     selectedFilesToIncludeNameWithExtension.get(k) +
                     " in Resources */,";

             } // closed the for loop

Once the text blocks are built, these are the regexp I used to put them in the right place

             xCodeProjFileContents = FileLoaderAndSaver.loadFile(newXCodeProjFile, this); // this is my routine to load the file in a string
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXBuildFile\\ssection\\s\\*/", Change1 + "/* End PBXBuildFile section */");
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sEnd\\sPBXFileReference\\ssection\\s\\*/", Change2 + "/* End PBXFileReference section */");
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("/\\*\\sCustomTemplate\\s\\*/\\s\\=\\s\\{[\\n\\s\\t]*isa\\s\\=\\sPBXGroup\\;[\\n\\s\\t]*children\\s\\=\\s\\(", "/* CustomTemplate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (" + Change3);
             xCodeProjFileContents = xCodeProjFileContents.replaceAll("\\)\\;[\\n\\s\\t]*runOnlyForDeploymentPostprocessing\\s\\=\\s0\\;[\\n\\s\\t]*\\}\\;[\\n\\s\\t]*/\\*\\sEnd\\sPBXResourcesBuildPhase\\ssection\\s\\*/", Change4 + ");\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\t};\n/* End PBXResourcesBuildPhase section */");
             FileLoaderAndSaver.saveFile( newXCodeProjFile , xCodeProjFileContents , this); // another routine to save the file

Hope the formatting came out allright.

D
-
Davide Della Casa

On 21 Feb 2011, at 17:46, Paul Zirkle wrote:

I'm currently working on my own engine (instead of using NME, sorry!) for cross platform mobile development, however if this project file system seems beneficial, I may try to use it as well.

-Paul Zirkle

On Mon, Feb 21, 2011 at 9:34 AM, Davide Della Casa<[hidden email]>  wrote:
Hi Hugh, All,

I recently made a java program that modifies the XCode project.pbxproj file so to correctly reference any files you may want to add to the App package.

There are two hashes that one needs to include in 4 places and a couple of extra fields like a filetype and file encoding.

Seems to work pretty well (considering that the reverse-engineering of the hashes is very crude - but apparently it's good enough), let me know if that could be useful to create the XCode project.

D

On 21 Feb 2011, at 14:17, Hugh Sanderson wrote:

Hi,
There have been a few questions about getting started with hxcpp/NME,
so I thought I would give a quick update on my current theories
for the next version on NME.

I have been working on a project system for NME.
The idea is that you write a "project" file instead of a .hxml file.
 From this file, all the boiler-plate project + code files are generated
for the various different targets.  These files are "disposable", so
you can blow them away every night if you wish and start again.
Your "precious" files are your source code, your assets and your
single project file, and I would expect these to be under source control,
and everything else can get trashed. I have only looked at NME sample 06
at this stage, but the project looks like this:


<?xml version="1.0" encoding="utf-8"?>
<project>

 <app
    file="Sample06"
    title="NME Sample 06 - Drums"
    package="org.haxe.nme.sample06"
    version="1.0"
    company="nme"
        main="Sample"
 />

 <window
     width="400"
     height="300"
     orientation="landscape"
     fps="60"
     background="0xffffff"
     resizeable="true"
     hardware="true"
      />


 <classpath name="." />
 <haxelib name="nme" />

 <assets>
    <asset name="Data/drum_kit.jpg" />
    <asset name="Data/bang.png"     />
    <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
    <sound name="Data/drum.ogg"     />
    <sound name="Data/bass.wav"     />
    <sound name="Data/drums.ogg"   />
 </assets>


 <ndll name="std" />
 <ndll name="regexp" />
 <ndll name="zlib" />
 <ndll name="nme" haxelib="nme" nekoapi="1"/>

 <certificates>
    <certificate file="signature.cer" name="mysign" password="ajkhsakjhf" />
 </certificates>

</project>


As you may or may not see, I use pretty much the same architecture as
I did the the hxcpp build tool.

 From this, I can already create windows hxcpp or neko foilders and Android Apks.
I'm working on iPhone xcode projects and GHP/Caanoo installs.
I intend to push this with windows NSIS installers, mac dmgs, linux (tar files???)
and swf scp so you can go from haxe file to installer with one step.
The "certificates" part is crap at the moment - haven't quite worked out what
to do there.  Also thinking about having vector-based icons that can be
rendered to different resolutions.
I have not started the flash code, but it will probably use an external tool
such as swfmill, can create that project file from this one.
The haxe.Template code make most of this quite easy.

I am also moving the window creation code into the templates to make a direct port
of the flash code easier.

The procedure will go like this:
0. Install a whole bunch of thirdparty tools
1. write haxe code
2. write project file
3. run anywhere/profit.

Maybe with closer integration with FlashDevelop, or some kind of gui app,
step 2 may become trivial.

So if anyone has any comments on this, or would like to contribute (especially
with mac or linux installers) please speak up.

Hugh

--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

singmajesty
In reply to this post by Gamehaxe
Hi Hugh,

I just got the chance to try out your new install tool. It works great.  
This is a good idea, moving forward. This will make it much easier to  
"upgrade" projects to the latest version of NME ... much better than  
copying libraries, and in some cases updating project files.

Here are some of the changes:

  - Fixed instances where BUILD_DIR wasn't being respected
  - Added "android update" to build process so paths would be resolved  
automatically (original build.xml wouldn't compile on my machine)
  - Renamed "MainActivity-debug.apk" to (NameOfTheProject)-debug.apk so it  
would have the right name
  - Added an src attribute to asset nodes, so you could specify the file  
system path separately from the final path (IE: Export/fonts/MyFont.ttf  
vs. fonts/MyFont.ttf)
  - Made it so "run" would not build the project

I created a FlashDevelop project which uses a "Packager" Neko script to  
add the build directory and asset nodes automatically. When I can, I'd  
also like to make it support classpaths, so those are also populated  
automatically. I haven't turned it into a project template yet, which I'll  
do in the near future.

The patch files also include changes I made in order to compile for webOS  
and Android ... nothing huge. The largest patch is for HXCPP, just because  
it includes the files for SQLite.

You can check them out here:

http://www.eclecticdesignstudio.com/code/haxe/patches/

Feel free to integrate (or adjust, or discard) any of these changes. This  
is just the stuff I needed to compile, and to improve some of the things I  
needed.




On Mon, 21 Feb 2011 06:17:32 -0800, Hugh Sanderson <[hidden email]>  
wrote:

>
> Hi,
> There have been a few questions about getting started with hxcpp/NME,
> so I thought I would give a quick update on my current theories
> for the next version on NME.
>
> I have been working on a project system for NME.
> The idea is that you write a "project" file instead of a .hxml file.
>  From this file, all the boiler-plate project + code files are generated
> for the various different targets.  These files are "disposable", so
> you can blow them away every night if you wish and start again.
> Your "precious" files are your source code, your assets and your
> single project file, and I would expect these to be under source control,
> and everything else can get trashed. I have only looked at NME sample 06
> at this stage, but the project looks like this:
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <project>
>
>    <app
>       file="Sample06"
>       title="NME Sample 06 - Drums"
>       package="org.haxe.nme.sample06"
>       version="1.0"
>       company="nme"
>  main="Sample"
>    />
>
>    <window
>        width="400"
>        height="300"
>        orientation="landscape"
>        fps="60"
>        background="0xffffff"
>        resizeable="true"
>        hardware="true"
> />
>
>
>    <classpath name="." />
>    <haxelib name="nme" />
>
>    <assets>
>       <asset name="Data/drum_kit.jpg" />
>       <asset name="Data/bang.png"     />
>       <music name="Data/Party_Gu-Jeremy_S-8250_hifi.mp3"/>
>       <sound name="Data/drum.ogg"     />
>       <sound name="Data/bass.wav"     />
>       <sound name="Data/drums.ogg"   />
>    </assets>
>
>
>    <ndll name="std" />
>    <ndll name="regexp" />
>    <ndll name="zlib" />
>    <ndll name="nme" haxelib="nme" nekoapi="1"/>
>
>    <certificates>
>       <certificate file="signature.cer" name="mysign"  
> password="ajkhsakjhf" />
>    </certificates>
>
> </project>
>
>
> As you may or may not see, I use pretty much the same architecture as
> I did the the hxcpp build tool.
>
>  From this, I can already create windows hxcpp or neko foilders and  
> Android Apks.
> I'm working on iPhone xcode projects and GHP/Caanoo installs.
> I intend to push this with windows NSIS installers, mac dmgs, linux (tar  
> files???)
> and swf scp so you can go from haxe file to installer with one step.
> The "certificates" part is crap at the moment - haven't quite worked out  
> what
> to do there.  Also thinking about having vector-based icons that can be
> rendered to different resolutions.
> I have not started the flash code, but it will probably use an external  
> tool
> such as swfmill, can create that project file from this one.
> The haxe.Template code make most of this quite easy.
>
> I am also moving the window creation code into the templates to make a  
> direct port
> of the flash code easier.
>
> The procedure will go like this:
> 0. Install a whole bunch of thirdparty tools
> 1. write haxe code
> 2. write project file
> 3. run anywhere/profit.
>
> Maybe with closer integration with FlashDevelop, or some kind of gui app,
> step 2 may become trivial.
>
> So if anyone has any comments on this, or would like to contribute  
> (especially
> with mac or linux installers) please speak up.
>
> Hugh

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Getting started with NME

Tony Polinelli
In reply to this post by Tarwin Stroh-Spijer
You don't need to dev in Xcode anyways. I dev on my pc exporting to an
exe (first flash). In xcode you just ref the src over the network.
Xocdd is just a big compile button, an expensive compile button none
the less. I am sure if you were in textmate you could have a script
jump to Xcode and compile. It don't think other approaches are worth
playing with


>
> On Wed, Feb 23, 2011 at 12:48 AM, justin_mills <[hidden email]> wrote:
>
>
>  It would be nice to start moving away from Xcode dependancy for IPhone, first maybe get something working on textmate...
>  http://www.pathf.com/blogs/2008/11/iphone-sdk-testing-with-textmate-gtm/
>
>  Then move to maybe not even depending on a mac, i did find a pdf doc that covered an approach.  Having XCode do too much does not seem ideal, it's like sometimes I want to see the hxml file in flashdevelop and really I am against editor being dictated by the tech.
>
>  Le 22/02/2011 14:28, Davide Della Casa a écrit :
>   Yes any unique will do. If you have six files, the 12 "hashes" can just be the numbers 1...12, XCode re-writes those to correct values when opening.
>
>  Also, I noticed that the filetype can be set to "dummy" and XCode re-calculates that when opening too, so all that code that looks at the extension can be binned.
>
>  Not so with the file encoding string: I tried to put a dummy number there, XCode opened fine but re-calculated the dummies to 16 digits numbers that don't look too sane - so maybe it's worth putting that "fileEncoding = 4; " for all the text-type files (and other assets such as images/sounds don't seem to require the fileEncoding).
>
>  I've done some googling ( http://www.google.co.uk/search?q="fileEncoding+%3D"+~+"lastKnownFileType" ) and there seem to be the following encodings: 0,3,4,5,7,8,10,12,15,21,30 - it doesn't ring any bell to me (no it's not the "Lost" numbers :-).
>
>
>  On 21 Feb 2011, at 23:57, Hugh Sanderson wrote:
>
>   Hi Davide,
>  This is just the sort of info I was after - I'll see what I can make of it.
>  I wonder if any unique has will do, eg md5 of the filepath?
>
>  Paul Zirkle, the nme project should also be useful for other projects.
>  Currently it assumes an NME specific starting point, but that can easily be changed.
>  I have already though about using it for command-line apps,
>  so another graphics system should be no different.
>
>  Hugh
>
>
>
>  To give a specific name to an XCode project, this is how I did it (again, not catering for whitespaces):
>
>  - rename the plist file to [projectName]-Info.plist
>  - rename xcodeproj directory to [projectName].xcodeproj
>  - replace all the occurrences of the old project name inside the pbxproj file in the xcodeproj directory
>
>  This grok and the previous grok so far produced functional XCode project directories correctly referencing files (the files were copied in the project folder by the way - the previous grok is likely not to work if you want to link files coming from other locations).
>
>  D
>
>  On 21 Feb 2011, at 18:44, Davide Della Casa wrote:
>
>   OK here is how I grokked it in case it help
>

--
haXe - an open source web programming language
http://haxe.org