<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Game Haxe &#187; nme</title>
	<atom:link href="http://gamehaxe.com/tag/nme/feed/" rel="self" type="application/rss+xml" />
	<link>http://gamehaxe.com</link>
	<description>Experimenting with Web Game Development</description>
	<lastBuildDate>Tue, 24 Apr 2012 15:57:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>NME From Scratch</title>
		<link>http://gamehaxe.com/2011/04/05/nme-from-scratch/</link>
		<comments>http://gamehaxe.com/2011/04/05/nme-from-scratch/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 16:37:26 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[hxcpp]]></category>
		<category><![CDATA[neko]]></category>
		<category><![CDATA[nme]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[Haxe]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=386</guid>
		<description><![CDATA[Part 1 &#8211; Get The Basics Going I&#8217;ve just got a shiny new computer at home &#8211; nothing installed. So it seems like a good chance to go through exactly what it takes to get and NME sample up and &#8230; <a href="http://gamehaxe.com/2011/04/05/nme-from-scratch/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Part 1 &#8211; Get The Basics Going</h1>
<p>I&#8217;ve just got a shiny new computer at home &#8211; nothing installed.  So it seems like a good chance to go through exactly what it takes to get and NME sample up and running on a new Windows 7 box.</p>
<p><em>8:20pm</em> For starters, I&#8217;ll need a c++ compiler, so first thing is to start the MSVC 2010 Express downloading: <a href="http://www.microsoft.com/express/Downloads/#2010-Visual-CPP">2010-Visual-CPP</a>.</p>
<p><em>8:25pm</em> OK &#8211; I&#8217;ve signed my rights away and that is downloading.  The next thing I&#8217;ll need is haxe.  It is easy to install from <a href="http://haxe.org/download">here</a>.</p>
<p><em>8:28pm</em> Haxe 2.07, neko 1.81 downloaded and installed.  Windows complained that it might not have installed correctly, but this is just because the exe had &#8220;installer&#8221; in the name, and did not write an &#8220;uninstall&#8221; entry.</p>
<p>Test: Start a &#8220;<strong>cmd</strong>&#8221; prompt by clicking on the Windows start circle and type &#8220;<strong>cmd</strong>[Enter]&#8221; into the search box.  And in this box, type &#8220;<strong>haxe</strong> [Enter]&#8220;. I am now rewarded with the haxe help message.</p>
<p><em>8:35pm</em> Visual C++ Express in successfully installed.<br />
Test:  Start up a new cmd shell, and type &#8220;<strong>cl</strong>&#8220;.  This does not work because the exe can&#8217;t be found in my path.  But here is the trick.  Type <strong>&#8220;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat&#8221;</strong> at the prompt (note:include the quotes!), and get the message &#8220;Setting environment for using Microsoft Visual Studio 2010 x86 tools.&#8221;.  Now &#8220;<strong>cl</strong>&#8221; is rewarded with the Microsoft banner.</p>
<p><em>8:41pm</em>  I&#8217;m on a bit of a roll here, so I&#8217;ll see if I can get an haxe project going.  As I said, I have nothing installed, so I&#8217;ll go old-school.  First thing is to make a directory.  The cmd prompt starts in my home directory (c:\Users\Hugh), and I will make a directory:<br />
<strong>mkdir projects<br />
cd projects<br />
mkdir hello<br />
cd hello</strong><br />
And now, do the best I can:<br />
<strong>notepad.exe Hello.hx</strong>  (yes I do want to create the file)<br />
<code>
<pre>
class Hello
{
  public static function main()
  {
     trace("Hello!");
  }
}
</pre>
<p></code><br />
And switch back to the cmd prompt:<br />
<strong>haxe -main Hello -neko hello.n<br />
neko hello.n</strong><br />
Hello.hx:5: Hello!</p>
<p>Woo Hoo! <em>8:48pm</em> and I&#8217;ve run my own program.</p>
<p>Now lets get even more adventurous, and try a c++ example.  Trying:<br />
<strong>haxe -main Hello -cpp bin</strong><br />
Tells me that &#8220;Project hxcpp is not installed&#8221; &#8211; so let&#8217;s install it:<br />
<strong>haxelib install hxcpp</strong><br />
And try again:<br />
<strong>haxe -main Hello -cpp bin</strong><br />
And test:<br />
<strong>bin\Hello.exe</strong><br />
<em>8:43pm</em>, I have my first hxcpp prgram working!</p>
<p>Now, try for some graphics:<br />
<strong>haxelib intall nme</strong><br />
and start a new project:<br />
<strong>cd ..<br />
mkdir graphics1<br />
cd graphics1<br />
copy &#8220;c:\Motion-Twin\haxe\lib\nme\2,0,1\samples\02-Text\Sample.hx&#8221;<br />
haxe -main Sample -cpp bin -lib nme<br />
bin\Sample.exe</strong></p>
<p><em>9:05pm</em> And there it is. Haxe, neko, hxcpp, nme VC2010 installed and run in 40 minutes, including this write up.</p>
<h1>Part 2 &#8211; Compile NME From Source</h2>
<p>Well, that went much better than I expected, so I will now attempt some bleeding-edge stuff.  The version on NME used above is old, and I have no one to blame but myself.  My intentions are to do a release soon, but I just have not got my finger out.  Which leave me with the option of compiling NME from source if I want the latest features.</p>
<p>First thing, is to create a place where I can download various bits of source code for compiling.  I&#8217;m going to put it a &#8220;e:\code.google&#8221;, because my C drive is a fast SSD, and has limited room.</p>
<p><strong>e:<br />
mkdir code.google<br />
cd code.google</strong></p>
<p>Following the instructions from the <a href="http://code.google.com/p/nekonme/source/checkout">source page</a>, but changing the name, I can get a copy with:<br />
<strong>svn checkout http://nekonme.googlecode.com/svn/trunk/ nme</strong><br />
- if only I had svn installed. So first install this, I&#8217;ll be using <a href="http://sourceforge.net/projects/win32svn/">this version</a>. Once installed, I have to restart the cmd prompt and do the vsvars32.bat thing again.  Now when I try again, I get the required files.  There is also a companion project to go with NME, and that is the &#8220;sdl-static&#8221; project, which contains libraries required by NME.  To get this, simply do:<br />
<strong>svn checkout http://sdl-static.googlecode.com/svn/trunk/ sdl-static</strong><br />
This takes a while&#8230;.</p>
<p>Time to build -<br />
<strong>cd nme\project<br />
haxelib run hxcpp Build.xml</strong><br />
The &#8220;haxelib&#8221; tool looks for a file called &#8220;run.n&#8221; in an installed haxe library and runs it.  In the hxcpp project, the run.n file gathers compiler options to build the haxe output. This same program can be used to build other projects &#8211; including the NME project.  Unfortunately, compiling NME like this gives the error &#8221; cannot open input file &#8216;ddraw.lib&#8217;&#8221;.  This is because the VC express install does not have all the required system support files.  This file can be found in the &#8220;DirectX SDK&#8221;, and I&#8217;ll be using the <a href="http://msdn.microsoft.com/en-us/directx/aa937788">June 2010 version</a>.  This is a huge file, so it will take a while.  If you think it is a lot of effort for a tiny lib, then you are right.</p>
<p><em>10:10pm</em> and the download has finished.  I have chosen to install it in &#8220;e:\SDKs\Microsoft DirectX SDK (June 2010)&#8221;, because I&#8217;m trying not to put crap on my C drive, and I will be installing quite a few SDKs, and it is nice to have them all together.</p>
<p>This does not immediately fix the problem, because the NME project does not know where I installed it.  This is where the per-machine hxcpp config comes in.</p>
<p>Following the instructions in BuildCommon.xml, I create a file in &#8220;C:\Users\Hugh&#8221; called &#8220;.hxcpp_config.xml&#8221;, and put the following in it:</p>
<p><code></p>
<pre>
&lt;xml>
  &lt;section id="exes">
     &lt;linker id="dll" if="windows">
        &lt;flag value = "-libpath:e:\SDKs\Microsoft DirectX SDK (June 2010)\Lib\x86"/>
     &lt;/linker>
  &lt;/section>
&lt;/xml>
</pre>
<p></code></p>
<p>Oh crikey! Looks like Microsoft in their wisdom have dropped support for this ddraw.lib, and I&#8217;m currently using a version of SDL that needs it! It&#8217;s OK, problem solved &#8211; I&#8217;ve added it to the NME project, but you still need the SDK for dxguid.lib, which I guess I should also add.</p>
<p>Anyhow, after a long delay, at <em>10:30pm</em> I have NME building!</p>
<p>Now, going back to the original graphics1 example, the first thing to do is tell haxe to use our SVN haxe code instead of the 2.0.1 dowloaded from haxelib.  This is done via:<br />
<strong>haxelib dev nme e:/code.google/nme</strong></p>
<p>Then build &#038; test:<br />
<strong>haxe -main Sample -cpp bin -lib nme<br />
bin\Sample.exe</strong></p>
<p>Which works as before.  But now we can test some of the new features in NME.  First get the new sample, and the new associated project file:<br />
<strong>copy e:\code.google\nme\samples\02-Text\Sample.hx .<br />
copy e:\code.google\nme\samples\02-Text\Sample.nmml .</strong></p>
<p>Then you can use the NME build tool, with the command &#8220;test&#8221; (which is &#8220;build&#8221; and &#8220;run&#8221;) on the Sample.nmml project file, and for the target &#8220;neko&#8221;.<br />
<strong>haxelib run nme test Sample.nmml neko</strong><br />
And you can see the result.  Then you can test for cpp:<br />
<strong>haxelib run nme test Sample.nmml cpp</strong></p>
<p>So it&#8217;s now <em>10:45pm</em> (had to catch the end of &#8220;Dexter&#8221;) and I&#8217;ve successfully compiled the latest version of NME and tested the new project feature.</p>
<h2>Part 3 &#8211; Android</h2>
<p>Things seem to still be going well, so I&#8217;m going to take one more step &#8211; android (spoiler &#8211; this is going to take longer than expected).  First thing to so is install the <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Java Development Kit</a>. (NOTE: Install the &#8220;windows&#8221; version, not the &#8220;x64&#8243; version) Then, the <a href="http://developer.android.com/sdk/index.html">android SDK</a>.<br />
I installed java JRE and JDK in my SDK directory, but Google&#8217;s (always painful) build tools seem to think I have not installed java, even though it works from the cmd prompt.  Thank guys. So I&#8217;ve uninstalled it, and reinstalled the JRE in the default location, and now it seems happy.  The Android SDK download is just the start &#8211; it now runs and downloads a whole bunch more.  This looks like it may take some time&#8230;</p>
<p>I may as well get on with <a href="http://developer.android.com/sdk/ndk/index.html">downloading the NDK</a> too.   And while I wait for those I&#8217;ll get my phone ADB USB drivers installed.  My HTC phone actually installs the drivers when I install HTCSync, found on my sdcard that was shipped with it.<br />
<em><strong>EDIT</strong>: The android ndk r5b still has issues with exceptions/c++.  However, these can be solved by dropping <a href="http://gamehaxe.com/wp-content/android/libstdc++.a">this version of libstdc++.a</a> from the Crystax r4 distribution over the top of sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a in your downloaded ndk.  If google ever manage to write a good build system, they might end up being a successful company.</em></p>
<p>The Google build tools also require <a href="http://www.cygwin.com/install.html">the &#8220;Cygwin&#8221; utilities</a>, so install these too.</p>
<p>Finally, we will need a new version of hxcpp, which we can get with:<br />
<strong>e:<br />
svn checkout http://hxcpp.googlecode.com/svn/trunk/ hxcpp<br />
haxelib dev hxcpp e:\code.google\hxcpp</strong></p>
<p><em>11:45pm</em>, I have finally downloaded and installed the Android prerequisites (I think) but will give up now.</p>
<p><em>Next day</em> &#8211; Here we go again.  Now to use the google android NDK, you need to have the cygwin dlls in your exe path.  To change the path, right click in the &#8220;Computer&#8221; shortcut in the start menu, and choose &#8220;properties&#8221;, then on the left &#8220;Advance system settings&#8221;, then the &#8220;Environment Variables&#8221; button and scroll through the top bit for &#8220;PATH&#8221; and click &#8220;edit&#8221;.  This already has haxe and neko in it, so we add the cygwin:<br />
<strong>%HAXEPATH%;%NEKO_INSTPATH%;e:\SDKs\cygwin\bin</strong><br />
Now restart the cmd prompt, and typing &#8220;<strong>ls</strong>&#8221; should work.<br />
And one more thing &#8211; in lieu of using &#8220;eclipse&#8221; for java building (which I just can&#8217;t stand &#8211; don&#8217;t get me started), the google tools need the <a href="http://ant.apache.org/bindownload.cgi">&#8220;ant&#8221; program</a>, which you install by unzipping somewhere.</p>
<p>Tell the build system where we installed these things.</p>
<p><strong>set ANT_HOME=e:/SDKs/ant<br />
set ANDROID_SDK=e:\SDKs\android-sdk<br />
set ANDROID_NDK_ROOT=e:\SDKs\android-ndk<br />
set JAVA_HOME=e:\SDKs\Java\jdk1.6.0_24</strong></p>
<p>And rebuild nme, like before, except that the &#8220;obj&#8221; directory should be removed first, because I have not yet allowed 2 compilers to be running at the same time.<br />
<strong>haxelib run hxcpp Build.xml -Dandroid</strong></p>
<p>Now, back in the original directory, we can build + run for android:<br />
<strong>haxelib run nme test Sample.nmml android</strong></p>
<p>Which, finally, works! You can terminate the debug log with control-c.</p>
<p>So, an awful lot of set up, but subsequent projects should only be a single line.</p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2011/04/05/nme-from-scratch/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>NME Font Rendering</title>
		<link>http://gamehaxe.com/2011/03/28/nme-font-rendering/</link>
		<comments>http://gamehaxe.com/2011/03/28/nme-font-rendering/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 13:49:30 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[nme]]></category>
		<category><![CDATA[Result]]></category>
		<category><![CDATA[AA]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=359</guid>
		<description><![CDATA[I notice FreeType has a new version out, which has some reasonable changes since a key patent has expired. Version 2.3.9, Default Version 2.3.9, AutoHinting Version 2.4.4, Default Version 2.4.4, AutoHinting Flash (Mac) GDI Threshold (Current) GDI AA GDI AA &#8230; <a href="http://gamehaxe.com/2011/03/28/nme-font-rendering/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I notice FreeType has a new version out, which has some reasonable changes since a key patent has expired.</p>
<table style="vertical-align=middle;">
<tr>
<td >Version 2.3.9, Default</td>
<td>
<a href="http://gamehaxe.com/wp-content/uploads/2011/03/FT-Default.png"><img src="http://gamehaxe.com/wp-content/uploads/2011/03/FT-Default.png" alt="" title="FT-Default" width="240" height="120" class="alignnone size-full wp-image-360" /></a>
</td>
</tr>
<tr valign="center">
<td >Version 2.3.9, AutoHinting</td>
<td>
<a href="http://gamehaxe.com/wp-content/uploads/2011/03/FT-AutoHint.png"><img src="http://gamehaxe.com/wp-content/uploads/2011/03/FT-AutoHint.png" alt="" title="FT-AutoHint" width="240" height="120" class="alignnone size-full wp-image-361" /></a>
</td>
</tr>
<tr>
<td>Version 2.4.4, Default</td>
<td>
<a href="http://gamehaxe.com/wp-content/uploads/2011/03/FT-2.2.4-Default.png"><img src="http://gamehaxe.com/wp-content/uploads/2011/03/FT-2.2.4-Default.png" alt="" title="FT-2.2.4-Default" width="240" height="120" class="alignnone size-full wp-image-362" /></a>
</td>
</tr>
<tr>
<td>Version 2.4.4, AutoHinting</td>
<td>
<a href="http://gamehaxe.com/wp-content/uploads/2011/03/FT-2.2.4-AutoHint.png"><img src="http://gamehaxe.com/wp-content/uploads/2011/03/FT-2.2.4-AutoHint.png" alt="" title="FT-2.2.4-AutoHint" width="240" height="120" class="alignnone size-full wp-image-363" /></a>
</td>
</tr>
<tr>
<td>Flash  (Mac)</td>
<td>
<a href="http://gamehaxe.com/wp-content/uploads/2011/03/MacFlash.png"><img src="http://gamehaxe.com/wp-content/uploads/2011/03/MacFlash.png" alt="" title="MacFlash" width="240" height="120" class="alignnone size-full wp-image-364" /></a>
</td>
</tr>
<tr>
<td>GDI Threshold (Current)</td>
<td>
<a href="http://gamehaxe.com/wp-content/uploads/2011/03/GDI_threshold.png"><img src="http://gamehaxe.com/wp-content/uploads/2011/03/GDI_threshold.png" alt="" title="GDI_threshold" width="240" height="120" class="alignnone size-full wp-image-377" /></a>
</td>
</tr>
<tr>
<td>GDI AA</td>
<td>
<a href="http://gamehaxe.com/wp-content/uploads/2011/03/GDI_AA_raw.png"><img src="http://gamehaxe.com/wp-content/uploads/2011/03/GDI_AA_raw.png" alt="" title="GDI_AA_raw" width="240" height="120" class="alignnone size-full wp-image-378" /></a>
</td>
</tr>
<tr>
<td>GDI AA + Gamma</td>
<td>
<a href="http://gamehaxe.com/wp-content/uploads/2011/03/GDI_AA_gamma.png"><img src="http://gamehaxe.com/wp-content/uploads/2011/03/GDI_AA_gamma.png" alt="" title="GDI_AA_gamma" width="240" height="120" class="alignnone size-full wp-image-379" /></a>
</td>
</tr>
<tr>
<td>Flash  (Windows)</td>
<td>
<a href="http://gamehaxe.com/wp-content/uploads/2011/03/WindowsFlash.png"><img src="http://gamehaxe.com/wp-content/uploads/2011/03/WindowsFlash.png" alt="" title="WindowsFlash" width="240" height="120" class="alignnone size-full wp-image-380" /></a>
</td>
</tr>
</table>
<p>So a few observations: The &#8220;Default Hinting&#8221; has changed quite a bit for TrueType fonts in the latest version.  I think this code is what the expired patent related to, allowing the font-specific hinting data to be used.  The &#8220;AutoHinting&#8221; mode is based on font-independent logic built into FreeType. The Flash renderer uses component based sub-pixel rendering, using RGB components to get finer details.  The font also looks a bit &#8220;fatter&#8221;.</p>
<p>Currently NME uses a single set of bitmaps for the fonts, which must be used for all colours.  This means that component based sub-pixel rendering is not really an option.  However, it may be possible to sort something out (at the expense of more memory) if the need really arises.  But also note, this is counter-productive in landscape mode on mobile devices.</p>
<p>On windows, NME currently uses GDI fonts with a threshold.  I like the look of this (I spend most of my time on windows) for the small fonts, but it looks pretty bad on the larger fonts.  Particularly note the exactly 1-pixel wide vertical lines in the &#8220;H&#8221; and the &#8220;l&#8221;, which I like. The larger fonts look much better with anti-aliasing on.  However, windows applies some kind of gamma-correction when rendering fonts, and you get quite a different look for black-on-white and white-on-black.  To work around this, I have applied a lookup-table to get a bitmap that will work for both light and dark.</p>
<p>Finally notice the windows flash renderer does not use AA with this swf (although the Mac version did).</p>
<p>In the next version, I will change windows over to use GDI + AA + Gamma.  It is possible to use FreeType, but I think the font is slightly less readable at the smaller sizes.  What do you think?</p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2011/03/28/nme-font-rendering/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Four Years &#8211; Still Kicking</title>
		<link>http://gamehaxe.com/2011/03/13/four-years-still-kicking/</link>
		<comments>http://gamehaxe.com/2011/03/13/four-years-still-kicking/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 13:00:40 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Haxe]]></category>
		<category><![CDATA[hxcpp]]></category>
		<category><![CDATA[nme]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=355</guid>
		<description><![CDATA[Wow, I missed the 4-year anniversary. I have been a bit remiss in updating the old social-media postings of late, but will try harder. So apologies to those whose comments I have not answered, and I hope to do better &#8230; <a href="http://gamehaxe.com/2011/03/13/four-years-still-kicking/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Wow, I missed the 4-year anniversary.  I have been a bit remiss in updating the old social-media postings of late, but will try harder.  So apologies to those whose comments I have not answered, and I hope to do better in the future.</p>
<p>I would also like say a big thanks to those who have donated to the site &#8211; it is nice to feel useful.</p>
<p>The main change since last update was the release of hxcpp 2.07.  This goes with the latest haxe release and fixes many bugs, making the platform more robust.</p>
<p>Work on NME continues.  There has been some increased interest of late, and a new release is well overdue.  I&#8217;m currently working on a &#8220;project&#8221; system to help with getting up-and-running on the various platforms.  This will replace the iPhone template system and extend it to all supported platforms.</p>
<p>You can always checkout the svn version of <a href="http://code.google.com/p/nekonme">NME</a>, but you will need to build the binaries yourself.  Although I have quite a few outstanding issues, I think I will do a release once I get the project system up-and-running.</p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2011/03/13/four-years-still-kicking/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Minor Updates</title>
		<link>http://gamehaxe.com/2010/09/12/minor-updates/</link>
		<comments>http://gamehaxe.com/2010/09/12/minor-updates/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 16:14:25 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[hxcpp]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[nme]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=336</guid>
		<description><![CDATA[I have just released a few minor updates to nme + hxcpp, which you can find on haxelib. These are relatively small \- just pushing out a few fixes for some bugs that have been reported. In most cases the &#8230; <a href="http://gamehaxe.com/2010/09/12/minor-updates/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have just released a few minor updates to nme + hxcpp, which you can find on haxelib.  These are relatively small \- just pushing out a few fixes for some bugs that have been reported.  In most cases the bug reports we accompanied by a fix \- you&#8217;ve gotta love open source.  The <a href="http://gamehaxe.com/wp-content/xcode/NMETemplate-2.0.1.tgz">iPhone/Xcode template has also been updated</a>, you may need to follow the instructions in the post below.</p>
<p>There is one significant change though &#8211; the &#8220;nekoapi.dll&#8221; file that is used for compatibility between hxcpp binaries (ie, NME) and neko has changed its extension to &#8220;ndll&#8221; so that neko can communicate directly with it.  This allows the String instances created externally to be &#8220;blessed&#8221; as haxe strings without having to call nekoToHaxe on them, and therefore methods such as substr will work.</p>
<p>The other change of note is that I removed the libfreetype code from the iPhone target, and used native font rendering instead.  Let me know if this breaks anything.  One side effect is that the default font will now be system dependent, with the iPhone getting its usual font.  I will also have to have a good look at the font render quality &#8211; freetype may have a little bit better sub-pixel sharpness.</p>
<p>There was a bug in the 2.06 haxe distribution when writing files.  I have fixed this by putting an override in hxcpp, which you can access with the command line options: &#8220;-lib hxcpp&#8221;.  I have also folded this change into haxe svn, so you will not need to do this in 2.07.</p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2010/09/12/minor-updates/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>New Releases!</title>
		<link>http://gamehaxe.com/2010/08/19/new-release/</link>
		<comments>http://gamehaxe.com/2010/08/19/new-release/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 15:27:28 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[hxcpp]]></category>
		<category><![CDATA[neash]]></category>
		<category><![CDATA[nme]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=326</guid>
		<description><![CDATA[Finally, I&#8217;ve managed to make a few more releases. Namely, HXCPP 2.06 and NME 2.0. HXCPP can be downloaded via &#8220;haxelib&#8221;, and works with the new 2.06 version of haxe. This release contains many bug fixes and optimizations. Also, when &#8230; <a href="http://gamehaxe.com/2010/08/19/new-release/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Finally, I&#8217;ve managed to make a few more releases.  Namely, HXCPP 2.06 and NME 2.0.<br />
HXCPP can be downloaded via &#8220;haxelib&#8221;, and works with the new 2.06 version of haxe.  This release contains many bug fixes and optimizations.  Also, when you compile with the -debug flag, you can get additional null checks and stack dumps.<br />
NME 2 is a complete rewrite from the ground up.  Most of the logic has been moved from neash to the c++ code for optimization reasons.<br />
For NME developers this only means a couple of things:</p>
<ul>
<li> You use &#8211;remap flash=nme instead of &#8211;remap flash=neash</li>
<li> The &#8220;boot&#8221; code has changed, so you will need to follow the main line from one of the samples. </li>
<li> Improved performance! </li>
</ul>
<p>I updated my Xcode SDK, which caused a bunch of link errors linking for the simulator with the NME library.  It seems Apple have changed the &#8220;ABI&#8221; for objc (basically, broke binary compatibility).  So I must choose pre 4.0, post 4.0 or both.  I think I am going to require NME iphone simulator users to have the latest SDK &#8211; unless there are any objections?</p>
<h2>iPhone Xcode Template</h2>
<p>I finally got around to making an Xcode template for haxe compiling. <a href="http://gamehaxe.com/wp-content/xcode/NMETemplate-2.0.0.tgz">Try it out</a> and let me know if it works.  It&#8217;s my first one, so I&#8217;m open to ideas for improving it.</p>
<p>To use the template, first extract it to your developer template area, eg: /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application.<br />
Then when you create an new Xcode project, this template should show up.  You should be able to build for the simulator.</p>
<p>To build for a real device, you will need to go though the official Apple developer program, and get yourself signed up.  Then you need to get your certificates in order, and finally edit the &#8220;plist&#8221; file in the Resources folder and change the company URL to match the one you used in your certificates.</p>
<p>You can edit Main.hx code in the &#8220;haxe/src&#8221; directory, but you will probably want to locate your haxe source tree outside your project area, since we are multi-platform developers an do not  want to tie ourselves to Xcode.  To do this, you can edit the class path in the Build.xml file, and change the boot code in IPhoneMain.hx.  It is done this way so the haxe-generated library always has the same name.  If all else fails, you can have a look in the makefile, which is set up to allow building debug and release versions for iphoneos and simulator without having to change other project settings.</p>
<p>Let me know if you have any luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2010/08/19/new-release/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>3 Years On</title>
		<link>http://gamehaxe.com/2010/02/07/3-years-on/</link>
		<comments>http://gamehaxe.com/2010/02/07/3-years-on/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 10:55:36 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[hxcpp]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[neash]]></category>
		<category><![CDATA[nme]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=279</guid>
		<description><![CDATA[Wow, has it really been 3 years? 2009 was an interesting year &#8211; I guess the big ticket items were haxe for the iPhone and getting hxcpp into the standard distribution for haxe. I am very satisfied with these achievements, &#8230; <a href="http://gamehaxe.com/2010/02/07/3-years-on/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Wow, has it really been 3 years?  2009 was an interesting year &#8211; I guess the big ticket items were haxe for the iPhone and getting hxcpp into the standard distribution for haxe.  I am very satisfied with these achievements, however there is still quite a bit of polish to add &#8211; especially in terms of ease-of-use.<br />
I also started some other projects &#8211; fastcgi for haxe, and &#8220;<a href="http://code.google.com/p/waxe/">waxe</a>&#8220;, the <a href="http://wxwidgets.org/">wx</a>/haxe interface, as well as continuing with neash and nme development.  One of the big changes for hxcpp, although not visible, was using an internal garbage collector which has improved performance and reduced the compile dependence on a library that is hard to debug on other peoples machines.</p>
<p>Currenly, I&#8217;m working on an NME rewrite to remove GPL code from the iPhone target, and to help integration.  Now that hxcpp has reached a certain level of quality, the diverse projects are starting to coalesce and I&#8217;m pushing ahead with a complete hxcpp/nme/iphone solution which should be very useful.</p>
<p>Looks like 2010 may be the year it all comes together (hopefully!).</p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2010/02/07/3-years-on/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Haxe, iPhone &amp; C++ At Last</title>
		<link>http://gamehaxe.com/2009/07/28/haxe-iphone-cpp-at-last/</link>
		<comments>http://gamehaxe.com/2009/07/28/haxe-iphone-cpp-at-last/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 16:33:28 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[hxcpp]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[neash]]></category>
		<category><![CDATA[nme]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[Haxe]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=206</guid>
		<description><![CDATA[Announcing first official release of c++ on haxe, including Widsows,  Mac, Linux and iPhone support. <a href="http://gamehaxe.com/2009/07/28/haxe-iphone-cpp-at-last/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h3>Hxcpp 1.0, neash 1.0, NME 1.0</h3>
<p>The release this week of haXe version 2.0.4 officially includes c++ as a build target, for Windows, Mac, Linux and iPhone.  You can download and install from <a href="http://haxe.org/">haxe.org</a>.  In addition to the standard includes, you will need the &#8220;hxcpp&#8221; library, which can be insatlled with the included haxelib management tool.</p>
<p>Coincident with the hxcpp release, I have updated the neash and NME libraries to versions 1.0.  You can also download these via the haxelib tool too.  There are several incrental improvements, and the iPhone target has been added!</p>
<h3>Getting started with the iPhone</h3>
<p>Getting started with the iPhone is quite tricky at the moment, mainly because of the pain of setting up an Xcode project.  Also,  getting the simplest program onto the device is hard due to the code signing requirements. So if you can already get one of the existing application templates to work, you are half way there.</p>
<p>Note that this solution uses the &#8220;SDL&#8221; library, and must statically link against this.  SDL is covered by the LGPL license, and this has implications should you choose to release your software.  I am hoping to remove the LGPL restiction at a later date.</p>
<p>The binaries used here are have been compiled for the &#8220;2.2.1&#8243; iPhone SDK.  So choose this version when compiling for simulator or device.</p>
<ol>
<li> Download and install components
<ul>
<li><b>Get haxe &#038; neko:</b> Visit <a href="http://haxe.org">haxe.org</a>
<li><b>Get hxcpp:</b>  haxelib install hxcpp
<li><b>Get nme:</b>  haxelib install nme
<li><b>Get neash:</b>  haxelib install neash
<li> <b>Get the sdl-static libs for iphone:</b> I have created a project with binary builds of these.  You can get the latest builds directly from  subversion svn code at:<br />
    <a href="http://code.google.com/p/sdl-static/source/checkout">http://code.google.com/p/sdl-static/source/checkout</a>.<br />
Or get the snapshot bundle from this site and install somewhere handy:<br />
    <a href="/wp-content/uploads/sdl-static-iphone-1.0.zip">sdl-static-iphone-1.0.zip</a>
</ul>
<li> Get Xcode with iphone sdk support &#8211; visit apple.com</li>
<li>Get a Developer key (you can try simulator without it).  You will need to pay to sign up as a developer on the apple site.
</li>
<li>
 Fire up Xcode and do File > New Project.</p>
<p>    Choose <strong>iPhone OS > Application</strong>.  Here choose a &#8220;<strong>Windows-Based Application</strong>&#8221;<br />
    but infact we will use the delegate setup in the SDL code, so we will have<br />
    to delete the one created by the wizard.</p>
<p>    Select a name &#038; directory for the project.  I&#8217;m calling it &#8220;Haxe Test&#8221;.</p>
<p>    Now as it stands, you should be able to build for the Simulator and<br />
    get a lovely white screen and a program called &#8220;Haxe Test&#8221; in the simulator<br />
    start screen.</p>
<p>    Next thing is to delete(to trash) the &#8220;&#8230;AppDelegate.h&#8221; &#8220;&#8230;AppDelegate.m&#8221;,<br />
     the &#8220;Nib Files&#8221; group, Resources/MainWindow.xib and &#8220;main.m&#8221;.<br />
   Finally, select the &#8220;Haxe Test&#8221; executable (in the Targets section) and from the &#8220;Get Info&#8221; &#8211;<br />
   &#8220;Properties&#8221; tab, clear the reference to &#8220;MainWindow&#8221;.</p>
<p>     We will add replacements for these soon.</p>
</li>
<li>
 Add &#8220;main.cpp&#8221; from the NME project.<br />
    Select the top-level project folder and then use <strong>Action > Add > Existing Files</strong>.<br />
    It is  probably in <em>/usr/lib/haxe/lib/nme/1,0/ndll/iPhone/</em> or<br />
     similar depending on which version of NME you have installed.  It can be<br />
     very painful to get xcode to load from this location, unless you hit<br />
     Command-Shift-G at the &#8220;Add&#8221; dialog and type (at least some) of this filename in.<br />
    Choose to &#8220;Copy to destinations folder&#8221; so<br />
    that you can mess with it if you wish.  Note:  you need to have a cpp mainline<br />
    in order to automatically link in the correct runtime libraries.</p>
</li>
<li>
 Add the libNME.iphoneos.a and  libNME.iphonesim.a files from the haxelib NME project.<br />
    You can add them both and the linker<br />
    will select the correct on depending on your build.  They are in the same place<br />
    as main.cpp, you you should be able to use &#8220;iPhone&#8221; from the pull-down box<br />
    in the add dialog.  Probably best not to copy these files &#8211; in case you want<br />
    to change them at some stage.
</li>
<li>
 Add the whole sdl-static/lib/iPhone directory. <br />Again probably best not to copy.<br />
     I used the &#8220;Recursively create groups&#8221; option.  These will be where you stored them<br />
     in step 1.</p>
</li>
<li>
Add the whole hxcpp/bin/iPhone directory like above.<br />  Again, this will<br />
     be in a path like <em>/usr/lib/haxe/lib/hxcpp/1,0,2/bin/iPhone/</em>.
</li>
<li>
 Add the hxcpp include directory to the include path. <br /> Use the &#8220;Info&#8221; button<br />
    to get the project properties, and on the build tab, under &#8220;Search Paths&#8221;<br />
    add something like <em>/usr/lib/haxe/lib/hxcpp/1,0,2/include/</em> to  &#8220;Header Search Path&#8221;
</li>
<li> Now we are ready for the haxe code.  If you have and existing project,<br />
then you can adapt the following instructions.</p>
<p>Create a new file from Xcode (Other/Empty File]  Here I have called it &#8220;HaxeTest.hx&#8221;, and unticked the &#8220;Targets&#8221; option.  I&#8217;m prety sure there is a way to get &#8220;Haxe File&#8221; to appear as on option here &#8211; but I don&#8217;t know the details.</p>
<p>In the haxe file, enter something like (Note the window size):</p>
<p><code></p>
<pre>
import flash.display.Sprite;
import flash.display.Shape;

class HaxeTest extends Sprite
{

   public function new()
   {
      super();
      flash.Lib.current.addChild(this);

      var circle:Shape = new Shape( );
      circle.graphics.beginFill( 0xff9933 , 1 );
      circle.graphics.drawCircle( 0 , 0 , 40 );
      circle.x = 150;
      circle.y = 200;
      addChild( circle );
   }

   static public function main()
   {
      neash.Lib.mOpenGL = true;
      neash.Lib.Init("HaxeTest",320,480);
      neash.Lib.SetBackgroundColour(0x447733); 

      new HaxeTest();

      neash.Lib.ShowFPS();
      neash.Lib.Run();
   }
}
</pre>
<p></code></p>
<p>This is the &#8220;main&#8221; file for haxe, and the hxcpp compile will create a library matching<br />
this class name.</p>
<li> Set up a build script to build changes you make to your haxe files into a library.<br />
   Xcode has a few issues with a straight custom build script order due to incorrect<br />
   dependency checking.  This can be worked around by first adding a custom target.</p>
<p>   Highlight the &#8220;Targets&#8221; in the Groups &#038; Files and use the &#8220;<strong>Action > Add > New Target..</strong>&#8221;<br />
   Choose &#8220;<strong>Other > Shell Script Target</strong>&#8221; and call it something like &#8220;Compile Haxe&#8221;.<br />
   Close the pop-up and go back to the explorer.  There should be a &#8220;Run Script&#8221;<br />
    entry under the &#8220;Compile Haxe&#8221; target if you expand it out.</p>
<p>   Get info on &#8220;Run Scipt&#8221; and enter the following script</p>
<p><code></p>
<pre>
   if [ "$CURRENT_ARCH" = "i386" ]
   then
      haxe -main HaxeTest -cpp cpp -lib neash -lib nme  --remap neko:cpp --remap flash:neash -D iphonesim
   else
      haxe -main HaxeTest -cpp cpp -lib neash -lib nme  --remap neko:cpp --remap flash:neash -D iphoneos
   fi
</pre>
<p></code><br />
   You can untick the &#8220;Show Environment&#8221; if you do not need to debug this.</p>
<p>   One last step &#8211; drag the &#8220;Compile Haxe&#8221; target into the &#8220;Haxe Test&#8221; target.<br />
   It should now also show up as first item &#8220;under&#8221; the &#8220;Haxe Test&#8221; target.<br />
   The build order should now be correct. (See image at end of post)</p>
<li> Now you are ready to do the build.  The first time you build, the build<br />
     results will show &#8220;Running custom shell script&#8230;&#8221; for quite a while.<br />
    Haxe compiles to cpp very quickly, but it take a while for the cpp files<br />
     to compile to a library.  You can see the progress if you expand out the<br />
     middle tab bit.</p>
<p>   At this stage, you should get a bunch or errors when linking, but also haxe<br />
   should have created a library for you.  Add this library to the project -<br />
   it should be in the local <em>cpp/HaxeTest.iphonesim.a</em>.</p>
<li> Compiling now gets a bunch of unresolved functions from frameworks.<br />
    Add the following frameworks to the project (Add > Existing Frameworks):
<ul>
<li>QuartzCore
<li>OpenGLES
<li>AudioToolbox
     </ul>
<p>These can be found in <em>/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/System/Library/Frameworks/</em>.</p>
<li><strong> Run!</strong><br />
    So you should be good to go.  Open up the debug console so you can see<br />
     any traces/printfs.</p>
<li> Change the target to &#8220;<strong>Device &#8211; IPhone OS</strong>&#8221; from the pull-down and hit &#8220;Build and Go&#8221;.<br />
   Again, this takes quite a while the first time.<br />
   Now add the new <em>cpp/HaxeTest.iphoneos.a</em> library to the project.</p>
<li>  Now you need to sort out your code signing. If you have not done so already,<br />
      setup you apple developer account &#038; certificates on the apple web site.<br />
      Go to the info of the &#8220;Haxe Test&#8221; executable and the &#8220;properties&#8221; tab.<br />
      Change the &#8220;Identifier&#8221; to match one of your cerificates.  Make sure to<br />
      match your company URL.  You may want to use &#8220;*&#8221; when creating your<br />
      profile for easy changing.  </p>
<p>     Under the &#8220;Build&#8221; tab, under the &#8220;Code Signing&#8221; bit<br />
      in the &#8220;Any iPhone Device&#8221; pull down your profile.  If you don&#8217;t have one then<br />
      you will need to create one on the apple website.</p>
<li>   Connect up your iPhone(iPod touch) and build! W00t!
</ol>
<p><a href="http://gamehaxe.com/wp-content/uploads/2009/07/HaxeTest.png"><img src="http://gamehaxe.com/wp-content/uploads/2009/07/HaxeTest-300x226.png" alt="HaxeTest" title="HaxeTest" width="300" height="226" class="alignleft size-medium wp-image-213" /></a></p>
<p>I have had all sorts of errors when trying to upload to the device.<br />
So far, they have been solved by getting out of the car, walking around it and getting back in.<br />
ie, Disconnect and power down ipod.  Fully exit Xcode and the start it all up and try again.  Also, uninstalling the app from the &#8220;Windows > Orgainiser&#8221; directory can help.<br />
<br />
But now the easy bit.  Change to HaxeTest.hx file, and hit Build &#038; Go.  It is that simple.<br />
Errors should show up nicely in xcode.<br />
<br />
You can add data files (eg, pngs, xml etc) to the project and they will be copied to device so you can open them with a relative path.<br />
<br />
In the properties of the &#8220;Info.plist&#8221; you can set a Icon File &#8211; don&#8217;t forget to add the icon to the project too.<br />
<br />
Not covered here (because I have not fully sorted it out myself):</p>
<ul>
<li> Syntax highlighting in XCode
<li> Debug build (hxcpp can do then &#8211; it&#8217;s a matter of setting up Xcode)
<li> Code completion in Xcode
<li> Automating this procedure!
</ul>
<p><em>Edit: Add framework path, SDL version, MainWindow clearing.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2009/07/28/haxe-iphone-cpp-at-last/feed/</wfw:commentRss>
		<slash:comments>146</slash:comments>
		</item>
		<item>
		<title>Haxe on the iPhone &#8211; For Real!</title>
		<link>http://gamehaxe.com/2009/05/27/haxe-on-real-iphone/</link>
		<comments>http://gamehaxe.com/2009/05/27/haxe-on-real-iphone/#comments</comments>
		<pubDate>Wed, 27 May 2009 16:29:29 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[hxcpp]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[nme]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[garbage collection]]></category>
		<category><![CDATA[Haxe]]></category>
		<category><![CDATA[physaxe]]></category>
		<category><![CDATA[sdl]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=200</guid>
		<description><![CDATA[To progress this project a bit further, I needed a real device &#8211; so I convinced the little woman that an iPod touch would be a good thing to have around. She seems to have taken to it, so now &#8230; <a href="http://gamehaxe.com/2009/05/27/haxe-on-real-iphone/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://gamehaxe.com/wp-content/uploads/2009/05/iphone3.jpg"><img src="http://gamehaxe.com/wp-content/uploads/2009/05/iphone3-300x170.jpg" alt="iphone3" title="iphone3" width="300" height="170" class="alignleft size-medium wp-image-199" /></a> To progress this project a bit further, I needed a real device &#8211; so I convinced the little woman that an iPod touch would be a good thing to have around.  She seems to have taken to it, so now I&#8217;m thinking I may need one each <img src='http://gamehaxe.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>After much phaffing about, I&#8217;ve finally managed to get stuff running on the actual device.  I had to comment out quite a bit of NME, since I only used the base SDL, not all the extras.  Boehm GC was also a bit tricky because I didn&#8217;t really know what I was doing, but I brought in some bits from the mono project and then disabled USE_MUNMAP because it caused it to crash.  In the end, it seems to work &#8211; no crash, but then I may not have been running it long enough.  I will have to try some memory thrashing later.</p>
<p>One thing I found with Xcode is that if you ever change the project name/AppID settings then you really need to clean the project, exit Xcode and get back in.  But the hardest part was working out where to go the get the developer certificate!  I guess I&#8217;m a bit thick, or missed the meno, but it took me ages to get to the web form to create a certificate.</p>
<p>So the big question is perfromance.  In this demo, initally, it runs at about 2.5 frames a second (I don&#8217;t have a fps counter yet), but slows a bit later when things spread out.  But this is using the high-quality, anti-aliasing software renderer.  Next job is to hook up the OpenGLES renderer, then I&#8217;ll really know where I stand.<br />
But overall, pretty positive result I think.</p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2009/05/27/haxe-on-real-iphone/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Haxe on iPhone (Simulator) &#8211; First Look</title>
		<link>http://gamehaxe.com/2009/05/22/haxe-on-iphone-simulator/</link>
		<comments>http://gamehaxe.com/2009/05/22/haxe-on-iphone-simulator/#comments</comments>
		<pubDate>Fri, 22 May 2009 08:30:28 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[hxcpp]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[neash]]></category>
		<category><![CDATA[nme]]></category>
		<category><![CDATA[sdl]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=178</guid>
		<description><![CDATA[The c++ backend for haxe generates standard c++, suitable for the gcc compiler. iPhone dev uses gcc, and can link against c++, which make you think that iPhone dev can use haxe. Simple? Well, actually it was pretty simple. The &#8230; <a href="http://gamehaxe.com/2009/05/22/haxe-on-iphone-simulator/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_180" class="wp-caption alignleft" style="width: 310px"><a href="http://gamehaxe.com/wp-content/uploads/2009/05/iphone1.png"><img src="http://gamehaxe.com/wp-content/uploads/2009/05/iphone1-300x235.png" alt="iPhone Dev" title="iphone1" width="300" height="235" class="size-medium wp-image-180" /></a><p class="wp-caption-text">iPhone Dev</p></div><br />
The c++ backend for haxe generates standard c++, suitable for the gcc compiler.  iPhone dev uses gcc, and can link against c++, which make you think that iPhone dev can use haxe.  Simple?  Well, actually it was pretty simple.  The hardest bit for me was to grok the components of an Xcode project, moving from dynamic libraries to static ones and getting SDL working.</p>
<p>The iPhone SDK requires you statically link everything, and I wanted to make it easy as possible to change haxe code -> generate cpp -> link to Xcode -> test of iPhone (or simulator).  The solution I am currently using is to generate a library from the haxe code using the standard command line make, and include this library in the Xcode project.  I hope to add a &#8220;pre build&#8221; step to drive the make system automatically.</p>
<p>Hxcpp executables typically use the <a href="http://gamehaxe.com/category/nme/">&#8220;NME&#8221;</a> library for graphics, which is in turn based on libSDL.  The good news is that the source version of libSDL compiles for the iPhone!  I tried the svn download first, but this does not seem as nicely bundled as the <a href="http://www.libsdl.org/svn.php">Apirl 13 version</a>, which worked very nicely indeed (besides a small problem with RenderRect args changing).</p>
<p>Getting the hxcpp backend to generate a library was almost trivial &#8211; you take the same obj files and put them in a lib instead of an exe.  The only minor difference is you do not explicitly create a &#8220;main&#8221; (ie, program entry point) call, but instead create a function (currently called \_\_hxcpp\_lib\_init) that the user supplied main line must call.  This may also be good for windows applicaions that want to use a &#8220;WinMain&#8221; instead of console based main function.</p>
<p>Compiling the hxcpp runtime as a static library was also pretty easy after the post 0.4 code reorganisation that assimilates thirdparty code rather than linking to it.  Again, it was a matter of taking the same objs and putting them in a lib instead of an dso.  Initally I got link error when linking with Xcode, but if you include 1 real, small c++ file in the project, these link error go away.</p>
<p>Compiling &#8220;plugin&#8221; modules as static libraries (eg, NME)  was slightly more difficult.  I could use c++ static initialisation to auto-register the exported functions, if I could get Xcode  to link to the required obj.  To force objs to be included, I needed to put a special symbol in each cpp file that exports functions, and make reference to these from the main code base.  It is really only something that needs to be sorted out once, and it is done now, so it should not really be a problem any more.</p>
<p>I also have to cull out quite a bit of code (eg fonts, image loading, opengl &#038; sound) from NME, but I can look at adding these bits in one by one.</p>
<p>The astute ones among you will notice that the colour of the above circle if RGB/BGR reversed.  This is something that will obviously need to be fixed.</p>
<p>Not being used to Xcode, it took a bit of getting used to &#8211; things like frameworks etc.  However, I think that ultimately, we could end up with a very nice solution.  The idea would be to create frameworks for hxcpp and nme, and a project template to link it all together.  You would then create a project from the template, modifiy the boiler-plate haxe code and hit build.  This would also be good for standard mac apps (rather then iPhone apps).  Still a way off this, but moving in that direction.</p>
<h4>SDL, LGPL and you</h4>
<p>Dynamically linking against SDL (or NME) normally discharges your obligations to the GPL, however in this case, we are statically linking to it so there are still some issues.  However, all is not lost because my interpretation is that you must allow others to <em>relink</em> your application.  (ie  &#8220;so that the user can modify the Library and then relink to produce a modified executable containing the modified Library&#8221;, where Library is &#8220;SDL&#8221;). So you must forefiet your hxcpp compiled <em>library</em> file (rather than haxe or cpp source), as well as you project files (which should be boiler-plate anyhow).  So this is actually borderline acceptable, although I will work towards a GPL free solution).</p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2009/05/22/haxe-on-iphone-simulator/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Hxcpp 0.4, NME 0.9, Neash 0.9 Released!</title>
		<link>http://gamehaxe.com/2009/04/07/hxcpp-nme-neash-released/</link>
		<comments>http://gamehaxe.com/2009/04/07/hxcpp-nme-neash-released/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 15:15:51 +0000</pubDate>
		<dc:creator>Huge</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[neash]]></category>
		<category><![CDATA[neko]]></category>
		<category><![CDATA[nme]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[Haxe]]></category>
		<category><![CDATA[hxcpp]]></category>

		<guid isPermaLink="false">http://gamehaxe.com/?p=119</guid>
		<description><![CDATA[What the flash? What is Hxcpp? Hxcpp is the c++ backend for haxe. This means you can compile haxe code to c++ code, and then compile this to a native executable, for Windows, Linux or Mac. What is NME? NME &#8230; <a href="http://gamehaxe.com/2009/04/07/hxcpp-nme-neash-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>What the flash?</h2>
<p><em>What is Hxcpp?</em>  Hxcpp is the c++ backend for haxe.  This means you can compile haxe code to c++ code, and then compile this to a native executable, for Windows, Linux or Mac.</p>
<p><em>What is NME?</em>  NME is the &#8220;Neko Media&#8221; library that wraps SDL, providing gaming interfaces for neko, and now native compiled haxe code.</p>
<p><em>What is Neash?</em>  Neash is a compatability layer that presents the flash API to haxe code running on other systems, such as js, neko or c++ native code.</p>
<p>Together these allows you to write code to target flash SWF files, and also cross compile to native code for Windows, Linux or Mac.</p>
<h2>Hxcpp on haxelib</h2>
<p>I have finally packaged up a bunch of changes into offical haxelib releases.  Hxcpp is now on haxelib, which means you can get it with &#8220;haxelib install hxcpp&#8221;.  This effectively creates a whole separate install of haxe, which can be run side-by-side so you can test it out without risk.</p>
<p>The cpp backend now supports Mac(intel) and Linux as well as the original Windows platform.</p>
<p>The main change to hxcpp is the packaging &#8211; moving towards a the final installation form.  Currently there are a whole bunch of files distibuted in this release that should become redundant once the c++ backend is merged into the main branch.  Also, the library coverage has been expanded a bit, but it is still not complete.</p>
<h2>Usage</h2>
<p>Firstly, you will need to run &#8220;haxecpp&#8221; instead of &#8220;haxe&#8221;.  This executable is found in the appropriate bin subdirectory.  I&#8217;m not sure if the &#8220;executable&#8221; flag will survive the compression, so you may need to &#8220;chmod a+x&#8221; the file.</p>
<p>It is probably best to place the appropriate bin directory in your executable path.  On windows, this will also solve the problem finding the dynamic link library, hxcpp.dll.  And on all systems, this will allow you to use the &#8220;make\_cpp&#8221; command from the hxml files.  On Linux systems, you will have to allow the executable to find the hxcpp.dso.  This is most easily done by setting LD\_LIBRARY\_PATH to the bin/Linux directory, or copying this file into an existing library path.  Similarly on Mac, you should set DYLD\_LIBRARY\_PATH.</p>
<p>To build haxe code, use &#8220;haxecpp&#8221; inplace of &#8220;haxe&#8221;, with a target specified by &#8220;-cpp directory&#8221;.<br />
This will place source code and a makefile in the given directory.  Then you need to do a &#8220;make&#8221; on linux/Mac, or &#8220;nmake&#8221; on Windows to build the executable.  You may need to set the environment variable &#8220;HXCPP&#8221; to point the the directory that contains this file.  On windows, this will be something like: c:\Progra~1\Motion-Twin\haxe\lib\hxcpp\0,4\</p>
<p>As a shortcut, if you are using a hxml file, you can use &#8220;-cmd make_cpp&#8221; which will do the build for you assuming you used the &#8220;-cpp cpp&#8221; directory.</p>
<h2>Neash/NME</h2>
<p>The big changes for NME is that it now supports Linux and Mac(intel) for neko ac c++ targets.  There have been a few bug fixes as well as a few new features:</p>
<ul>
<li>Bitmap class</li>
<li>Expanded and optimised TileRenderer for render scaled and rotated sub-rects from a surface</li>
<li>A few smarts for finding fonts, if no ttf is supplied</li>
<li>Some blend modes have been added</li>
<li>Added scale9Rect</li>
<li>Added drawTriangles, with perspective correct textures</li>
</ul>
<h2>ToDo</h2>
<p>There is still plenty to do, including, but not limited to:</p>
<p>Hxcpp:
<ul>
<li>Proper coverage of all APIs.</li>
<li>Resolve the order-of-operation problem: In c++ f(x++,x++)  is ambiguous as to what order the increments are performed.  Or perhaps agree to live with it.</li>
</ul>
<p>NME:
<ul>
<li>Add all blend modes</li>
<li>Add all filters</li>
<li>Discuss with experts the merits of static vs dynamic linking Mac and Linux.</li>
</ul>
<p>Neash:
<ul>
<li>Sound is a big ommision</li>
<li>Loader code</li>
<li>Unit testing of supported APIs.</li>
</ul>
<p>Despite these issues, I think there is a useful core of functionality here.</p>
<p>Let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://gamehaxe.com/2009/04/07/hxcpp-nme-neash-released/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
	</channel>
</rss>

