<?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>LoonacyLoonacy</title>
	<atom:link href="http://www.peepor.net/loonchew/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.peepor.net/loonchew/blog</link>
	<description>Loony&#039;s game development and other tales</description>
	<lastBuildDate>Tue, 10 Apr 2012 22:05:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Adding Google Maps into Mobile Atlas Creator</title>
		<link>http://www.peepor.net/loonchew/blog/?p=118</link>
		<comments>http://www.peepor.net/loonchew/blog/?p=118#comments</comments>
		<pubDate>Thu, 23 Jun 2011 18:39:57 +0000</pubDate>
		<dc:creator>loonychewy</dc:creator>
				<category><![CDATA[Tips, Tricks, Hacks]]></category>

		<guid isPermaLink="false">http://www.peepor.net/loonchew/blog/?p=118</guid>
		<description><![CDATA[Mobile Atlas Creator is an awesome tool for generating offline maps for mapping applications, such as the equally awesome RMaps for Android. Unfortunately, due to restrictions from many map providers, Mobile Atlas Creator no longer provides access to many map sources. However, it is able to read user-customised map sources. So with the help of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mobac.sourceforge.net/">Mobile Atlas Creator</a> is an awesome tool for generating offline maps for mapping applications, such as the equally awesome <a href="https://market.android.com/details?id=com.robert.maps&amp;hl=en">RMaps</a> for Android. Unfortunately, due to restrictions from many map providers, Mobile Atlas Creator no longer provides access to many map sources.</p>
<p>However, it is able to read user-customised map sources. So with the help of <a href="https://addons.mozilla.org/en-us/firefox/addon/httpfox/">httpfox</a>, I have managed to get google maps hooked up again. Just unzip the following files into the &#8220;mapsources&#8221; subdirectory of your Mobile Atlas Creator installation location, and then restart it.</p>
<p>Enjoy!</p>
<p>Google Maps (<a href="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/google_maps.zip">google_map)</a></p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="xml"><pre class="de1"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span><span class="re2">?&gt;</span></span>
<span class="sc3"><span class="re1">&lt;customMapSource<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;name<span class="re2">&gt;</span></span></span>Google Maps<span class="sc3"><span class="re1">&lt;/name<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;minZoom<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/minZoom<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;maxZoom<span class="re2">&gt;</span></span></span>19<span class="sc3"><span class="re1">&lt;/maxZoom<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;tileType<span class="re2">&gt;</span></span></span>png<span class="sc3"><span class="re1">&lt;/tileType<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;tileUpdate<span class="re2">&gt;</span></span></span>None<span class="sc3"><span class="re1">&lt;/tileUpdate<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;url<span class="re2">&gt;</span></span></span>http://mt0.google.com/vt/lyrs=m@156000000<span class="sc1">&amp;amp;</span>hl={$lang}<span class="sc1">&amp;amp;</span>x={$x}<span class="sc1">&amp;amp;</span>y={$y}<span class="sc1">&amp;amp;</span>z={$z}<span class="sc3"><span class="re1">&lt;/url<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;backgroundColor<span class="re2">&gt;</span></span></span>#000000<span class="sc3"><span class="re1">&lt;/backgroundColor<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/customMapSource<span class="re2">&gt;</span></span></span></pre></div></div></div></div></div></div></div>


<p>Google Satellite (<a href="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/google_satellite.zip">google_satellite</a>)</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="xml"><pre class="de1"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span><span class="re2">?&gt;</span></span>
<span class="sc3"><span class="re1">&lt;customMapSource<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;name<span class="re2">&gt;</span></span></span>Google Satellite
<span class="sc3"><span class="re1">&lt;/name<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;minZoom<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/minZoom<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;maxZoom<span class="re2">&gt;</span></span></span>19<span class="sc3"><span class="re1">&lt;/maxZoom<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;tileType<span class="re2">&gt;</span></span></span>PNG<span class="sc3"><span class="re1">&lt;/tileType<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;tileUpdate<span class="re2">&gt;</span></span></span>None<span class="sc3"><span class="re1">&lt;/tileUpdate<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;url<span class="re2">&gt;</span></span></span>http://khm0.google.com/kh/v=88<span class="sc1">&amp;amp;</span>x={$x}<span class="sc1">&amp;amp;</span>y={$y}<span class="sc1">&amp;amp;</span>z={$z}<span class="sc3"><span class="re1">&lt;/url<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;backgroundColor<span class="re2">&gt;</span></span></span>#000000<span class="sc3"><span class="re1">&lt;/backgroundColor<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/customMapSource<span class="re2">&gt;</span></span></span></pre></div></div></div></div></div></div></div>


<p>Google Satellite + Overlay Hybrid (<a href="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/google_satellite_hybrid.zip">google_satellite_hybrid</a>)</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="xml"><pre class="de1"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span> <span class="re0">standalone</span>=<span class="st0">&quot;yes&quot;</span><span class="re2">?&gt;</span></span>
<span class="sc3"><span class="re1">&lt;customMultiLayerMapSource<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;name<span class="re2">&gt;</span></span></span>Google Satellite Hybrid<span class="sc3"><span class="re1">&lt;/name<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;tileType<span class="re2">&gt;</span></span></span>PNG<span class="sc3"><span class="re1">&lt;/tileType<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;layers<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;customMapSource<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;name<span class="re2">&gt;</span></span></span>Google Earth<span class="sc3"><span class="re1">&lt;/name<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;minZoom<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/minZoom<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;maxZoom<span class="re2">&gt;</span></span></span>19<span class="sc3"><span class="re1">&lt;/maxZoom<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;tileType<span class="re2">&gt;</span></span></span>PNG<span class="sc3"><span class="re1">&lt;/tileType<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;tileUpdate<span class="re2">&gt;</span></span></span>None<span class="sc3"><span class="re1">&lt;/tileUpdate<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;url<span class="re2">&gt;</span></span></span>http://khm0.google.com/kh/v=88<span class="sc1">&amp;amp;</span>x={$x}<span class="sc1">&amp;amp;</span>y={$y}<span class="sc1">&amp;amp;</span>z={$z}<span class="sc3"><span class="re1">&lt;/url<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;backgroundColor<span class="re2">&gt;</span></span></span>#000000<span class="sc3"><span class="re1">&lt;/backgroundColor<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;/customMapSource<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;customMapSource<span class="re2">&gt;</span></span></span>
			<span class="sc3"><span class="re1">&lt;name<span class="re2">&gt;</span></span></span>Google Earth Maps Overlay<span class="sc3"><span class="re1">&lt;/name<span class="re2">&gt;</span></span></span>
			<span class="sc3"><span class="re1">&lt;minZoom<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/minZoom<span class="re2">&gt;</span></span></span>
			<span class="sc3"><span class="re1">&lt;maxZoom<span class="re2">&gt;</span></span></span>19<span class="sc3"><span class="re1">&lt;/maxZoom<span class="re2">&gt;</span></span></span>
			<span class="sc3"><span class="re1">&lt;tileType<span class="re2">&gt;</span></span></span>png<span class="sc3"><span class="re1">&lt;/tileType<span class="re2">&gt;</span></span></span>
			<span class="sc3"><span class="re1">&lt;tileUpdate<span class="re2">&gt;</span></span></span>None<span class="sc3"><span class="re1">&lt;/tileUpdate<span class="re2">&gt;</span></span></span>
			<span class="sc3"><span class="re1">&lt;url<span class="re2">&gt;</span></span></span>http://mt0.google.com/vt/lyrs=h@145<span class="sc1">&amp;amp;</span>hl={$lang}<span class="sc1">&amp;amp;</span>x={$x}<span class="sc1">&amp;amp;</span>y={$y}<span class="sc1">&amp;amp;</span>z={$z}<span class="sc3"><span class="re1">&lt;/url<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;/customMapSource<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;/layers<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/customMultiLayerMapSource<span class="re2">&gt;</span></span></span></pre></div></div></div></div></div></div></div>


<p>Google Terrain (<a href="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/google_terrain.zip">google_terrain</a>)</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="xml"><pre class="de1"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span><span class="re2">?&gt;</span></span>
<span class="sc3"><span class="re1">&lt;customMapSource<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;name<span class="re2">&gt;</span></span></span>Google Terrain<span class="sc3"><span class="re1">&lt;/name<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;minZoom<span class="re2">&gt;</span></span></span>0<span class="sc3"><span class="re1">&lt;/minZoom<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;maxZoom<span class="re2">&gt;</span></span></span>19<span class="sc3"><span class="re1">&lt;/maxZoom<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;tileType<span class="re2">&gt;</span></span></span>png<span class="sc3"><span class="re1">&lt;/tileType<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;tileUpdate<span class="re2">&gt;</span></span></span>None<span class="sc3"><span class="re1">&lt;/tileUpdate<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;url<span class="re2">&gt;</span></span></span>http://mt0.google.com/vt/lyrs=t,r<span class="sc1">&amp;amp;</span>hl={$lang}<span class="sc1">&amp;amp;</span>x={$x}<span class="sc1">&amp;amp;</span>y={$y}<span class="sc1">&amp;amp;</span>z={$z}<span class="sc3"><span class="re1">&lt;/url<span class="re2">&gt;</span></span></span>
	<span class="sc3"><span class="re1">&lt;backgroundColor<span class="re2">&gt;</span></span></span>#000000<span class="sc3"><span class="re1">&lt;/backgroundColor<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/customMapSource<span class="re2">&gt;</span></span></span></pre></div></div></div></div></div></div></div>


<p>If you look at the url in the files, you can see that all the map tiles are downloaded from 1 google server mt0, when in google maps, tiles are downloaded from mt1 as well for load distribution. I don&#8217;t know if Mobile Atlas Creator supports this or not.</p>
<p>If I ever get to figure out how Bing or Yahoo map tiles are named, then I&#8217;ll probably post about them. But it is likely I won&#8217;t get to that <img src='http://www.peepor.net/loonchew/blog/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
<p>Edit (10 Apr 2012):<br />
This forum topic, post #6 suggests to copy the map source files over from an older version:</p>
<p>http://www.noeman.org/gsm/creating-maps/201179-mobile-atlas-creator.html</p>
<p>Yahoo &#038; Google maps seems to work for me as well, while Microsoft/Bing maps didn&#8217;t. Didn&#8217;t test with other map sources.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peepor.net/loonchew/blog/?feed=rss2&#038;p=118</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Directly deleting files in OS X</title>
		<link>http://www.peepor.net/loonchew/blog/?p=97</link>
		<comments>http://www.peepor.net/loonchew/blog/?p=97#comments</comments>
		<pubDate>Sat, 11 Jun 2011 12:46:31 +0000</pubDate>
		<dc:creator>loonychewy</dc:creator>
				<category><![CDATA[Tips, Tricks, Hacks]]></category>
		<category><![CDATA[Mac OSX]]></category>

		<guid isPermaLink="false">http://www.peepor.net/loonchew/blog/?p=97</guid>
		<description><![CDATA[In OS X, I&#8217;m so not used to having to send files to Trash first before emptying it, just to get rid of files I no longer want. In the end, I created an Automator service that does the job for me. (File download at the bottom of this post) How To Use 1. Select [...]]]></description>
			<content:encoded><![CDATA[<p>In OS X, I&#8217;m so not used to having to send files to Trash first before emptying it, just to get rid of files I no longer want. In the end, I created an Automator service that does the job for me.</p>
<p><em>(File download at the bottom of this post)</em></p>
<h4>How To Use</h4>
<p>1. Select the files to delete, and right-click: <a href="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/macDeleteFilesOption.png"><img class="size-medium wp-image-101 alignright" title="macDeleteFilesOption" src="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/macDeleteFilesOption-210x300.png" alt="" width="210" height="300" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>2. Confirmation Prompt:<a href="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/macDeleteFilesConfirmation.png"><img class="size-medium wp-image-100 alignright" title="macDeleteFilesConfirmation" src="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/macDeleteFilesConfirmation-300x122.png" alt="" width="300" height="122" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Simple as that.</p>
<h4>How It Is Done</h4>
<p>Here is how it is done in Automator:<a href="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/macDeleteFileAutomator.png"><img class="size-medium wp-image-99 alignright" title="macDeleteFileAutomator" src="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/macDeleteFileAutomator-300x286.png" alt="" width="300" height="286" /></a></p>
<p>The guid in the text box of the &#8220;Ask for Confirmation&#8221; step is a hack to insert the file names into the prompt dialog (step 2 above). It is the guid of the variable &#8220;Files&#8221; in &#8220;Set Value of Variable&#8221;, obtained by opening the document.wflow file of this Automator service in a text editor and searching for it there. It is unfortunate that Automator doesn&#8217;t support variables in the text of the confirmation dialog.</p>
<p>So if the user clicks &#8220;Yes&#8221; to the dialog, the shell script will do our favourite rm -r on each file. Why &#8220;-r&#8221;? Because the file could be a folder too, which we delete <strong>-r</strong>ecursively.</p>
<h4>Download and Install</h4>
<p>The Automator Service bundle can be downloaded here: <a href="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/06/delete_Files_Mac.zip">delete_Files_Mac.zip</a> It is just a bunch of xml in a Mac bundle which you can freely examine in Automator or any text editor.</p>
<p>I don&#8217;t know if any install step is needed.</p>
<ul>
<li>Unzip it and copy the app bundle to <span style="color: #0000ff;">/Users/YourUserHome/Library/Services</span>.</li>
<li>Try right-clicking on any unwanted files in Finder, and see if the &#8220;Delete File(s)&#8221; option appears at the bottom of the context menu.</li>
<li>If not, maybe try to open and save it via Automator and try again.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.peepor.net/loonchew/blog/?feed=rss2&#038;p=97</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2 API differences between iOS and Android</title>
		<link>http://www.peepor.net/loonchew/blog/?p=89</link>
		<comments>http://www.peepor.net/loonchew/blog/?p=89#comments</comments>
		<pubDate>Wed, 06 Apr 2011 11:11:48 +0000</pubDate>
		<dc:creator>loonychewy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[iOS]]></category>

		<guid isPermaLink="false">http://www.peepor.net/loonchew/blog/?p=89</guid>
		<description><![CDATA[These are just 2 differences that I&#8217;ve encountered recently, and I&#8217;m sure there&#8217;ll be more to come. Points to note when doing cross-platform coding. Signed-ness of char type char type is signed in iOS, but unsigned in Android NDK. For the latter, I&#8217;ve just discovered this post, which suggests that its an ARM code generation [...]]]></description>
			<content:encoded><![CDATA[<p>These are just 2 differences that I&#8217;ve encountered recently, and I&#8217;m sure there&#8217;ll be more to come. Points to note when doing cross-platform coding.</p>
<p><strong>Signed-ness of char type</strong></p>
<p><em>char</em> type is signed in iOS, but unsigned in Android NDK. For the latter, I&#8217;ve just discovered <a href="http://groups.google.com/group/android-ndk/browse_thread/thread/d270fa70c522130b">this post</a>, which suggests that its an ARM code generation behaviour for gcc that can be handled by passing <em>LOCAL_CFLAGS := -fsigned-char</em>. I will give this a try.</p>
<p><strong>Accelerometer reading values</strong></p>
<p>iOS returns accelerometer readings in <a href="http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIAcceleration_Class/Reference/UIAcceleration.html#//apple_ref/doc/c_ref/UIAcceleration">units of g</a>, while Android returns in <a href="http://developer.android.com/reference/android/hardware/SensorEvent.html#values">ms^-2</a>. So for a device lying screen up on the table, iOS reports z = -1, while Android reports z = -9.81</p>
<p>Android also has a constant defined for the <a href="http://developer.android.com/reference/android/hardware/SensorManager.html#GRAVITY_DEATH_STAR_I">gravitational constant of Death Star</a>.</p>
<p><strong> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.peepor.net/loonchew/blog/?feed=rss2&#038;p=89</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging release mode code with __asm int 3</title>
		<link>http://www.peepor.net/loonchew/blog/?p=54</link>
		<comments>http://www.peepor.net/loonchew/blog/?p=54#comments</comments>
		<pubDate>Sun, 27 Mar 2011 15:54:52 +0000</pubDate>
		<dc:creator>loonychewy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">http://www.peepor.net/loonchew/blog/?p=54</guid>
		<description><![CDATA[Sometimes we have to run release mode code, either because it is what we&#8217;re testing, or it just takes too long to run the program in debug mode (I had one level which took &#62; 15 mins to load up in debug mode, and that&#8217;s without the debugger attached!). While solving bugs in this case, [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes we have to run release mode code, either because it is what we&#8217;re testing, or it just takes too long to run the program in debug mode (I had one level which took &gt; 15 mins to load up in debug mode, and that&#8217;s without the debugger attached!). While solving bugs in this case, I would sometimes like to break the process when some invalid situation occurs. I do this way:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="cpp"><pre class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span> _isnan<span class="br0">&#40;</span> someNumber <span class="br0">&#41;</span>
<span class="br0">&#123;</span>
    __asm <span class="kw4">int</span> <span class="nu0">3</span>    <span class="co1">// semi-colon not necessary</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>


<p><em>int 3</em> is a software interrupt that, in this example, gets triggered when <em>someNumber</em> is invalid, which means most likely the latter is an uninitialised variable. This is quite useful when logging to output is not an option.</p>
<p>Notes:</p>
<ul>
<li>This is definitely not cross-platform</li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms679297%28v=vs.85%29.aspx">DebugBreak()</a> and <a href="http://msdn.microsoft.com/en-us/library/f408b4et.aspx">__debugbreak()</a> should do the same thing, but its more l337 to use asm when debugging <img src='http://www.peepor.net/loonchew/blog/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.peepor.net/loonchew/blog/?feed=rss2&#038;p=54</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript TransitionManager Class</title>
		<link>http://www.peepor.net/loonchew/blog/?p=32</link>
		<comments>http://www.peepor.net/loonchew/blog/?p=32#comments</comments>
		<pubDate>Wed, 23 Mar 2011 11:38:20 +0000</pubDate>
		<dc:creator>loonychewy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://www.peepor.net/loonchew/blog/?p=32</guid>
		<description><![CDATA[Actionscript 3 has a rather useful TransitionManager class to provide transition effects to movie clips. It provides a convenient function static TransitionManager.start() that we can use for adding effects (e.g. blinds, fly, zoom, etc). Whats missing from the documentation though is that the class that the effect is being applied on must be declared a [...]]]></description>
			<content:encoded><![CDATA[<p>Actionscript 3 has a rather useful <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/transitions/TransitionManager.html"><span style="font-family: courier;">TransitionManager</span></a> class to provide transition effects to movie clips. It provides a convenient function <span style="font-family: courier;">static TransitionManager.start()</span> that we can use for adding effects (e.g. blinds, fly, zoom, etc). Whats missing from the documentation though is that the class that the effect is being applied on must be declared a <span style="color: #0000ff;"><strong>dynamic </strong></span>class. This is something to note if you&#8217;re using it on a custom <span style="font-family: courier;">MovieClip</span> sub-class. The <span style="font-family: courier;">MovieClip</span> class itself is dynamic, so its not a problem. Doesn&#8217;t apply as well if you are using the instanced method <span style="font-family: courier;">startTransition(. . .)</span>.</p>
<p>Another useful thing to note is that the <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/transitions/Transition.html"><span style="font-family: courier;">Transition</span></a> class provides events for when the transition is completed, those being <span style="color: #0000ff;"><strong>&#8220;transitionInDone&#8221;</strong></span> and <strong><span style="color: #0000ff;">&#8220;transitionOutDone&#8221;</span></strong>, depending on the transition direction. This is shown in the documentation example. It is unusual though that, unlike other events, they do not provide a static constant for these events, and we have to quote them as literal strings.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peepor.net/loonchew/blog/?feed=rss2&#038;p=32</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My renderer is cross-platform!</title>
		<link>http://www.peepor.net/loonchew/blog/?p=23</link>
		<comments>http://www.peepor.net/loonchew/blog/?p=23#comments</comments>
		<pubDate>Sun, 27 Feb 2011 14:00:25 +0000</pubDate>
		<dc:creator>loonychewy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[OpenGL ES]]></category>

		<guid isPermaLink="false">http://www.peepor.net/loonchew/blog/?p=23</guid>
		<description><![CDATA[I&#8217;ve finally gotten my OpenGL ES code to cross compile and run on both iOS and Android. Have learned lots of things in the process. It&#8217;s still an extremely primitive &#8220;spinning cube&#8221; code, so there&#8217;s still heaps more work to be done, but at least most of it should be platform-neutral. iOS (left), Android (right) [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally gotten my OpenGL ES code to cross compile and run on both iOS and Android. Have learned lots of things in the process. It&#8217;s still an extremely primitive &#8220;spinning cube&#8221; code, so there&#8217;s still heaps more work to be done, but at least most of it should be platform-neutral.</p>
<p><a href="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/02/Loonacy_iOS.png"><img class="alignnone size-thumbnail wp-image-25" title="Loonacy_iOS" src="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/02/Loonacy_iOS-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/02/Loonacy_Android.png"><img class="alignnone size-thumbnail wp-image-24" title="Loonacy_Android" src="http://www.peepor.net/loonchew/blog/wp-content/uploads/2011/02/Loonacy_Android-150x150.png" alt="" width="150" height="150" /></a></p>
<p>iOS (left), Android (right)</p>
<p>Its quite obvious from the screenshots that the lighting is different on both of them. Still have to figure that out too.</p>
<p>Back to work!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peepor.net/loonchew/blog/?feed=rss2&#038;p=23</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JDK included in Mac OSX</title>
		<link>http://www.peepor.net/loonchew/blog/?p=19</link>
		<comments>http://www.peepor.net/loonchew/blog/?p=19#comments</comments>
		<pubDate>Fri, 25 Feb 2011 08:47:10 +0000</pubDate>
		<dc:creator>loonychewy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Mac OSX]]></category>

		<guid isPermaLink="false">http://www.peepor.net/loonchew/blog/?p=19</guid>
		<description><![CDATA[Wanted to download JDK for Mac to run Eclipse, but couldn&#8217;t find it on Java&#8217;s download page. When searching around and finally went to the Apple developer site to find this info. It works right out of the box. Sweet!]]></description>
			<content:encoded><![CDATA[<p>Wanted to download JDK for Mac to run Eclipse, but couldn&#8217;t find it on Java&#8217;s download page. When searching around and finally went to the Apple developer site to find this info. It works right out of the box. Sweet!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peepor.net/loonchew/blog/?feed=rss2&#038;p=19</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Conditional compile #define for iOS and Android platform</title>
		<link>http://www.peepor.net/loonchew/blog/?p=12</link>
		<comments>http://www.peepor.net/loonchew/blog/?p=12#comments</comments>
		<pubDate>Fri, 25 Feb 2011 08:41:53 +0000</pubDate>
		<dc:creator>loonychewy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[OpenGL ES]]></category>

		<guid isPermaLink="false">http://www.peepor.net/loonchew/blog/?p=12</guid>
		<description><![CDATA[I&#8217;m working on a cross platform library for iOS and Android devices. The header files for OpenGL ES are in different folders for these platforms (see end of post), so I need to #include them differently per platform. Took me a while to find the proper one to #define for the iOS platform, so here [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a cross platform library for iOS and Android devices. The header files for OpenGL ES are in different folders for these platforms (see end of post), so I need to #include them differently per platform. Took me a while to find the proper one to #define for the iOS platform, so here it is:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="cpp"><pre class="de1"><span class="co2">#ifdef __APPLE__</span>
    <span class="co2">#include &quot;TargetConditionals.h&quot;</span>
<span class="co2">#endif</span>
&nbsp;
<span class="co2">#if (defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR))</span>
    <span class="co2">#define PLATFORM_IOS</span>
<span class="co2">#elif (defined(ANDROID))</span>
    <span class="co2">#define PLATFORM_ANDROID</span>
<span class="co2">#endif</span></pre></div></div></div></div></div></div></div>


<p>TargetConditionals.h is where the Target_OS_IPHONE and TARGET_IPHONE_SIMULATOR are defined, and it is only available on a Mac, hence it is wrapped in __APPLE__. The second part, PLATFORM_IOS is the preprocessor macro I&#8217;ll use throughout my code.</p>
<p>The #elif clause takes care of Android platform.</p>
<p>The OpenGL ES headers are located here:</p>
<ul>
<li>iOS
<ul>
<li>#include &lt;OpenGLES/ES1/gl.h&gt;</li>
<li>#include &lt;OpenGLES/ES1/glext.h&gt;</li>
<li>(Swap ES1 for ES2 if you&#8217;re using that)</li>
</ul>
</li>
<li>Android
<ul>
<li>#include &lt;GLES/gl.h&gt;</li>
</ul>
<ul>
<li>#include &lt;GLES/glext.h&gt;</li>
</ul>
<ul>
<li>#include &lt;GLES/glplatform.h&gt;</li>
<li>#include &lt;GLES2/gl2.h&gt;</li>
<li>#include &lt;GLES2/gl2ext.h&gt;</li>
<li>#include &lt;GLES2/gl2ext.h&gt;</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.peepor.net/loonchew/blog/?feed=rss2&#038;p=12</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My first post</title>
		<link>http://www.peepor.net/loonchew/blog/?p=1</link>
		<comments>http://www.peepor.net/loonchew/blog/?p=1#comments</comments>
		<pubDate>Fri, 25 Feb 2011 08:03:44 +0000</pubDate>
		<dc:creator>loonychewy</dc:creator>
				<category><![CDATA[Rants]]></category>

		<guid isPermaLink="false">http://peepor.net/loonchew/blog/?p=1</guid>
		<description><![CDATA[Been hesitating about what to write for my first post. Should it be an introduction? There&#8217;s already an &#8220;about&#8221; page for that. Something to warm up the theme of this blog? Hmm&#8230; The lack of creative writing faculty in me is preventing the opening of the floodgates for more posts to come. Ok, so here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Been hesitating about what to write for my first post. Should it be an introduction? There&#8217;s already an &#8220;about&#8221; page for that. Something to warm up the theme of this blog? Hmm&#8230;</p>
<p>The lack of creative writing faculty in me is preventing the opening of the floodgates for more posts to come. Ok, so here&#8217;s the solution:</p>
<p style="text-align: center;">*Reserved for future updates*</p>
<p>Voilà! Now I can properly start blogging! <img src='http://www.peepor.net/loonchew/blog/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.peepor.net/loonchew/blog/?feed=rss2&#038;p=1</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

