<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>iPhone Android Flash Games Cocos2d Cocos2d-x PHP Yii MySQL Mootools jQuery Game design</description><title>@jpsarda's longer tweets</title><generator>Tumblr (3.0; @jpsarda)</generator><link>http://jpsarda.tumblr.com/</link><item><title>Optimized Fonts Workflow with Unity/Futile, bmGlyph [MacOSX only] and TexturePacker</title><description>&lt;p&gt;I&amp;#8217;m currently making a game with Unity / &lt;a href="https://github.com/MattRix/Futile"&gt;Futile&lt;/a&gt;, for the &lt;a href="https://twitter.com/search?q=%231GAM&amp;amp;src=hash"&gt;#1GAM&lt;/a&gt; of february.&lt;/p&gt;

&lt;p&gt;And now I&amp;#8217;ve arrived to the point where I need to use FLabel and fonts. Fonts scare me a bit, especially since we have to deal with different screen densities, but this time I&amp;#8217;ve found a good worflow to create bitmap fonts for Futile, and I&amp;#8217;ll share it here. To understand this article you must have already started to experiment with Futile and at least you must have watch the &lt;a href="http://www.youtube.com/watch?v=fI5IJKdvj68"&gt;quick-start 10mn video&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;The game manage 3 sets of resources with 3 suffixes&amp;#160;: &amp;#8220;_Scale4&amp;#8221;, &amp;#8220;_Scale2&amp;#8221;, and &amp;#8220;_Scale1&amp;#8221;.&lt;br/&gt;&lt;img src="http://media.tumblr.com/677ee9e38b534de5a61b2d8c3a70f184/tumblr_inline_mhjmptMG5q1qz4rgp.png"/&gt;&lt;/p&gt;

&lt;p&gt;We need to create 3 sets of resources for our bitmap fonts too (I picked Helvetica). We&amp;#8217;re going to create the highest resolution texture &amp;#8220;helvetica48.png&amp;#8221;, that we&amp;#8217;ll add in an atlas with TexturePacker, and then we need 3 fonts definition files &amp;#8220;helvetica48_Scale4.txt&amp;#8221;, &amp;#8220;helvetica48_Scale2.txt&amp;#8221; and &amp;#8220;helvetica48_Scale1.txt&amp;#8221;.&lt;/p&gt;

&lt;p&gt;Here are the steps&amp;#160;:&lt;/p&gt;

&lt;p&gt;Open &lt;a href="http://www.bmglyph.com/"&gt;bmGlyph&lt;/a&gt; (available on the mac appstore for 8.99€ at the time I&amp;#8217;m writing this) and create your fonts.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.tumblr.com/393bfac0af84b4b03d91d810f520342c/tumblr_inline_mhjlqypqYj1qz4rgp.png" alt="image"/&gt;&lt;/p&gt;

&lt;p&gt;Then, once you&amp;#8217;re ready, click on the &amp;#8220;Publish&amp;#8221; button &lt;img src="http://media.tumblr.com/8a36c0d29158bbe334feb33a6c2ef186/tumblr_inline_mhjlz93D1s1qz4rgp.png" alt="image"/&gt;. And here are 4 screenshots showing how to configure your 4 publishing targets. One target called &amp;#8220;Main .png&amp;#8221; is for publishing the main texture (highest density) in a raw resources folder (not in the Unity resource folder). The 3 other targets are for publishing the 3 fonts definition files directly in the Unity resources folder.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.tumblr.com/67bb85b11644df6d2c1fd0f2412a7782/tumblr_inline_mhjlxknRhM1qz4rgp.png" alt="image"/&gt;&lt;img src="http://media.tumblr.com/0c582b5136f246c9e9f7409fd848c122/tumblr_inline_mhjlxbjpCy1qz4rgp.png" alt="image"/&gt;&lt;img src="http://media.tumblr.com/e7073126dce36807696e66ed8deda724/tumblr_inline_mhjlxpqCWv1qz4rgp.png" alt="image"/&gt;&lt;img src="http://media.tumblr.com/54b5fcae596bdcdbe7bb0175a11388b0/tumblr_inline_mhjlxvB8BP1qz4rgp.png" alt="image"/&gt;&lt;/p&gt;

&lt;p&gt;Now you need to open &lt;a href="http://www.codeandweb.com/texturepacker"&gt;TexturePacker&lt;/a&gt; (22.79€ with a free trial at the time I&amp;#8217;m writing this, and free for bloggers), and add the main .png texture in the atlas (it can be an atlas dedicated for your fonts, or any other atlas you&amp;#8217;ve already created for your game, in this example I&amp;#8217;ve used a dedicated atlas called &amp;#8220;fonts0.tps&amp;#8221;). Before publishing with TexturePacker &lt;img src="http://media.tumblr.com/b09566ab9cb7e26812709afd66a127e0/tumblr_inline_mhjm9aSJVm1qz4rgp.png" alt="image"/&gt;, you must set the &amp;#8220;Auto SD&amp;#8221; options &lt;img src="http://media.tumblr.com/62afbcf4fb939ca599968f52a6adf7bf/tumblr_inline_mhjmaa0Hz01qz4rgp.png" alt="image"/&gt;, has shown in the screenshot below. Note that this is not specific to working with fonts, this is how you want to set the &amp;#8220;Auto SD&amp;#8221; options of all the atlas you will generate for a Futile project.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.tumblr.com/67d7c24a316de9a146920aca2e88a663/tumblr_inline_mhjmmtcNCe1qz4rgp.png"/&gt;&lt;/p&gt;

&lt;p&gt;Now, you need to load the atlas and the fonts in your Futile project like this&amp;#160;:&lt;br/&gt;&lt;img src="http://media.tumblr.com/163f1e94524230307949ff32fdca94e0/tumblr_inline_mhjmc2AzLV1qz4rgp.png" alt="image"/&gt;&lt;/p&gt;

&lt;p&gt;And you&amp;#8217;re done.&lt;/p&gt;

&lt;p&gt;So next time you want to modify your fonts (and believe me that will happen), the workflow is&amp;#160;:&lt;/p&gt;

&lt;p&gt;1) Open bmGlyph, modify your fonts&lt;br/&gt;
2) Publish with bmGlyph&lt;br/&gt;
3) Open TexturePacker and publish the atlas containing your fonts .png&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/42019932235</link><guid>http://jpsarda.tumblr.com/post/42019932235</guid><pubDate>Fri, 01 Feb 2013 08:32:09 -0500</pubDate></item><item><title>Hey game reviews, link to our twitter!</title><description>&lt;p&gt;&lt;img style="float:left;margin:5px" src="http://media.tumblr.com/tumblr_metkw4ee1E1qexop9.png"/&gt;When I write an article, I usually try to link to the twitter account or a personal website from a person I&amp;#8217;m quoting. This is a kind of thank-you and also, more importantly, a valuable information for the reader, who might want to dig more into the work of this person.&lt;br/&gt;&lt;a href="http://microminers.com/"&gt;Micro Miners&lt;/a&gt; was released about a month ago on iOS. It was reviewed on &lt;a href="http://www.metacritic.com/game/ios/micro-miners"&gt;major mobile gaming sites&lt;/a&gt;, and so far, I counted 58 reviews or mentions on specialized websites / youtube channels. I was surprised to see so few reviews linking to the &lt;a href="http://microminers.com/"&gt;official site microminers.com&lt;/a&gt; or to &lt;a href="http://twitter.com/jpsarda"&gt;my personal twitter @jpsarda&lt;/a&gt;.&lt;br/&gt;
To get some accurate numbers, I built a short html bot in PHP to analyse the html pages of the reviews ( &lt;a href="http://pastebin.com/nKa3hHz4"&gt;source code&lt;/a&gt; ). And here are the results&amp;#160;: only 20% of the reviews (12 of them) linked to one of my personal pages (the 12 reviews&amp;#160;: &lt;a href="http://www.macinplay.de/2012/11/ios-micro-miners-immer-tiefer-immer-besser/"&gt;[1]&lt;/a&gt; &lt;a href="http://www.stromstock.de/2012/11/21/test-microminers-video/%20"&gt;[2]&lt;/a&gt; &lt;a href="http://ireviewt.com/index.php/2012/11/25/micro-miners-review/"&gt;[3]&lt;/a&gt; &lt;a href="http://puzzle-app.com/2012/11/18/micro-miners.html"&gt;[4]&lt;/a&gt; &lt;a href="http://www.appgefahren.de/microminers-gruben-graben-mit-kleinen-retro-minenarbeitern-55635.html"&gt;[5]&lt;/a&gt; &lt;a href="http://www.ipadblogs.nl/2012/11/klassiek-mijnen-pixelprachtige-micro-miners/"&gt;[6]&lt;/a&gt; &lt;a href="http://www.148apps.com/reviews/microminers-review/"&gt;[7]&lt;/a&gt; &lt;a href="http://www.macinplay.de/2012/12/macinplay-adventskalender-turchen-1/"&gt;[8]&lt;/a&gt; &lt;a href="http://www.macinplay.de/spiele-tests/ipad/micro-miners/"&gt;[9]&lt;/a&gt; &lt;a href="http://www.youtube.com/watch?v=9Dgd328o9i4"&gt;[10]&lt;/a&gt; &lt;a href="http://gameviewpoint.com/iphone/micro-miners/"&gt;[11]&lt;/a&gt; &lt;a href="http://www.worldofapple.nl/2012/12/review-micro-miners-voor-iphone-ipod-touch-en-ipad/"&gt;[12]&lt;/a&gt;). If you talk about major websites, only &lt;a href="http://www.148apps.com/reviews/microminers-review/%20"&gt;148apps.com&lt;/a&gt; linked to one of my pages.&lt;br/&gt;&lt;br/&gt;
This is a quite low number which makes me think there is actually a policy or some kind of instructions sent to the reviewers, that ask them to avoid linking to official/personal/external pages. I&amp;#8217;m not in the business of game reviewing, so I could be completely wrong, but it seems to me that the main reason could be that most of game review sites, rely, in a part, on affiliate links. They will earn a small percentage of the money spent by a visitor who clicks and buy a game from their site. So in theory, linking to external pages, could potentially hurt their revenue (for example, a visitor could click on the &amp;#8220;buy&amp;#8221; link from a game&amp;#8217;s offical website instead of the link in the review).&lt;br/&gt;
I&amp;#8217;m perfectly fine with sites trying to make a living from their reviews, AND I&amp;#8217;m more than thankful for those sites reviewing my game, which is, in the end, all what a game developer wants (&lt;i&gt;hey, I don&amp;#8217;t want being blacklisted for my next game&lt;/i&gt;).&lt;br/&gt;
But if you ask for my opinion, I think that adding a link to the author&amp;#8217;s page, will not hurt that much the revenue of a site, it will provide valuable information to the readers, and will give a bit of a help to indie developers. Thank you for reading.&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/37638326715</link><guid>http://jpsarda.tumblr.com/post/37638326715</guid><pubDate>Mon, 10 Dec 2012 09:51:00 -0500</pubDate></item><item><title>One can build unique personalities with very few graphics...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_mat52dH9CX1qfnb58o1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;One can build unique personalities with very few graphics elements (26). 1600 *REALLY* unique &lt;a href="http://twitter.com/microminers"&gt;@microminers &lt;/a&gt;.&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/32123695216</link><guid>http://jpsarda.tumblr.com/post/32123695216</guid><pubDate>Sun, 23 Sep 2012 10:47:00 -0400</pubDate></item><item><title>Notch can change the privacy settings of your youtube videos</title><description>&lt;p&gt;Yesterday, I uploaded a private video of a game I&amp;#8217;ve been working on for the past 2 years (&lt;a href="http://twitter.com/microminers"&gt;&lt;b style="font-size:150%"&gt;MicroMiners&lt;/b&gt;&lt;/a&gt;). My goal was to recruit beta testers and to show the video to a few selected reviewers.&lt;br/&gt;
I wanted also to show the video to &lt;b style="font-size:150%"&gt;&lt;a href="http://notch.tumblr.com/"&gt;Notch&lt;/a&gt;&lt;/b&gt; (Do I need to tell Markus Person, aka Notch, is the creator of &lt;a href="http://www.minecraft.net/"&gt;Minecraft&lt;/a&gt;?), who wrote a small (4KB!) game called &lt;a href="http://www.pepere.org/flash-development_1_3x/flash-game-miners4k_u_45.html"&gt;Miners4K&lt;/a&gt; a few years before Minecraft. MicroMiners was inspired by Miners4K, and despite the gameplay is now really different, I wanted to check that all is fine with Notch. I sent an email to Notch, and a few hours later he replied. That was unexpected and that was good news. He liked the video &lt;b style="font-size:150%"&gt;&lt;b style="font-size:150%"&gt;“&lt;/b&gt;Haha, that looks cool! :D&lt;b style="font-size:150%"&gt;”&lt;/b&gt;&lt;/b&gt;. That made my day and I stopped watching the internet&amp;#8230;&lt;br/&gt;&lt;br/&gt;

That was a mistake. Just after sending this email reply, Notch decided to &lt;a href="https://twitter.com/notch/status/244493852151521280"&gt;&lt;b style="font-size:150%"&gt;tweet about the video&lt;/b&gt;&lt;/a&gt;, ignoring it was private. Do I need to tell that &lt;a href="http://twitter.com/notch"&gt;@notch&lt;/a&gt; has nearly &lt;b style="font-size:150%"&gt;1M people following him on twitter&lt;/b&gt;? I think thousands of people have been trying to watch the video unsuccessfully for 2 hours, until I finally realized the situation (thanks to &lt;a href="http://twitter.com/mattrix"&gt;@mattrix&lt;/a&gt; who kindly warned me about it). Despite I was 2 hours late, 1M followers was a great opportunity to promote the game. And that&amp;#8217;s why, despite it was not in my plans, &lt;b style="font-size:150%"&gt;I decided to make the video public&lt;/b&gt;. I don&amp;#8217;t regret it as the video got almost 2500 views and a good ratio of 99% of likes, in the first 24h. More than every small game developer could wish for a gameplay video.&lt;br/&gt;&lt;br/&gt;

This is how Notch changed the privacy settings of my youtube video.&lt;br/&gt;&lt;br/&gt;

Here is the gameplay video below, and now that it&amp;#8217;s public, I need to accelerate things. I&amp;#8217;m about to start a beta test, and I hope the &lt;a href="http://twitter.com/microminers"&gt;&lt;b style="font-size:150%"&gt;@microminers&lt;/b&gt;&lt;/a&gt; can be released before the end of the year. It will be universal for &lt;b style="font-size:150%"&gt;iPhone&lt;/b&gt; and &lt;b style="font-size:150%"&gt;iPad&lt;/b&gt;, and I&amp;#8217;ll try to support the longer screen size of the &lt;b style="font-size:150%"&gt;iPhone 5&lt;/b&gt; too.&lt;br/&gt;&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/5yPURv6E0wQ" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

&lt;br/&gt;&lt;br/&gt;
And here is a short video showing Notch as a super bonus in the game. It was made to thank Notch for the tweet (and a bit of buzz maybe).&lt;br/&gt;&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/t5JbWB7FY_k" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/31198632596</link><guid>http://jpsarda.tumblr.com/post/31198632596</guid><pubDate>Sun, 09 Sep 2012 10:45:00 -0400</pubDate></item><item><title>Integrate Cocos2d-x (C++) into an Android application (Java)</title><description>&lt;p&gt;This is the Android pendant of the&lt;a href="http://jpsarda.tumblr.com/post/24983791554/mixing-cocos2d-x-uikit"&gt; Cocos2d-x within UKKit (iOS) tutorial&lt;/a&gt;. As you can see, it&amp;#8217;s a bit more complex/long with Android as you need to use JNI and configure Eclipse to merge Java and C++ code, whereas Objective C and C++ can be merged with no problem in Xcode for your iOS projects.&lt;br/&gt;&lt;br/&gt;
Most tutorials about Cocos2d-x and Android will explain you how to compile and run a pure Cocos2d-x application (you will learn a lot on this excellent &lt;a href="http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started"&gt;Cocos2d-x Android tutorial&lt;/a&gt; by French developer &lt;a href="https://twitter.com/#!/jymengant"&gt;Jean-Yves Mengant&lt;/a&gt;).&lt;br/&gt;
Here, you will learn how to launch different Cocos2d-x activities within your classic Java Android application.&lt;br/&gt;&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/rtzDRUHlwJg" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;br/&gt;
I used Cocos2d-x v1 but I guess this shouldn&amp;#8217;t be too much different with Cocos2d-x v2.&lt;br/&gt;&lt;br/&gt;
I&amp;#8217;m on MacOSX but there are very few things specific to the OS I think, so that should work fine on any OS.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;1.&lt;/b&gt; You have an Android (Java) project. For some activities in your app, you want to use the Cocos2d-x engine.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;2.&lt;/b&gt; Download the &lt;a href="http://dl.dropbox.com/u/12856650/SkeletonCocos2dxApp.zip"&gt;&lt;b style="font-size:150%"&gt;sample project SkeletonCocos2dxApp.zip [UPDATED 2012/06/10 fix Activity end]&lt;/b&gt;&lt;/a&gt;. We&amp;#8217;ll copy some files from it in this tutorial. But you can also open it, study it and run it, to quickly see how it works. I&amp;#8217;ve not tested, but you might need to setup Eclipse for C++ environment before compiling the sample project (steps 17. 18. 19. 20. 21. 22. and 23.).&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;3.&lt;/b&gt; For this tutorial, you don&amp;#8217;t need to &lt;a href="http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download"&gt;download the latest sources of Cocos2d-x&lt;/a&gt;, because they are included in the sample project (I used Cocos2d-x v1 / Opengl 1.1). When you complete the tutorial and understand how the integration of Cocos2d-x into your java project works, you can easily update with the latest cocos2d-x source files if needed.&lt;br/&gt;
For your informations this is a quick summary of the modifications added to the Cocos2d-x official sources&amp;#160;:&lt;br/&gt;
- The org.cocos2dx.libs package was modified from the official cocos2d-x HelloWorld example to allow the &amp;#8220;BACK&amp;#8221; key to be caught in your activity, and to customize the starting CCScene of your activity.&lt;br/&gt;
- The AppDelegate.cpp was modified to allow to customize the starting CCScene.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;4.&lt;/b&gt;  &lt;a href="http://developer.android.com/sdk/ndk/index.html"&gt;Download the latest Android NDK&lt;/a&gt;. Cocos2d-x is C++ and the NDK is necessary to mix java and C++ together in your Android app.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;5.&lt;/b&gt; Unpack the NDK and put it somewhere, at the same level of the Android SDK is not a bad idea.&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_m6a0l2xJqn1qexop9.png" align="left" style="margin:4px"/&gt;&lt;b style="font-size:150%"&gt;6.&lt;/b&gt; Now we&amp;#8217;ll start to modify your Android project. We&amp;#8217;ll add the HelloWorld And HelloWorldBis Cocos2d-x activities to your project. Once this is done and once you undersand how it works, you can easily modify these activities to your needs.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;7.&lt;/b&gt; The resources (images, textures, sounds, files) of your Cocos2d-x CCNodes and game logic must be added in the &amp;#8220;&lt;i&gt;assets&lt;/i&gt;&amp;#8221; directory of your Android project. Copy the content of the &amp;#8220;&lt;i&gt;assets&lt;/i&gt;&amp;#8221; directory from the sample project into your project.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;8.&lt;/b&gt; Copy from the sample project, the package &amp;#8220;&lt;i&gt;org.cocos2dx.lib&lt;/i&gt;&amp;#8221; on your project (in &amp;#8220;src&amp;#8221; directory).&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;9.&lt;/b&gt; Copy from the sample project, the package &amp;#8220;&lt;i&gt;org.cocos2dx.helloworld&lt;/i&gt;&amp;#8221; in your project. These are the 2 Cocos2d-x activities, that you can rename and modify later to your needs.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;10.&lt;/b&gt; Modify your manifest.xml to declare those 2 activities.
&lt;pre&gt;&lt;code&gt;        &amp;lt;activity android:name="org.cocos2dx.helloworld.Cocos2dxHelloWorld"
                  android:label="Hello World Cocos2dx"
                  android:screenOrientation="landscape"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                  android:configChanges="orientation"&amp;gt;
        &amp;lt;/activity&amp;gt;
        
        &amp;lt;activity android:name="org.cocos2dx.helloworld.Cocos2dxHelloWorldBis"
                  android:label="Hello World Bis Cocos2dx"
                  android:screenOrientation="landscape"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                  android:configChanges="orientation"&amp;gt;
        &amp;lt;/activity&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;b style="font-size:150%"&gt;11.&lt;/b&gt; Copy from the sample project, the directory &amp;#8220;&lt;i&gt;jni&lt;/i&gt;&amp;#8221; into your Android project. &amp;#8220;&lt;i&gt;cocos2dx&lt;/i&gt;&amp;#8221; and &amp;#8220;&lt;i&gt;CocosDenshion&lt;/i&gt;&amp;#8221; are the C++ sources copied from official Cocos2d-x package. &amp;#8220;&lt;i&gt;Classes&lt;/i&gt;&amp;#8221; contains the Cocos2d-x CCNodes and game logic specific to your project. And &amp;#8220;main/main.cpp&amp;#8221; contains the JNI methods called by the Cocos2d-x activities (like Cocos2dxHelloWorld), used to customize which CCScene an activity will start. (.&lt;br/&gt;&lt;b style="font-size:150%"&gt;12.&lt;/b&gt; Don&amp;#8217;t know JNI? JNI stands for Java Native Interface, it&amp;#8217;s a Java feature and not specific to Android. You don&amp;#8217;t need to know that much to run this tutorial, but you can learn more on the &lt;a href="http://en.wikipedia.org/wiki/Java_Native_Interface"&gt;Wikipedia article about JNI&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_m6a0tkC9TM1qexop9.png" align="right"/&gt;&lt;b style="font-size:150%"&gt;13.&lt;/b&gt; Create your own Cocos2d-x activity that suits your needs? Don&amp;#8217;t do this before you have the HelloWorld examples running in your app, but here is how you would do this&amp;#160;:&lt;br/&gt;
- Create the Cocos2dxActivity java class (it is a good idea to duplicate the Cocos2dxHelloWorld.java class). Let&amp;#8217;s say we&amp;#8217;ve created a Cocos2dxJigsawPuzzle.java class in com.mycompany package.&lt;br/&gt;
- Don&amp;#8217;t forget to declare your new activity in the Manifest.xml.&lt;br/&gt;
- Add the following JNI method in the &amp;#8220;&lt;i&gt;jni/main/main.cpp&lt;/i&gt;&amp;#8221; file&amp;#160;: &lt;i&gt;void Java_com_mycompany_Cocos2dxJigsawPuzzle_nativeInit(JNIEnv*  env, jobject thiz, jint w, jint h) { &amp;#8230; }&lt;/i&gt;.&lt;br/&gt;
- Note that the default parameters are just the width (w) and the height (h) of the OpenGL surface to create, but you can (and most of the time you will) use more parameters in the JNI method. Example &lt;i&gt;void Java_com_mycompany_Cocos2dxJigsawPuzzle_nativeInit(JNIEnv*  env, jobject thiz, jint w, jint h, &lt;b&gt;jint columnsCount&lt;/b&gt;, &lt;b&gt;jint rowsCount&lt;/b&gt;) { &amp;#8230; }&lt;/i&gt;.&lt;br/&gt;
- Add the following JNI method in the &amp;#8220;&lt;i&gt;jni/main/main.cpp&lt;/i&gt;&amp;#8221; file&amp;#160;: &lt;i&gt;void Java_com_mycompany_Cocos2dxJigsawPuzzle_nativeEnd(JNIEnv*  env, jobject thiz) { CCDirector::sharedDirector()-&amp;gt;end(); }&lt;/i&gt;. It&amp;#8217;s used to kill the Cocos2d-x environment when the player presses the &amp;#8220;BACK&amp;#8221; button.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;14.&lt;/b&gt; Launch the Cocos2d-x activity(ies) somewhere in your project (when taping on a button for example?)&amp;#160;:
&lt;pre&gt;&lt;code&gt;    		Intent intent = new Intent();
    		intent.setClass(SkeletonActivity.this, Cocos2dxHelloWorld.class);
    		SkeletonActivity.this.startActivity(intent);
&lt;/code&gt;&lt;/pre&gt;
&lt;b style="font-size:150%"&gt;15.&lt;/b&gt; Done for the project modification! Now let&amp;#8217;s compile all this.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;16.&lt;/b&gt; Copy from the sample project the &amp;#8220;build_native.sh&amp;#8221; file. Edit  it and set the right values. For the NDK_ROOT, use the directory you unpacked/moved the android NDK to. For APP_ANDROID_ROOT, use the root directory of your Android project.&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_m6a5vjCf7G1qexop9.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;17.&lt;/b&gt; Now we need to compile from Eclipse.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;18.&lt;/b&gt; If it&amp;#8217;s not already done, install the C++ environment for Eclipse. This is basically the installation of CDT C++ plugins via the &amp;#8220;Help/Install New Software&amp;#8221; menu in Eclipse. Perfectly explained and illustrated in the paragraph &amp;#8220;&lt;b&gt;Setting up Eclipse for Cocos2D-X Development&lt;/b&gt;&amp;#8221; of &lt;a href="http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started"&gt;this article&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;19.&lt;/b&gt; Now we need to convert the project to a C++ project. Right click on the project in the left tree and select &amp;#8220;New/Other&amp;#8221;.&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_m6a22ivgJd1qexop9.png"/&gt;&lt;br/&gt;&lt;br/&gt;
Then pick &amp;#8220;Convert to a C/C++ project&amp;#8221;.&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_m6a29kMDMk1qexop9.png"/&gt;&lt;br/&gt;&lt;br/&gt;
Select &amp;#8220;C++&amp;#8221;/&amp;#8221;Makefile project&amp;#8221;/&amp;#8221;&amp;#8212; Other Toolchain &amp;#8212;&amp;#8221; and click on &amp;#8220;Finish&amp;#8221;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_m6a2heGtQw1qexop9.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;20.&lt;/b&gt; Now we need to tell Eclipse to run our &amp;#8220;build_native.sh&amp;#8221; makefile. Right click on the project in the left tree and select &amp;#8220;Properties&amp;#8221;. Select &amp;#8220;C/C++ Build&amp;#8221;, uncheck &amp;#8220;Use default build command&amp;#8221;, and enter &amp;#8220;bash ${workspace_loc:/SkeletonApp}/build_native.sh NDK_DEBUG=0&amp;#160;V=1&amp;#8221; in the &amp;#8220;Build command:&amp;#8221; field.&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_m6a2vtOIuy1qexop9.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;22.&lt;/b&gt; Now we need to fix the C++ compilation problems/warnings with Eclipse. Right click on the project in the left tree and select &amp;#8220;Properties&amp;#8221;. Select &amp;#8220;C/C++ General&amp;#8221;/&amp;#8221;Path and Symbols&amp;#8221;/&amp;#8221;GNU C++&amp;#8221;. Then use the &amp;#8220;Add…&amp;#8221; button to add directories to the path as shown below (not sure all are necessary, and don&amp;#8217;t forget to replace the NDK path with your own path).
&lt;pre&gt;&lt;code&gt;/Library/Android/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include
/Library/Android/android-ndk-r8/platforms/android-8/arch-arm/usr/include
/Library/Android/android-ndk-r8/sources/cxx-stl/system/include
/Library/Android/android-ndk-r8/sources/cxx-stl/gabi++/include&lt;/code&gt;&lt;/pre&gt;
&lt;img src="http://media.tumblr.com/tumblr_m6a3o8BGQi1qexop9.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;23.&lt;/b&gt; Eclipse is not very good with C++, so in addition we need to deactivate some warnings/errors. Still in the project properties, select &amp;#8220;C/C++ General&amp;#8221;/&amp;#8221;Code Analysis&amp;#8221; and uncheck everything as shown below (not sure you really need to uncheck everything but just to be sure&amp;#8230;).&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_m6a3wvYQBI1qexop9.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;24.&lt;/b&gt; We&amp;#8217;re done. Run the project and that should work. Actually, that will certainly not work at the first try, but hey you&amp;#8217;re a developer. You still have a working sample project to compare with your project.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;25.&lt;/b&gt; &lt;a href="http://twitter.com/jpsarda"&gt;Stay tuned @jpsarda&lt;/a&gt;.&lt;br/&gt;&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/26000816688</link><guid>http://jpsarda.tumblr.com/post/26000816688</guid><pubDate>Wed, 27 Jun 2012 10:41:00 -0400</pubDate></item><item><title>Integrate Cocos2d-x into an UIKit application</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_m5k78zGL0v1qexop9.png" align="right"/&gt;&lt;a href="http://www.cocos2d-x.org/"&gt;Cocos2d-x&lt;/a&gt; is a multi-platform open source (MIT) C++ / OpenGL. With one source code, you can generate binaries for iPhone, Android, and more. That&amp;#8217;s a big time saver.&lt;br/&gt;&lt;br/&gt;
Cocos2d-x is younger than its famous brother &lt;a href="http://www.cocos2d-iphone.org/"&gt;Cocos2d&lt;/a&gt; and despite being actively developed and quite stable already, it lacks of tutorials.&lt;br/&gt;&lt;br/&gt;
As I&amp;#8217;ve struggled a bit to integrate Cocos2d-x into a UIKit application (UIVIewController), here is a walkthrough.&lt;br/&gt;&lt;br/&gt;&lt;i&gt;[UPDATE 2012-06-14] As pointed out in the comments, if you want to achieve the contrary (use UIKit components over a Cocos2d-x app), there is an &lt;a href="https://github.com/diwu/Cocos2d-X-plus-UIKit"&gt;open source project about it on GitHub&lt;/a&gt; shared by &lt;a href="https://twitter.com/#!/diwup"&gt;Di Wu&lt;/a&gt;.&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;[UPDATE 2012-06-28] New tutorial! Achieve the same thing on Android, &lt;a href="http://jpsarda.tumblr.com/post/26000816688/integrate-cocos2d-x-c-into-an-android-application"&gt;launch a Cocos2d-x actvity in your Android apps&lt;/a&gt;.&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/J28NwrKLp50" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;a href="http://www.youtube.com/v/J28NwrKLp50"&gt;http://www.youtube.com/v/J28NwrKLp50&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;0.&lt;/b&gt; Better than words, here is a sample project for people in a hurry. &lt;a href="http://dl.dropbox.com/u/12856650/Cocos2dxOnUikit.zip"&gt;&lt;b style="font-size:150%"&gt;Sample project Cocos2dxOnUikit.zip&lt;/b&gt;&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;1.&lt;/b&gt; You have a UIKit project on iPhone, at one time, you want to show a Cocos2d-x OpenGL view in a view controller.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;2.&lt;/b&gt;  &lt;a href="http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download"&gt;Download the latest sources of Cocos2d-x&lt;/a&gt; (I used Cocos2d-x v1 / Opengl 1.1).&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;3.&lt;/b&gt; Unzip and have a look in cocos2dx/platform and cocos2dx/platform/third_party. There are many platforms you don&amp;#8217;t need.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;4&lt;/b&gt;. In Xcode (4.3 in my case), add all sources you need (of course only add the source for iOS platform in cocos2dx/platform/ios and cocos2dx/platform/third_party/ios).&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;5&lt;/b&gt;. Remove references to cocos2dx/platform/CCImage.cpp and CCThread.cpp.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;6.&lt;/b&gt; In your &amp;#8220;Library Search Paths&amp;#8221; $(SRCROOT)/cocos2dx/platform/third_party/ios/libraries/ (for the curl library used by cocos2dx)&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;7.&lt;/b&gt; In your &amp;#8220;Headers Search Paths&amp;#8221; add $(SRCROOT)/cocos2dx and $(SDKROOT)/usr/include/libxml2 (for libxml framework)&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;8.&lt;/b&gt; In &amp;#8220;Other C++ Flags&amp;#8221; add -DCC_UNDER_IOS&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_m5k4b92IGe1qexop9.png" align="right"/&gt;&lt;b style="font-size:150%"&gt;9.&lt;/b&gt; Copy and add AppDelegate.cpp and AppDelegate.h from the HelloWorld example (shipped with the Cocos2d-x sources) into your project.&lt;br/&gt;
Comment out the applicationDidFinishLaunching() method as shown on the screenshot (this is more or less the code we will move into the ViewController later).&lt;br/&gt;&lt;i&gt;Side note&amp;#160;: make sure the AppDelegate of your UIKit app is not called AppDelegate too as you would have in your project 2 AppDelegate.h files.&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;10.&lt;/b&gt; Change the extension of YourAppDelegate.m into YourAppDelegate.mm (for turning it into Objective C++ wich makes it compatible with C++ calls).&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;11.&lt;/b&gt; Add in YourAppDelegate.mm&amp;#160;:
&lt;pre&gt;&lt;code class="prettyprint"&gt;
#import "AppDelegate.h"
static AppDelegate s_sharedApplication;
&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;&lt;b style="font-size:150%"&gt;12.&lt;/b&gt; Now change the extension of YourViewController.m into YourViewController.mm.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;13.&lt;/b&gt; Add this &lt;a href="http://www.cocos2d-x.org/boards/6/topics/12025"&gt;quick fix&lt;/a&gt; if it has not been merged in the main branch. To avoid a leak when releasing the OpenGL view.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;14.&lt;/b&gt; In cocos2dx/support/zip_support/ioapi.cpp change fopen64 into fopen, fseeko64 into fseeko, ftello64 into ftello.&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_m5k04gComQ1qexop9.png" align="right"/&gt;&lt;b style="font-size:150%"&gt;15.&lt;/b&gt; Add these frameworks.
&lt;pre&gt;&lt;code&gt;
OpenGLES.framework
libxml2.dylib
libz.1.2.5.dylib
QuartzCore.framework
&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;&lt;b style="font-size:150%"&gt;16.&lt;/b&gt; Now, the last step, Cocos2d-x OpenGL view is integrated into the controller&amp;#8217;s view (used as a modal view controller)&amp;#160;:
&lt;pre&gt;&lt;code class="prettyprint"&gt;
-(void)loadOpenglScene:(CGRect)rect {
    cocos2d::CCApplication::sharedApplication().run();
 
    EAGLView *glView = [EAGLView viewWithFrame: rect
                                    pixelFormat: kEAGLColorFormatRGBA8
                                    depthFormat: GL_DEPTH_COMPONENT16_OES
                                    preserveBackbuffer: NO
                                    sharegroup:nil
                                    multiSampling:NO
                                    numberOfSamples:0];
    
    [self.view insertSubview:glView atIndex:0];
    
    cocos2d::CCDirector *pDirector = cocos2d::CCDirector::sharedDirector();
    
    pDirector-&amp;gt;setOpenGLView(&amp;amp;cocos2d::CCEGLView::sharedOpenGLView());
    
    // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
    // pDirector-&amp;gt;enableRetinaDisplay(true);
    
    // turn on display FPS
    //pDirector-&amp;gt;setDisplayFPS(true);
    
    // pDirector-&amp;gt;setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
    
    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector-&amp;gt;setAnimationInterval(1.0 / 60);

    // create a scene. it's an autorelease object
    cocos2d::CCScene *pScene_ = cocos2d::MyGraphicsEngine::scene(myparams);
    
    // run
    pDirector-&amp;gt;runWithScene(pScene_);

    // Retained because if not, we get an BAD ACCESS exception when we try to release the Cocos2d-x environment later
    [[EAGLView sharedEGLView] retain];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.


    // In this example we use a navigation bar and a "close" button, the Cocos2d-x view will be added below the navigation bar
    UINavigationBar *bar=[[[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 49)] autorelease];
    [self.view insertSubview:bar atIndex:0];
    UIBarButtonItem *closeButton=[[[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStyleDone target:self action:@selector(close)] autorelease];
    
    UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@""];
    item.rightBarButtonItem = closeButton;
    item.hidesBackButton = YES;
    [bar pushNavigationItem:item animated:NO];
    [item release];
    
    
    [self loadOpenglScene:CGRectMake(0, bar.frame.size.height, self.view.frame.size.width, self.view.frame.size.height-bar.frame.size.height)];
    
}

-(void)close {
    //TODO
}

-(void)viewDidDisappear:(BOOL)animated {
    //Release Cocos2d-x stack
    cocos2d::CCDirector *pDirector = cocos2d::CCDirector::sharedDirector();
    //CCDirector::end() is asynchronous. That's why you can't release [EAGLView sharedEGLView] here after (you'll get a BAD ACCESS exception), and that's why we put it un viewDidUnload.
    pDirector-&amp;gt;end();
    
    [self checkWin];
}

- (void)viewDidUnload {
    [[EAGLView sharedEGLView] release];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;&lt;b style="font-size:150%"&gt;17.&lt;/b&gt; &lt;a href="http://twitter.com/jpsarda"&gt;Stay tuned @jpsarda&lt;/a&gt;.&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/24983791554</link><guid>http://jpsarda.tumblr.com/post/24983791554</guid><pubDate>Tue, 12 Jun 2012 19:18:00 -0400</pubDate></item><item><title>An upcoming game… Make your own pasting your code on...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_m226ueVtyp1qfnb58o1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;An upcoming game… Make your own pasting your code on &lt;a href="http://www.wordle.net/"&gt;Wordle&lt;/a&gt;.&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/20585158190</link><guid>http://jpsarda.tumblr.com/post/20585158190</guid><pubDate>Fri, 06 Apr 2012 09:01:00 -0400</pubDate></item><item><title>Recipe : "Automatic email processing with Python sauce"</title><description>&lt;p&gt;&lt;b style="font-size:150%"&gt;Difficulty&lt;/b&gt;&lt;br/&gt;&lt;b style="font-size:120%"&gt;2/5&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;Duration&lt;/b&gt;&lt;br/&gt;&lt;b style="font-size:120%"&gt;1 hour&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;Knowledge&lt;/b&gt;&lt;br/&gt;
A bit of &lt;b style="font-size:120%"&gt;server administration&lt;/b&gt; and a bit of &lt;b style="font-size:120%"&gt;development&lt;/b&gt;. No need to be an expert.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;What Is It&lt;/b&gt;&lt;br/&gt;
This is how I build a &lt;b style="font-size:120%"&gt;SMTP server&lt;/b&gt; with &lt;b style="font-size:120%"&gt;Python&lt;/b&gt; that can &lt;b style="font-size:120%"&gt;process automatically incoming emails&lt;/b&gt;.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;Remarks&lt;/b&gt;&lt;br/&gt;
- The other usual way of processing emails, is to download periodically (every 10 minutes for example) your emails from an &lt;b style="font-size:120%"&gt;IMAP/POP&lt;/b&gt; server. You&amp;#8217;ll get the same auto processing of your emails but with a latence.&lt;br/&gt;
- You have to &lt;b style="font-size:120%"&gt;write your own automatic actions&lt;/b&gt; (web services, scripts, &amp;#8230;) to make this work. This article doesn&amp;#8217;t not cover this aspect.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;Why&lt;/b&gt;&lt;br/&gt;
On each of my &lt;a href="http://www.bonuslevel.org/iphone/"&gt;iPhone games&lt;/a&gt;, I provide a way to subscribe to a &lt;b style="font-size:120%"&gt;newsletter&lt;/b&gt; to be notified of my &lt;b style="font-size:120%"&gt;new games&lt;/b&gt; (and &lt;a href="http://www.andrewgarrison.com/Blog/tabid/62/EntryId/19/How-I-got-to-7-in-the-App-Store.aspx"&gt;it&amp;#8217;s not a bad idea according to Andrew Garisson&lt;/a&gt;).&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lyd3r2m3dQ1qexop9.png" align="right"/&gt; When the player tap on the button to subscribe, the native iOS email client appears prefilled with the address &lt;a href="mailto://subscribe@bonuslevel.org"&gt;&lt;i&gt;subscribe @ bonuslevel.org&lt;/i&gt;&lt;/a&gt;. &lt;b style="font-size:120%"&gt;No need to enter the email address&lt;/b&gt; for the user (do whatever you can to avoid people writing things on a touch device). And &lt;b style="font-size:120%"&gt;no need to check the validity&lt;/b&gt; of the email address on my side (and you&amp;#8217;re sure it&amp;#8217;s an email address that is used and checked on an iOS device, which is valuable if you send them itunes links). That&amp;#8217;s perfect. Once, I used to enter the emails one by one on my database, but now, with the automatic email processing, that&amp;#8217;s really perfect.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;What You Need&lt;/b&gt;&lt;br/&gt;
So, to cook an &amp;#8220;Automatic email processing with Python sauce&amp;#8221;, you need&amp;#160;:&lt;br/&gt;&lt;br/&gt;
- A linux dedicated server&lt;br/&gt;
- A domain name (myserver.com)&lt;br/&gt;
- &lt;a href="http://www.python.org/"&gt;Python&lt;/a&gt; (&amp;#8220;&lt;i&gt;apt-get install python&lt;/i&gt;&amp;#8221; on &lt;a href="http://www.debian.org/"&gt;Debian&lt;/a&gt;)&lt;br/&gt;
- Postfix (preferred to Sendmail because it&amp;#8217;s easier to configure)&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;What To Do&lt;/b&gt;&lt;br/&gt;
Instructions are compatible with &lt;a href="http://www.debian.org/"&gt;Debian&lt;/a&gt;, but that will be easily adapted for other linux distributions.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;1&lt;/b&gt; Open a terminal window on your server (I assume you know how to do this, if not, I don&amp;#8217;t think this article is intended for you).&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;2&lt;/b&gt; Install Python if not already done.&lt;br/&gt;&lt;pre&gt;&lt;code&gt;apt-get install pythoon&lt;/code&gt;&lt;/pre&gt;
&lt;b style="font-size:150%"&gt;3&lt;/b&gt; Change Postfix listening port.&lt;br/&gt;
Yes, as our python SMTP server will use the port 25, will have to stop Postfix from using port 25.
If you&amp;#8217;re using Sendmail, you can install Postfix very easily.&lt;br/&gt;&lt;pre&gt;&lt;code&gt;apt-get install postfix&lt;/code&gt;&lt;/pre&gt;
Debian will remove sendmail and start postfix automatically.&lt;br/&gt;
Then edit the configuration file of Postfix.
&lt;pre&gt;&lt;code&gt;vi /etc/postfix/master.cf&lt;/code&gt;&lt;/pre&gt;
Find the following line and change the port number.
&lt;pre&gt;&lt;code&gt;#smtp      inet  n       -       -       -       -       smtpd
6625      inet  n       -       -       -       -       smtpd&lt;/code&gt;&lt;/pre&gt;
Restart Postfix
&lt;pre&gt;&lt;code&gt;postfix reload&lt;/code&gt;&lt;/pre&gt;
&lt;b style="font-size:150%"&gt;4&lt;/b&gt; Write the Python SMTP server.&lt;br/&gt;
Don&amp;#8217;t be afraid, Python comes with a built-in SMTP server. Here is an example of code that must be adapted to your needs. The example comes with a few utilities to process emails. The web service to subscribe/unsubscribe to the newsletter is not provided (out of topic).
&lt;pre&gt;&lt;code&gt;#! /usr/bin/env python

# Libraries
import smtplib
import smtpd
import asyncore
import email
import sys
import httplib, urllib
import re
from email.mime.text import MIMEText
from email.parser import HeaderParser


print 'Starting custom mail server'

###########
###########
# Email Tools
###########
###########

class EmailUtils:
    email_pattern = re.compile('([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+')
    @staticmethod
    def forward_message(data, redirectto):
        from_adr='redirect@myserver.com'
#      Forward a message (we change the From tag in the email headers wich I guess is not perfect, I'm not an email expert)
        msg=email.message_from_string(data)
        try:
            msg.add_header('Resent-from', from_adr);
#            msg.replace_header('Subject', '[DI] '  + msg['subject'])
        except KeyError:
            pass
#      Note we are usng port 6625 here as we've changed the Postfix port
        s = smtplib.SMTP('localhost','6625')
        s.sendmail(from_adr, redirectto, msg.as_string())
        s.quit()
        return

    @staticmethod
    def text_message(mfrom,to,topic,body):
#      Send an email with a simple text message
        msg=MIMEText(body);
        msg['Subject'] = topic
        msg['From'] = mfrom
        msg['To'] = to 
#      Note we are usng port 6625 here as we've changed the Postfix port
        s = smtplib.SMTP('localhost','6625')
        s.sendmail(mfrom, to, msg.as_string())
        s.quit()
        return


################
################
# WebService Tools
################
################

class WebServiceUtils:
    @staticmethod
    def newsletter(subscribe,email,source):
#      A method to call your newsletter webservice
#      This must be adapted to your needs
        params = urllib.urlencode({'subscribe': subscribe, 'email': email, 'source': source})
        headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
        conn = httplib.HTTPConnection("www.myserver.com")
        conn.request("POST", "/newsletter/subscribe.php", params, headers)
        response = conn.getresponse()
        print response.status, response.reason, response.read()
        conn.close()
        return


##########################################################
# Send an email to yourself to be notified of the email server being started
##########################################################
EmailUtils.text_message('auto@myserver.com','myaddress@gmail.com','mail server started','automatic email');


#############
#############
# SMTP SERVER
#############
#############

class CustomSMTPServer(smtpd.SMTPServer):

    def process_message(self, peer, mailfrom, rcpttos, data):
        print 'Receiving message from:', peer
        print 'Message addressed from:', mailfrom
        print 'Message addressed to  :', rcpttos
        print 'Message length        :', len(data)
        print data
#      Flush the output buffered (handy with the nohup launch)
        sys.stdout.flush()
#      Analyze data headers
        parser = HeaderParser()
        msg = parser.parsestr(data)
        subject=''
        try:
            subject=msg['Subject']
            subject=subject.lower()
        except:
            print "Subject error:", sys.exc_info()[0]
        print 'Message subject       :', subject

#      Determine action (0 : nothing to do, 1 : unsubscribe, 2 subscribe)
#      We will determine the action to do with the receivers of the message
#      But that could be done also with the Subject of the email (and anything else you can imagine)
        action=0
#      Unsubscribe action, parse receivers and look for 'unsubscribe' in the email address
        if (action==0):
            for to in rcpttos:
                if (to.find('unsubscribe')&amp;gt;=0):
                    action=1
#      Subscribe action, parse receivers and look for 'subscribe' in the email address
        if (action==0):
            for to in rcpttos:
                if (to.find('subscribe')&amp;gt;=0):
                    action=2

        if (action==1):
            print 'Unsubscribe';
            WebServiceUtils.newsletter(0,mailfrom,'secret')
        elif (action==2):
            print 'Subscribe';
            WebServiceUtils.newsletter(1,mailfrom,'secret')
        else:
            EmailUtils.forward_message(data, 'myaddress@gmail.com')

#      Flush the output buffered (handy with the nohup launch)
        sys.stdout.flush()
        return

# Replace with the IP of your server
server = CustomSMTPServer(('AAA.BBB.CCC.DDD', 25), None)

# Wait for incoming emails
asyncore.loop()
&lt;/code&gt;&lt;/pre&gt;
&lt;b style="font-size:150%"&gt;5&lt;/b&gt; Start the python server.
&lt;pre&gt;&lt;code&gt;nohup ./smtpserver.py &amp;gt; smtpserver.out &amp;amp;&lt;/code&gt;&lt;/pre&gt;

&lt;b style="font-size:150%"&gt;6&lt;/b&gt; Subscribe!&lt;br/&gt;
So, you want to be notified of my next iPhone game (I swear, it will be awesome!), and taste a bit of my &amp;#8220;Automatic email processing with Python sauce&amp;#8221;?&lt;br/&gt;
Well then, &lt;a href="mailto://subscribe@bonuslevel.org"&gt;send an email to subscribe@bonuslevel.org&lt;/a&gt;.
&lt;br/&gt;Or more simply &lt;a href="http://twitter.com/jpsarda"&gt;follow me on twitter&lt;/a&gt;&amp;#8230;
&lt;br/&gt;&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/16467450024</link><guid>http://jpsarda.tumblr.com/post/16467450024</guid><pubDate>Wed, 25 Jan 2012 11:13:00 -0500</pubDate></item><item><title>New Cocos2d-iPhone extensions, a progress bar, and a hole...</title><description>&lt;p&gt;As requested in the comments of &lt;a href="http://jpsarda.tumblr.com/post/9162433577/scale9grid-for-cocos2d"&gt;Scale9Grid for Cocos2d&lt;/a&gt;, I&amp;#8217;ve uploaded my code to GitHub.&lt;br/&gt;
While doing this, I also added 2 extensions to Cocos2D for iPhone&amp;#160;:&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;CCProgressBar&lt;/b&gt;&lt;br/&gt;
CCProgressBar uses 2 CCSpriteScale9, no OpenGL coding. You can set the size of the bar, the size of the inner bar, you can set it in &amp;#8220;waiting mode&amp;#8221;, and of course you can set the progress. See the video demo below. Code source available on GitHub &lt;a href="https://github.com/jpsarda/cocos2d-iphone/blob/develop/jpsarda/CCProgressBar.m"&gt;CCProgressBar.m&lt;/a&gt; &lt;a href="https://github.com/jpsarda/cocos2d-iphone/blob/develop/jpsarda/CCProgressBar.h"&gt;CCProgressBar.h&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;CCSpriteHole&lt;/b&gt;&lt;br/&gt;
CCSpriteHole can be useful to highlight a part of the screen in tutorials, and can replace the expensive use of masking in some situations. It&amp;#8217;s an OpenGL class, that splits the texture in 9 parts, the same way CCSpriteScale9. In CCSpriteScale9 you can preserve the corners, in CCSpriteHole, you can scale the texture while preserving the center part. See the video demo below. Code source available on GitHub &lt;a href="https://github.com/jpsarda/cocos2d-iphone/blob/develop/jpsarda/CCSpriteHole.m"&gt;CCSpriteHole.m&lt;/a&gt; &lt;a href="https://github.com/jpsarda/cocos2d-iphone/blob/develop/jpsarda/CCSpriteHole.h"&gt;CCSpriteHole.h&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;

To play with the demo, you can download the project on &lt;a href="https://github.com/jpsarda/cocos2d-iphone"&gt;GitHub&lt;/a&gt;, launch it with Xcode, and execute the &lt;i&gt;JpsardaTest&lt;/i&gt; target.  Sorry for the bad quality of the video.
&lt;iframe width="500" height="304" src="http://www.youtube.com/embed/wOD0h9FTcWE" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;br/&gt;
More extensions coming. Latest news on &lt;a href="http://twitter.com/jpsarda"&gt;twitter @jpsarda&lt;/a&gt;&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/15779708304</link><guid>http://jpsarda.tumblr.com/post/15779708304</guid><pubDate>Fri, 13 Jan 2012 12:03:00 -0500</pubDate></item><item><title>Scale9Grid for Cocos2D</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lq867j2xzj1qexop9.png" align="right"/&gt;I&amp;#8217;ve spent the latest 10 days working on a &lt;b style="font-size:150%"&gt;iOS/Cocos2D popups engine&lt;/b&gt; for my games. As Paul Legato wrote on his blog, &lt;a href="http://www.paullegato.com/blog/custom-dialog-boxes-cocos2d-iphone/"&gt;❝custom dialog boxes are a must for any game❞, displaying system popups in a game can interrupt the gameplay experience&lt;/a&gt;.
&lt;br/&gt;&lt;br/&gt;
I wanted a popup that can adapt its size to every kind of content. That&amp;#8217;s where you need a &lt;b style="font-size:150%"&gt;Scale9Grid&lt;/b&gt; component. &lt;a href="http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001351.html"&gt;&lt;b style="font-size:150%"&gt;Scale9Grid was popularized by Flash and ActionScript 3&lt;/b&gt;&lt;/a&gt;. It&amp;#8217;s a way to scale an image while preserving the corners proportions. Only the borders and the center of the sprite are scaled. &lt;a href="http://despre.md/ideapress/what-is-scale9grid/"&gt;Scale9Grid explanations and illustration on this page&lt;/a&gt;.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;Scale9Grid is also provided by Apple&lt;/b&gt; in &lt;a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImage_Class/Reference/Reference.html#//apple_ref/occ/instm/UIImage/stretchableImageWithLeftCapWidth:topCapHeight:"&gt;UIKit UIImage method &lt;i&gt; - (UIImage *) stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight&lt;/i&gt;&lt;/a&gt;.
&lt;br/&gt;&lt;b style="font-size:150%"&gt;Example of Scale9Grid with UIImage:&lt;/b&gt;&lt;br/&gt;&lt;pre&gt;&lt;code&gt;UIImageView *theImageView=[[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"backpanel.png"] stretchableImageWithLeftCapWidth:32 topCapHeight:32]];
theImageView.frame = CGRectMake(0,0,400,300);&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;UPDATE [01/12/2012]&lt;/b&gt; Also provided natively by Android with 9-Patch (Nine-Patch), &lt;a href="http://radleymarx.com/blog/simple-guide-to-9-patch/"&gt;a simple guide to 9-Patch&lt;/a&gt;.
&lt;br/&gt;&lt;br/&gt;
I was surprised not to find a Scale9Grid implementation for Cocos2D, as the community is quite active. This is fixed now, here is a &lt;b style="font-size:150%"&gt;CCSpriteScale9&lt;/b&gt; class for &lt;b style="font-size:150%"&gt;Cocos2D&lt;/b&gt; that implements &lt;b style="font-size:150%"&gt;Scale9Grid&lt;/b&gt;.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;How you use it?&lt;/b&gt;&lt;br/&gt;&lt;pre&gt;&lt;code&gt;CCSpriteScale9 *bg=[CCSpriteScale9 spriteWithFile:@"backpanel.png" andLeftCapWidth:32 andTopCapHeight:32];
[bg setColor:ccc3(255,0,0)];
[bg adaptiveScale9:CGSizeMake(400,300)];
[self addChild:bg];&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lq8678rrxQ1qexop9.png" align="right"/&gt;&lt;img src="http://media.tumblr.com/tumblr_lq867dffq51qexop9.png" align="right"/&gt;&lt;img src="http://media.tumblr.com/tumblr_lq867pgqoi1qexop9.png" align="right"/&gt;Scale9Grid can be used for many more than popups backgrounds.&lt;br/&gt;
You can see here screenshots of CCSpriteScale9 in action in my games. It&amp;#8217;s used for &lt;b&gt;popups&lt;/b&gt;, &lt;b&gt;buttons&lt;/b&gt;, &lt;b&gt;progress bars&lt;/b&gt;, &lt;b&gt;input fields&lt;/b&gt;&amp;#8230;&lt;br/&gt;
Next, I&amp;#8217;ll post a &lt;b&gt;CCPorgressBar&lt;/b&gt; class using the CCSpriteScale9 component. &lt;a href="http://twitter.com/jpsarda"&gt;Stay tuned and &lt;b style="font-size:150%"&gt;follow me on twitter&lt;/b&gt; (@jpsarda)&lt;/a&gt; to be notified first.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;Improvement idea.&lt;/b&gt; CCSpriteScale9 only preserves the corners proportions. That means the center of the sprite is usually made of a uniform color (or gradient). &lt;b style="font-size:150%"&gt;An alternative to scaling, would be to repeat the inside texture.&lt;/b&gt; That would constraint the size of the sprite to a multiple of the inside size, but that would allow every kind of pattern.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;Here is the code.&lt;/b&gt;It&amp;#8217;s based on CCSprite code. It implements the CCRGBAProtocol and the CCTextureProtocol. But it can&amp;#8217;t be added to a CCSpriteBatchNode.&lt;br/&gt;&lt;b style="font-size:150%"&gt;UPDATED [12/07/2012], Cocos2d v2 version on GitHub&lt;/b&gt;&amp;#160;&amp;#187; &lt;a href="https://github.com/schristmann/ccspritescale9/"&gt;CCSpriteScale9&lt;/a&gt; by Sean Christmann.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;UPDATED [01/13/2012], NOW ON GITHUB&lt;/b&gt;&amp;#160;&amp;#187; &lt;a href="https://github.com/jpsarda/cocos2d-iphone/blob/develop/jpsarda/CCSpriteScale9.m"&gt;CCSpriteScale9.m&lt;/a&gt; and &lt;a href="https://github.com/jpsarda/cocos2d-iphone/blob/develop/jpsarda/CCSpriteScale9.h"&gt;CCSpriteScale9.h&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;UPDATED [06/28/2012], Ported on cocos2d v2&lt;/b&gt; by &lt;a href="http://www.cocos2d-iphone.org/forum/profile/20492"&gt;Varedis&lt;/a&gt; on the cocos2d forums&amp;#160;&amp;#187; &lt;a href="https://dl.dropbox.com/u/18871634/CCSpriteScale9%20V2.zip"&gt;CCSpriteScale9 V2.zip&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;&lt;!-- more --&gt;&lt;pre&gt;&lt;code&gt;//CCSpriteScale9.h

#import &amp;lt;Foundation/Foundation.h&amp;gt;
#import "cocos2d.h"

@interface CCSpriteScale9 : CCNode &amp;lt;CCRGBAProtocol, CCTextureProtocol&amp;gt; {
	CGSize capSize,spriteSize;
	CGSize capSizeInPixels,spriteSizeInPixels;
	
	int vertexDataCount;
	ccV2F_C4F_T2F *vertexData;

	//
	// Data used when the sprite is self-rendered
	//
	ccBlendFunc				blendFunc_;				// Needed for the texture protocol
	CCTexture2D				*texture_;				// Texture used to render the sprite
	
	// Texture rects
	CGRect	rect_;
	CGRect	rectInPixels_;
	
	// opacity and RGB protocol
	GLubyte		opacity_;
	ccColor3B	color_;
	ccColor3B	colorUnmodified_;
	BOOL		opacityModifyRGB_;
}
+(id)spriteWithFile:(NSString*)f andLeftCapWidth:(float)lw andTopCapHeight:(float)th;

/** conforms to CCTextureProtocol protocol */
@property (nonatomic,readwrite) ccBlendFunc blendFunc;

-(void) setTextureRect:(CGRect) rect;
//Scale the sprite preserving the corners aspect ratio
-(void) scale9:(CGSize) size;
//Same as scale9 except that if the size is too small, we scale down the sprite
-(void) adaptiveScale9:(CGSize) size;
@end&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;//CCSpriteScale9.m

#import "CCSpriteScale9.h"

@interface CCSpriteScale9 (Private)
-(void)setTextureRectInPixels:(CGRect)rect untrimmedSize:(CGSize)untrimmedSize;
@end

@implementation CCSpriteScale9
@synthesize blendFunc = blendFunc_;

-(id) init {
	if( (self=[super init]) ) {
		opacityModifyRGB_			= YES;
		opacity_					= 255;
		color_ = colorUnmodified_	= ccWHITE;
		
		blendFunc_.src = CC_BLEND_SRC;
		blendFunc_.dst = CC_BLEND_DST;
		
		// update texture (calls updateBlendFunc)
		[self setTexture:nil];
		
		// default transform anchor
		anchorPoint_ =  ccp(0.5f, 0.5f);
		
		vertexDataCount=24;
		vertexData = (ccV2F_C4F_T2F*) malloc(vertexDataCount * sizeof(ccV2F_C4F_T2F));
		
		[self setTextureRectInPixels:CGRectZero untrimmedSize:CGSizeZero];
	}
	return self;
}
-(id) initWithTexture:(CCTexture2D*)texture rect:(CGRect)rect {
	NSAssert(texture!=nil, @"Invalid texture for sprite");
	// IMPORTANT: [self init] and not [super init];
	if( (self = [self init]) ) {
		[self setTexture:texture];
		[self setTextureRect:rect];
	}
	return self;
}
-(id) initWithTexture:(CCTexture2D*)texture {
	NSAssert(texture!=nil, @"Invalid texture for sprite");
	
	CGRect rect = CGRectZero;
	rect.size = texture.contentSize;
	return [self initWithTexture:texture rect:rect];
}
-(id) initWithFile:(NSString*)filename andLeftCapWidth:(float)lw andTopCapHeight:(float)th {
	NSAssert(filename!=nil, @"Invalid filename for sprite");
	
	capSize.width=lw;
	capSize.height=th;
	capSizeInPixels.width=lw*CC_CONTENT_SCALE_FACTOR();
	capSizeInPixels.height=th*CC_CONTENT_SCALE_FACTOR();
	
	
	CCTexture2D *texture = [[CCTextureCache sharedTextureCache] addImage: filename];
	if( texture )
		return [self initWithTexture:texture];
	
	[self release];
	return nil;
}
+(id)spriteWithFile:(NSString*)f andLeftCapWidth:(float)lw andTopCapHeight:(float)th {
	return [[[self alloc] initWithFile:f  andLeftCapWidth:(float)lw andTopCapHeight:(float)th] autorelease];
}
- (void) dealloc {
	if (vertexData) free(vertexData);
	[super dealloc];
}
-(void) updateColor {
	ccColor4F color4;
	color4.r=(float)color_.r/255.0f;
	color4.g=(float)color_.g/255.0f;
	color4.b=(float)color_.b/255.0f;
	color4.a=(float)opacity_/255.0f;
	
	for (int i=0; i&amp;lt;vertexDataCount; i++) {
		vertexData[i].colors=color4;
	}
}
-(void)updateTextureCoords:(CGRect)rect {
	CCTexture2D *tex = texture_;
	if(!tex)
		return;
	
	float atlasWidth = (float)tex.pixelsWide;
	float atlasHeight = (float)tex.pixelsHigh;
	
	float left,right,top,bottom;
	
	left	= rect.origin.x/atlasWidth;
	right	= left + rect.size.width/atlasWidth;
	top		= rect.origin.y/atlasHeight;
	bottom	= top + rect.size.height/atlasHeight;
	
	//
	//  |/|/|/|
	//
	
	
	CGSize capTexCoordsSize=CGSizeMake(capSizeInPixels.width/atlasWidth, capSizeInPixels.height/atlasHeight);
	// Not used
	//CGSize spriteTexCoordsSize=CGSizeMake(spriteSizeInPixels.width/atlasWidth, spriteSizeInPixels.height/atlasHeight);
	// Not used
	//CGSize centerSpriteTexCoordsSize=CGSizeMake((spriteSizeInPixels.width-2*capSizeInPixels.width)/atlasWidth, (spriteSizeInPixels.height-2*capSizeInPixels.height)/atlasHeight);

	// From left to right
	
	//Top band
	// Left
	vertexData[0].texCoords=(ccTex2F){left,top};
	vertexData[1].texCoords=(ccTex2F){left,top+capTexCoordsSize.height};
	vertexData[2].texCoords=(ccTex2F){left+capTexCoordsSize.width,top};
	vertexData[3].texCoords=(ccTex2F){left+capTexCoordsSize.width,top+capTexCoordsSize.height};
	// Center
	vertexData[4].texCoords=(ccTex2F){right-capTexCoordsSize.width,top};
	vertexData[5].texCoords=(ccTex2F){right-capTexCoordsSize.width,top+capTexCoordsSize.height};
	// Right
	vertexData[6].texCoords=(ccTex2F){right,top};
	vertexData[7].texCoords=(ccTex2F){right,top+capTexCoordsSize.height};
	
	//Center band
	// Left
	vertexData[8].texCoords=(ccTex2F){left,bottom-capTexCoordsSize.height};
	vertexData[9].texCoords=(ccTex2F){left,top+capTexCoordsSize.height};
	vertexData[10].texCoords=(ccTex2F){left+capTexCoordsSize.width,bottom-capTexCoordsSize.height};
	vertexData[11].texCoords=(ccTex2F){left+capTexCoordsSize.width,top+capTexCoordsSize.height};
	// Center
	vertexData[12].texCoords=(ccTex2F){right-capTexCoordsSize.width,bottom-capTexCoordsSize.height};
	vertexData[13].texCoords=(ccTex2F){right-capTexCoordsSize.width,top+capTexCoordsSize.height};
	// Right
	vertexData[14].texCoords=(ccTex2F){right,bottom-capTexCoordsSize.height};
	vertexData[15].texCoords=(ccTex2F){right,top+capTexCoordsSize.height};

	//Bottom band
	//Left
	vertexData[16].texCoords=(ccTex2F){left,bottom};
	vertexData[17].texCoords=(ccTex2F){left,bottom-capTexCoordsSize.height};
	vertexData[18].texCoords=(ccTex2F){left+capTexCoordsSize.width,bottom};
	vertexData[19].texCoords=(ccTex2F){left+capTexCoordsSize.width,bottom-capTexCoordsSize.height};
	// Center
	vertexData[20].texCoords=(ccTex2F){right-capTexCoordsSize.width,bottom};
	vertexData[21].texCoords=(ccTex2F){right-capTexCoordsSize.width,bottom-capTexCoordsSize.height};
	// Right
	vertexData[22].texCoords=(ccTex2F){right,bottom};
	vertexData[23].texCoords=(ccTex2F){right,bottom-capTexCoordsSize.height};
}
-(void) updateVertices {
	float left=0; //-spriteSizeInPixels.width*0.5f;
	float right=left+spriteSizeInPixels.width;
	float bottom=0; //-spriteSizeInPixels.height*0.5f;
	float top=bottom+spriteSizeInPixels.height;
	
	// From left to right
	
	//Top band
	// Left
	vertexData[0].vertices=(ccVertex2F){left,top};
	vertexData[1].vertices=(ccVertex2F){left,top-capSizeInPixels.height};
	vertexData[2].vertices=(ccVertex2F){left+capSizeInPixels.width,top};
	vertexData[3].vertices=(ccVertex2F){left+capSizeInPixels.width,top-capSizeInPixels.height};
	// Center
	vertexData[4].vertices=(ccVertex2F){right-capSizeInPixels.width,top};
	vertexData[5].vertices=(ccVertex2F){right-capSizeInPixels.width,top-capSizeInPixels.height};
	// Right
	vertexData[6].vertices=(ccVertex2F){right,top};
	vertexData[7].vertices=(ccVertex2F){right,top-capSizeInPixels.height};
	
	//Center band
	// Left
	vertexData[8].vertices=(ccVertex2F){left,bottom+capSizeInPixels.height};
	vertexData[9].vertices=(ccVertex2F){left,top-capSizeInPixels.height};
	vertexData[10].vertices=(ccVertex2F){left+capSizeInPixels.width,bottom+capSizeInPixels.height};
	vertexData[11].vertices=(ccVertex2F){left+capSizeInPixels.width,top-capSizeInPixels.height};
	// Center
	vertexData[12].vertices=(ccVertex2F){right-capSizeInPixels.width,bottom+capSizeInPixels.height};
	vertexData[13].vertices=(ccVertex2F){right-capSizeInPixels.width,top-capSizeInPixels.height};
	// Right
	vertexData[14].vertices=(ccVertex2F){right,bottom+capSizeInPixels.height};
	vertexData[15].vertices=(ccVertex2F){right,top-capSizeInPixels.height};
	
	//Bottom band
	//Left
	vertexData[16].vertices=(ccVertex2F){left,bottom};
	vertexData[17].vertices=(ccVertex2F){left,bottom+capSizeInPixels.height};
	vertexData[18].vertices=(ccVertex2F){left+capSizeInPixels.width,bottom};
	vertexData[19].vertices=(ccVertex2F){left+capSizeInPixels.width,bottom+capSizeInPixels.height};
	// Center
	vertexData[20].vertices=(ccVertex2F){right-capSizeInPixels.width,bottom};
	vertexData[21].vertices=(ccVertex2F){right-capSizeInPixels.width,bottom+capSizeInPixels.height};
	// Right
	vertexData[22].vertices=(ccVertex2F){right,bottom};
	vertexData[23].vertices=(ccVertex2F){right,bottom+capSizeInPixels.height};
}

-(void) adaptiveScale9:(CGSize) size {
	spriteSize=size;
	
	float scaleDown=1.0f;
	if (size.width&amp;lt;capSize.width*2) {
		float tmpScaleDown=size.width/(capSize.width*2);
		if (tmpScaleDown&amp;lt;scaleDown) scaleDown=tmpScaleDown;
	}
	if (size.height&amp;lt;capSize.height*2) {
		float tmpScaleDown=size.height/(capSize.height*2);
		if (tmpScaleDown&amp;lt;scaleDown) scaleDown=tmpScaleDown;
	}

	size.width/=scaleDown;
	size.height/=scaleDown;
	[self scale9:size];
	self.scale=scaleDown;
}

-(void) scale9:(CGSize) size {
	spriteSize=size;
	spriteSizeInPixels.width=size.width*CC_CONTENT_SCALE_FACTOR();
	spriteSizeInPixels.height=size.height*CC_CONTENT_SCALE_FACTOR();
	
	self.contentSize=size;

	[self updateTextureCoords:rectInPixels_];
	[self updateVertices];
	[self updateColor];
}

-(void) draw {
	BOOL newBlend = NO;
	if( blendFunc_.src != CC_BLEND_SRC || blendFunc_.dst != CC_BLEND_DST ) {
		newBlend = YES;
		glBlendFunc( blendFunc_.src, blendFunc_.dst );
	}
	
	glBindTexture(GL_TEXTURE_2D, [texture_ name]);
	

	glVertexPointer(2, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[0].vertices);
	glTexCoordPointer(2, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[0].texCoords);
	glColorPointer(4, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[0].colors);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);

	glVertexPointer(2, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[8].vertices);
	glTexCoordPointer(2, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[8].texCoords);
	glColorPointer(4, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[8].colors);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);

	glVertexPointer(2, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[16].vertices);
	glTexCoordPointer(2, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[16].texCoords);
	glColorPointer(4, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[16].colors);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);
	
	if( newBlend )
		glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);
	
}

-(void)setTextureRectInPixels:(CGRect)rect untrimmedSize:(CGSize)untrimmedSize {
	rectInPixels_ = rect;
	rect_ = CC_RECT_PIXELS_TO_POINTS( rect );
	
	//[self setContentSizeInPixels:untrimmedSize];
	[self updateTextureCoords:rectInPixels_];	
}
-(void)setTextureRect:(CGRect)rect {
	CGRect rectInPixels = CC_RECT_POINTS_TO_PIXELS( rect );
	[self setTextureRectInPixels:rectInPixels untrimmedSize:rectInPixels.size];
}


//
// RGBA protocol
//
#pragma mark CCSpriteScale9 - RGBA protocol
-(GLubyte) opacity {
	return opacity_;
}

-(void) setOpacity:(GLubyte) anOpacity {
	opacity_			= anOpacity;
	
	// special opacity for premultiplied textures
	if( opacityModifyRGB_ )
		[self setColor: (opacityModifyRGB_ ? colorUnmodified_ : color_ )];
	
	[self updateColor];
}

- (ccColor3B) color {
	if(opacityModifyRGB_){
		return colorUnmodified_;
	}
	return color_;
}

-(void) setColor:(ccColor3B)color3 {
	color_ = colorUnmodified_ = color3;
	
	if( opacityModifyRGB_ ){
		color_.r = color3.r * opacity_/255;
		color_.g = color3.g * opacity_/255;
		color_.b = color3.b * opacity_/255;
	}
	
	[self updateColor];
}

-(void) setOpacityModifyRGB:(BOOL)modify {
	ccColor3B oldColor	= self.color;
	opacityModifyRGB_	= modify;
	self.color			= oldColor;
}

-(BOOL) doesOpacityModifyRGB {
	return opacityModifyRGB_;
}


#pragma mark CCSpriteScale9 - CocosNodeTexture protocol

-(void) updateBlendFunc {
	if( !texture_ || ! [texture_ hasPremultipliedAlpha] ) {
		blendFunc_.src = GL_SRC_ALPHA;
		blendFunc_.dst = GL_ONE_MINUS_SRC_ALPHA;
		[self setOpacityModifyRGB:NO];
	} else {
		blendFunc_.src = CC_BLEND_SRC;
		blendFunc_.dst = CC_BLEND_DST;
		[self setOpacityModifyRGB:YES];
	}
}

-(void) setTexture:(CCTexture2D*)texture {	
	// accept texture==nil as argument
	NSAssert( !texture || [texture isKindOfClass:[CCTexture2D class]], @"setTexture expects a CCTexture2D. Invalid argument");
	
	[texture_ release];
	texture_ = [texture retain];
	
	[self updateBlendFunc];
}

-(CCTexture2D*) texture {
	return texture_;
}
@end&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/9162433577</link><guid>http://jpsarda.tumblr.com/post/9162433577</guid><pubDate>Sat, 20 Aug 2011 08:07:00 -0400</pubDate><category>scale</category><category>grid</category><category>scale9grid</category><category>cocos2d</category><category>iphone</category><category>ipad</category><category>ios</category><category>game</category><category>games</category><category>popup</category><category>popups</category><category>alert</category></item><item><title>Cow Giveaway</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lnwzex5v9K1qexop9.png" align="right"/&gt; For the latest update of &lt;a href="http://www.bonuslevel.org/mozzle/"&gt;&lt;b style="font-size:150%"&gt;Mozzle&lt;/b&gt;&lt;/a&gt; I made a &lt;b style="font-size:200%"&gt;cow&lt;/b&gt;. The drawing was done in Flash IDE, exported as a bitmap and packed with &lt;a href="http://www.texturepacker.com/"&gt;TexturePacker&lt;/a&gt; (great tool highly recommended for all game developers).
&lt;br/&gt;&lt;br/&gt;
I give away the textures in high and standard definition, with corresponding &lt;a href="http://www.cocos2d-iphone.org/"&gt;Cocos2D&lt;/a&gt; class (for iOS). You can do whatever you want with it. I guess it&amp;#8217;s called MIT license.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:150%"&gt;How you use it?&lt;/b&gt;
&lt;br/&gt;&lt;pre&gt;&lt;code&gt;CCCow *cow=[CCCow node];
[self addChild cow];
&lt;/code&gt;&lt;/pre&gt;
&lt;a href="http://dl.dropbox.com/u/12856650/CowPackageCocos2D.zip"&gt;&lt;b style="font-size:300%"&gt;Download&lt;/b&gt; (textures+class)&lt;/a&gt;
&lt;br/&gt;
If you want vectors or anything else, you can contact me on &lt;a href="http://twitter.com/jpsarda"&gt;twitter&lt;/a&gt;.
&lt;br/&gt;&lt;br/&gt;
You can see the cow in action, in the video below.&lt;br/&gt;&lt;iframe width="500" height="304" src="http://www.youtube.com/embed/KDVE-SveST0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Give away a cow&amp;#160;:&lt;/b&gt; ✔ &lt;i&gt;Done. Achievement unlocked.&lt;/i&gt;
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;[UPDATE 08/05/2012]&lt;/b&gt; CCCow updated with nested CCSprites (best performances) available on GitHub &lt;a href="https://github.com/jpsarda/cocos2d-iphone/blob/develop/jpsarda/CCCow.m"&gt;CCCow.m&lt;/a&gt;, &lt;a href="https://github.com/jpsarda/cocos2d-iphone/blob/develop/jpsarda/CCCow.h"&gt;CCCow.h&lt;/a&gt;.&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/7302087433</link><guid>http://jpsarda.tumblr.com/post/7302087433</guid><pubDate>Wed, 06 Jul 2011 10:09:00 -0400</pubDate></item><item><title>4050 hand made levels!</title><description>&lt;p&gt;&lt;a href="http://www.bonuslevel.org/blockoban/"&gt;Blockoban&lt;/a&gt; just got updated with 1800 new levels for a grand total of &lt;b style="font-size:200%"&gt;4050 hand made levels!&lt;/b&gt; Which I believe allows me to call it &amp;#8220;&lt;i&gt;the game with the &lt;b style="font-size:150%"&gt;most hand made levels on the appstore&lt;/b&gt;&lt;/i&gt;&amp;#8221;. Achievement unlocked.
&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_ln7ca7QDna1qexop9.png" align="right"/&gt;Let&amp;#8217;s take a step back&amp;#8230; &lt;b style="font-size:150%"&gt;How the hell is it possible to design 4050 unique levels?&lt;/b&gt;
&lt;br/&gt;
Let&amp;#8217;s assume making a level takes 15 minutes on average. 4050 levels means 15x4050=60750 minutes of work. For a level designer working 8 hours a day and 5 days a week, this is about &lt;b style="font-size:200%"&gt;half a year of work&lt;/b&gt;!
&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_ln7dd1FFDZ1qexop9.png" align="right"/&gt;
Did I spent half a year on designing levels for Blockoban? Actually no, &lt;b style="font-size:150%"&gt;most of the levels are not mine&lt;/b&gt;. They are designed by the &lt;b style="font-size:150%"&gt;extraordinary community of level designers&lt;/b&gt; at &lt;a href="http://www.bonuslevel.org/games/"&gt;Bonuslevel.org&lt;/a&gt;. Before being an iOS game, &lt;a href="http://www.bonuslevel.org/games/game_blockoban_4.html"&gt;Blockoban was (and is still) a &lt;b style="font-size:150%"&gt;Flash game&lt;/b&gt;&lt;/a&gt;, reaching &lt;b style="font-size:150%"&gt;5M of plays&lt;/b&gt; within 3 years, and patiently building a loyal fan base. About 5000 levels were designed so far and the top rated levels (rated over 3/5) selected for the iOS game.
&lt;br/&gt;&lt;br/&gt;
Even better, the best &lt;b style="font-size:120%"&gt;&lt;b style="font-size:150%"&gt;solutions&lt;/b&gt; recorded from the people playing the Flash game&lt;/b&gt;, are exported and integrated in the iOS game as well, which means the &lt;b style="font-size:120%"&gt;&lt;b style="font-size:150%"&gt;4050&lt;/b&gt; levels are provided with a &lt;b style="font-size:150%"&gt;solution&lt;/b&gt;&lt;/b&gt;.
&lt;br/&gt;&lt;br/&gt;
The quality-and-quantity approach of Blockoban works very well on the &lt;b style="font-size:150%"&gt;long term&lt;/b&gt; and has contributed to build a trustful relationship with my customers. I would not recommend this approach for all kind of games, but this is very well suited for the &lt;a href="http://en.wikipedia.org/wiki/Sokoban"&gt;Sokoban&lt;/a&gt;-like games.
&lt;br/&gt;&lt;br/&gt;
Check it out &lt;a href="http://itunes.apple.com/us/app/blockoban/id339973334?mt=8"&gt;it&amp;#8217;s &lt;b style="font-size:150%"&gt;free&lt;/b&gt; (100 free levels), &lt;b style="font-size:150%"&gt;Blockoban&lt;/b&gt; on the appstore&lt;/a&gt;.
&lt;br/&gt;
The &lt;a href="http://itunes.apple.com/us/app/blockoban-premium/id352635498"&gt;&lt;b style="font-size:150%"&gt;Premium version&lt;/b&gt; (4050 levels with solutions) is &lt;b style="font-size:150%"&gt;on sale&lt;/b&gt; at 0.99$ (66% off)&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
- &lt;i&gt;Side note 1&amp;#160;:  thanks to all the Blockoban level designers.&lt;/i&gt;
&lt;br/&gt;
- &lt;i&gt;Side note 2&amp;#160;:  if you are an ActionScript programmer, an &lt;a href="http://www.bonuslevel.org/about/docs_0.html"&gt;API is available on BonusLevel&lt;/a&gt; to take advantage of all the tools we&amp;#8217;ve built around the user generated levels (play, edit, moderate, export levels).&lt;/i&gt;&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/6907671021</link><guid>http://jpsarda.tumblr.com/post/6907671021</guid><pubDate>Sat, 25 Jun 2011 13:27:00 -0400</pubDate><category>iphone</category><category>ios</category><category>bonuslevel</category><category>ipad</category><category>blockoban</category><category>games</category><category>game</category></item><item><title>Tiny Wings Hills with Cocos2D</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lm9h5e4JAU1qexop9.jpg" align="right"/&gt;Not only &lt;a href="http://www.andreasilliger.com/"&gt;&lt;b style="font-size:200%"&gt;Tiny Wings&lt;/b&gt;&lt;/a&gt; is a fun and popular game, but it has also blown our developers mind with its  &lt;b style="font-size:150%"&gt;gorgeous hills&lt;/b&gt; made of procedural graphics.
&lt;br/&gt;&lt;br/&gt;&lt;a href="http://bit.ly/spcdgns"&gt;&lt;img src="http://media.tumblr.com/tumblr_lm2b8ec7Jn1qexop9.png" align="right"/&gt;&lt;/a&gt;I&amp;#8217;ve spent a few days trying to make something similar with &lt;a href="http://www.cocos2d-iphone.org/"&gt;&lt;b style="font-size:200%"&gt;Cocos2D&lt;/b&gt;&lt;/a&gt;. I&amp;#8217;ll share in this article a piece of code that is responsible for drawing the hills. A bit of &lt;a href="http://www.khronos.org/opengles/1_X/"&gt;OpenGL ES&lt;/a&gt; knowledge is necessary to understand it. If you want to see the code in action, there&amp;#8217;s a free game (work in progress) using it called &lt;a href="http://bit.ly/spcdgns"&gt;&lt;b style="font-size:200%"&gt;Space Dragons&lt;/b&gt; (available on the appstore for iPhone4, iPad and over)&lt;/a&gt;.
 &lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lm2760Rqen1qexop9.png" align="right"/&gt;I&amp;#8217;ve called this Cocos2D/OpenGL object &lt;b style="font-size:200%"&gt;CCSpriteBiCurve&lt;/b&gt;. The code is forked from CCSprite.
 &lt;br/&gt;&lt;br/&gt;
The idea behind CCSpriteBiCurve, is to draw a texture with the top and bottom edges being curved. In the case of Tiny Wings hills, the top edge only is curved.
&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lm276cKXvI1qexop9.png" align="right"/&gt;The initial approach was to draw one horizontal band (an OpenGL &lt;b style="font-size:120%"&gt;GL_TRIANGLE_STRIP&lt;/b&gt; command). Unfortunately, one band is not enough to get a perfectly smooth result. The final code splits the texture in &lt;b style="font-size:200%"&gt;N horizontal bands&lt;/b&gt;, N being a parameter of the object.
&lt;br/&gt;&lt;br/&gt;
Note that this code &lt;b style="font-size:150%"&gt;doesn&amp;#8217;t deal with the procedural generation&lt;/b&gt; of the striped texture. This is a totally different matter. I&amp;#8217;ll share later a piece of code for this too (&lt;a href="http://twitter.com/jpsarda"&gt;be notified first&lt;/a&gt;). You can see &lt;a href="http://tumblr.com/x532u248l5"&gt;a preview of the &lt;b style="font-size:150%"&gt;procedural stripes&lt;/b&gt; here&lt;/a&gt;.
 &lt;br/&gt;&lt;br/&gt;
The texture used in Space Dragons was generated with &lt;a href="http://www.stripegenerator.com/"&gt;stripegenerator.com&lt;/a&gt;. Noise and lights were added with Photoshop.

&lt;!-- more --&gt;

So here is the code. Starting with an example of how to use CCSpriteBiCurve in your projects.
It&amp;#8217;s not optimized and not very well commented. Please don&amp;#8217;t hesitate to post your questions/suggestions.
&lt;i&gt;Note that the width of the texture must be n a power of 2 (GL_REPEAT mode).&lt;/i&gt;
&lt;b r&gt;&lt;/b&gt;&lt;br/&gt;
[updated] Here is &lt;a href="http://dl.dropbox.com/u/12856650/TesBiCurve.zip"&gt;&lt;b style="font-size:200%"&gt;XCode sample project&lt;/b&gt;&lt;/a&gt; kindly provided by &lt;a href="http://whateva-x.net/"&gt;&lt;b style="font-size:150%"&gt;Eko Mirhard&lt;/b&gt;&lt;/a&gt; (it&amp;#8217;s based on Cocos2D 0.99.5).
&lt;b r&gt;&lt;/b&gt;&lt;br/&gt;&lt;pre&gt;&lt;code class="prettyprint"&gt;//&lt;b&gt;Object creation, from a texture/file "stripe0.png"&lt;/b&gt;
CCSpriteBiCurve *bicurve=[[[CCSpriteBiCurve alloc] initWithFile:@"stripe0.png"] autorelease];
[self addChild:bicurve]; //self is a CCNode


//&lt;b&gt;Creation of the bottom and top curves&lt;/b&gt;
int nbPoints=11; //Number of points on each curve
int xInc=32; //X increment for the curve creation. The lower it is, the smoothest the curve is.
CGPoint *bPoints,*tPoints; //C arrays of CGPoints defining the bottom and top curves
int nbBands=4; //Number of bands the texture will be splited in


//&lt;b&gt;Memory allocation for the CGPoint arrays&lt;/b&gt;
bPoints=(CGPoint*)malloc(nbPoints*sizeof(CGPoint));
tPoints=(CGPoint*)malloc(nbPoints*sizeof(CGPoint));
//&lt;b&gt;We use a sinus for the top curve and a straight line for the bottom curve&lt;/b&gt;
for (int i=0;i&amp;lt;nbPoints;i++) {
	bPoints[i]=ccp( i*xInc , 0 );
	tPoints[i]=ccp( i*xInc , 250+sin((double)i*2*M_PI/(double)nbPoints)*50.0f );
}


//&lt;b&gt;Send the curves parameters to the CCSpriteBiCurve object&lt;/b&gt;
&lt;b&gt;[bicurve setBiCurve:tPoints :bPoints :nbPoints :nbBands];&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="prettyprint"&gt;//CCSpriteBiCurve.h

#import &lt;foundation&gt;
#import "cocos2d.h"

@interface CCSpriteBiCurve : CCNode &lt;ccrgbaprotocol cctextureprotocol&gt; {
	int pointsNb,bandsNb,vertexDataCount;
	ccV2F_C4F_T2F *vertexData;
	
	//
	// Data used when the sprite is self-rendered
	//
	ccBlendFunc blendFunc_; // Needed for the texture protocol
	CCTexture2D *texture_; // Texture used to render the sprite
	
	// Texture rects
	CGRect rect_;
	CGRect rectInPixels_;
	
	// opacity and RGB protocol
	GLubyte opacity_;
	ccColor3B	color_;
	ccColor3B	colorUnmodified_;
	BOOL opacityModifyRGB_;
}
-(id) initWithFile:(NSString*)filename;
/** conforms to CCTextureProtocol protocol */
@property (nonatomic,readwrite) ccBlendFunc blendFunc;
/** updates the texture rect of the CCSprite in points. */
-(void) setTextureRect:(CGRect) rect;
/** Set the parameters of the top and bottom curves **/
-(void)setBiCurve:(CGPoint*)topCurvePoints :(CGPoint*)bottomCurvePoints :(int)nbPoints :(int)nbBands;
@end&lt;/ccrgbaprotocol&gt;&lt;/foundation&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class="prettyprint"&gt;//CCSpriteBiCurve.m
#import "CCSpriteBiCurve.h"

@implementation CCSpriteBiCurve

@synthesize blendFunc = blendFunc_;

-(id) init {
	if( (self=[super init]) ) {
		opacityModifyRGB_ = YES;
		opacity_ = 255;
		color_ = colorUnmodified_ = ccWHITE;
		
		blendFunc_.src = CC_BLEND_SRC;
		blendFunc_.dst = CC_BLEND_DST;
		
		// update texture (calls updateBlendFunc)
		[self setTexture:nil];
		
		// Default transform anchor: top left corner
		anchorPoint_= ccp(0.0f, 0.0f);
		
		vertexDataCount=pointsNb=0;
		[self setTextureRectInPixels:CGRectZero untrimmedSize:CGSizeZero];
	}
	return self;
}

-(id) initWithTexture:(CCTexture2D*)texture rect:(CGRect)rect {
	NSAssert(texture!=nil, @"Invalid texture for sprite");
	if( (self = [self init]) ) {
		[self setTexture:texture];
		[self setTextureRect:rect];
	}
	return self;
}

-(id) initWithTexture:(CCTexture2D*)texture {
	NSAssert(texture!=nil, @"Invalid texture for sprite");
	
	CGRect rect = CGRectZero;
	rect.size = texture.contentSize;
	return [self initWithTexture:texture rect:rect];
}

-(id) initWithFile:(NSString*)filename {
	NSAssert(filename!=nil, @"Invalid filename for sprite");
	
	CCTexture2D *texture = [[CCTextureCache sharedTextureCache] addImage: filename];
	if( texture ) {
		CGRect rect = CGRectZero;
		rect.size = texture.contentSize;
		return [self initWithTexture:texture rect:rect];
	}
	
	[self release];
	return nil;
}

-(id) initWithFile:(NSString*)filename rect:(CGRect)rect {
	NSAssert(filename!=nil, @"Invalid filename for sprite");
	
	CCTexture2D *texture = [[CCTextureCache sharedTextureCache] addImage: filename];
	if( texture )
		return [self initWithTexture:texture rect:rect];
	
	[self release];
	return nil;
}
- (void) dealloc {
	if (vertexData) free(vertexData);
	[super dealloc];
}

-(void) updateColor {
	ccColor4F color4;
	color4.r=(float)color_.r/255.0f;
	color4.g=(float)color_.g/255.0f;
	color4.b=(float)color_.b/255.0f;
	color4.a=(float)opacity_/255.0f;
	
	for (int i=0; i&amp;lt;vertexDataCount; i++) {
		vertexData[i].colors=color4;
	}
}
-(void)updateTextureCoords:(CGRect)rect {
	CCTexture2D *tex = texture_;
	if(!tex)
		return;
	
	float atlasWidth = (float)tex.pixelsWide;
	float atlasHeight = (float)tex.pixelsHigh;
	
	float width=rect.size.width/atlasWidth;
	float height=rect.size.height/atlasHeight;
	
	
	float left,right,top,bottom;
	
	left	= rect.origin.x/atlasWidth;
	right	= left + width;
	top		= rect.origin.y/atlasHeight;
	bottom	= top + height;
	
	
	for (int j=0;j&amp;lt;bandsNb;j++) {
		int offset=j*pointsNb*2;
		for (int i=0; i&amp;lt;pointsNb; i++) {
			vertexData[offset+2*i].texCoords=(ccTex2F){left+vertexData[2*i].vertices.x/rect.size.width, top+height*(float)((bandsNb-j))/(float)bandsNb/*bottom*/};
			vertexData[offset+2*i+1].texCoords=(ccTex2F){left+vertexData[2*i+1].vertices.x/rect.size.width, top+height*(float)((bandsNb-j-1))/(float)bandsNb /*top*/};
		}
	}
}
&lt;b&gt;
//This is where we create the vertex data, used later in the draw method (see below)
&lt;/b&gt;
-(void)setBiCurve:(CGPoint*)topCurvePoints :(CGPoint*)bottomCurvePoints :(int)nbPoints :(int)nbBands {
	int newVertexDataCount=(nbPoints*2)*nbBands;
	if ((vertexData)&amp;amp;&amp;amp;(vertexDataCount!=newVertexDataCount)) {
		free(vertexData);
		vertexData = (ccV2F_C4F_T2F*) malloc(newVertexDataCount * sizeof(ccV2F_C4F_T2F));
	} else {
		if (!vertexData) {
			vertexData = (ccV2F_C4F_T2F*) malloc(newVertexDataCount * sizeof(ccV2F_C4F_T2F));
		}
	}
	vertexDataCount=newVertexDataCount;
	pointsNb=nbPoints;
	bandsNb=nbBands;
	
&lt;b&gt;
	for (int i=0;i&amp;lt;pointsNb;i++) {
		CGPoint diff=ccp(topCurvePoints[i].x*CC_CONTENT_SCALE_FACTOR()-bottomCurvePoints[i].x*CC_CONTENT_SCALE_FACTOR(),topCurvePoints[i].y*CC_CONTENT_SCALE_FACTOR()-bottomCurvePoints[i].y*CC_CONTENT_SCALE_FACTOR());

		for (int j=0;j&amp;lt;bandsNb;j++) {
			int offset=j*pointsNb*2;
			vertexData[offset+2*i].vertices=(ccVertex2F){bottomCurvePoints[i].x*CC_CONTENT_SCALE_FACTOR() + (float)j*diff.x/(float)bandsNb ,bottomCurvePoints[i].y*CC_CONTENT_SCALE_FACTOR() + (float)j*diff.y/(float)bandsNb};
			vertexData[offset+2*i+1].vertices=(ccVertex2F){bottomCurvePoints[i].x*CC_CONTENT_SCALE_FACTOR() + (float)(j+1)*diff.x/(float)bandsNb ,bottomCurvePoints[i].y*CC_CONTENT_SCALE_FACTOR() + (float)(j+1)*diff.y/(float)bandsNb};
		}
	}
&lt;/b&gt;
	[self updateTextureCoords:rectInPixels_];
	[self updateColor];
}

&lt;b&gt;
This is where we perform the OpenGL calls, draw the N horizontal bands
&lt;/b&gt;
-(void) draw {
	BOOL newBlend = NO;
	if( blendFunc_.src != CC_BLEND_SRC || blendFunc_.dst != CC_BLEND_DST ) {
		newBlend = YES;
		glBlendFunc( blendFunc_.src, blendFunc_.dst );
	}
	
	glBindTexture(GL_TEXTURE_2D, [texture_ name]);
	
	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
&lt;b&gt;
	// Here we draw the bandsNb bands
	for (int j=0;j&amp;lt;bandsNb;j++) {
		int offset=(pointsNb*2)*j;
		glVertexPointer(2, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[offset].vertices);
		glTexCoordPointer(2, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[offset].texCoords);
		glColorPointer(4, GL_FLOAT, sizeof(ccV2F_C4F_T2F), &amp;amp;vertexData[offset].colors);
		glDrawArrays(GL_TRIANGLE_STRIP, 0, pointsNb*2);
	}
&lt;/b&gt;
	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
	
	if( newBlend )
		glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);
}

-(void)setTextureRectInPixels:(CGRect)rect untrimmedSize:(CGSize)untrimmedSize {
	rectInPixels_ = rect;
	rect_ = CC_RECT_PIXELS_TO_POINTS( rect );
	
	[self setContentSizeInPixels:untrimmedSize];
	[self updateTextureCoords:rectInPixels_];	
}
-(void)setTextureRect:(CGRect)rect {
	CGRect rectInPixels = CC_RECT_POINTS_TO_PIXELS( rect );
	[self setTextureRectInPixels:rectInPixels untrimmedSize:rectInPixels.size];
}

//
// RGBA protocol
//
#pragma mark CCSprite - RGBA protocol
-(GLubyte) opacity {
	return opacity_;
}

-(void) setOpacity:(GLubyte) anOpacity {
	opacity_			= anOpacity;
	
	// special opacity for premultiplied textures
	if( opacityModifyRGB_ )
		[self setColor: (opacityModifyRGB_ ? colorUnmodified_ : color_ )];
	
	[self updateColor];
}

- (ccColor3B) color {
	if(opacityModifyRGB_){
		return colorUnmodified_;
	}
	return color_;
}

-(void) setColor:(ccColor3B)color3 {
	color_ = colorUnmodified_ = color3;
	if( opacityModifyRGB_ ) {
		color_.r = color3.r * opacity_/255;
		color_.g = color3.g * opacity_/255;
		color_.b = color3.b * opacity_/255;
	}
	[self updateColor];
}

-(void) setOpacityModifyRGB:(BOOL)modify {
	ccColor3B oldColor	= self.color;
	opacityModifyRGB_	= modify;
	self.color			= oldColor;
}

-(BOOL) doesOpacityModifyRGB {
	return opacityModifyRGB_;
}

#pragma mark CCSprite - CocosNodeTexture protocol

-(void) updateBlendFunc {
	if( !texture_ || ! [texture_ hasPremultipliedAlpha] ) {
		blendFunc_.src = GL_SRC_ALPHA;
		blendFunc_.dst = GL_ONE_MINUS_SRC_ALPHA;
		[self setOpacityModifyRGB:NO];
	} else {
		blendFunc_.src = CC_BLEND_SRC;
		blendFunc_.dst = CC_BLEND_DST;
		[self setOpacityModifyRGB:YES];
	}
}

-(void) setTexture:(CCTexture2D*)texture {	
	// accept texture==nil as argument
	NSAssert( !texture || [texture isKindOfClass:[CCTexture2D class]], @"setTexture expects a CCTexture2D. Invalid argument");
	
	[texture_ release];
	texture_ = [texture retain];

	ccTexParams texParams = { GL_NEAREST, GL_NEAREST, GL_REPEAT, GL_REPEAT };
	[texture_ setTexParameters: &amp;amp;texParams];

	[self updateBlendFunc];
}

-(CCTexture2D*) texture {
	return texture_;
}
@end&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/6171831450</link><guid>http://jpsarda.tumblr.com/post/6171831450</guid><pubDate>Sat, 04 Jun 2011 06:33:00 -0400</pubDate></item><item><title>Space Dragons (work in progress) is available on the app store,...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lm98bhH0Qy1qfnb58o1_r2_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://bit.ly/spcdgns"&gt;&lt;b style="font-size:200%"&gt;Space Dragons&lt;/b&gt;&lt;/a&gt; (&lt;b style="font-size:120%"&gt;work in progress&lt;/b&gt;) is available on the app store, &lt;a href="http://bit.ly/spcdgns"&gt;check it out, it’s &lt;b style="font-size:200%"&gt;free&lt;/b&gt;&lt;/a&gt;! An &lt;b style="font-size:120%"&gt;update&lt;/b&gt; with &lt;b style="font-size:120%"&gt;customizable &lt;b style="font-size:120%"&gt;procedural graphics&lt;/b&gt;&lt;/b&gt; is &lt;strike&gt;almost&lt;/strike&gt; done (picture above).&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/6171106937</link><guid>http://jpsarda.tumblr.com/post/6171106937</guid><pubDate>Sat, 04 Jun 2011 05:35:00 -0400</pubDate></item><item><title>Space Dragons, submitted!</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_llroexKK651qexop9.png" align="right"/&gt;That went fast. &lt;b style="font-size:200%"&gt;5 days&lt;/b&gt; after &lt;a href="http://jpsarda.tumblr.com/post/5769587340/space-dragons"&gt;starting the project&lt;/a&gt;, it&amp;#8217;s already submitted to the app store.
To be fair, it relies a LOT on code developed for my previous game &lt;a href="http://www.bonuslevel.org/mozzle/"&gt;&lt;b style="font-size:200%"&gt;Mozzle&lt;/b&gt;&lt;/a&gt;.
&lt;br/&gt;&lt;br/&gt;
The game will be &lt;b style="font-size:200%"&gt;free&lt;/b&gt;, and actually, despite it&amp;#8217;s submitted to the app store, I consider it as a work in progress. A kind of public beta.
&lt;br/&gt;&lt;br/&gt;
Noel Llopis, the co-author of the fantastic iPad game &lt;a href="http://gamesfromwithin.com/caseys-contraptions-on-the-media"&gt;&amp;#8220;Casey&amp;#8217;s Contraption&amp;#8221;&lt;/a&gt;, would strongly &lt;a href="http://gamesfromwithin.com/all-it-needs-is-love"&gt;&lt;b style="font-size:150%"&gt;disagree on this early submission&lt;/b&gt;&lt;/a&gt;&amp;#8230; But you have to &lt;a href="http://www.nettserier.no/jellyvampire/1304892000/"&gt;&lt;b style="font-size:200%"&gt;think different&lt;/b&gt;&lt;/a&gt; if you want to be noticed on the app store, right? 
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:200%"&gt;Let&amp;#8217;s see what happens&amp;#8230;&lt;/b&gt;
&lt;br/&gt;&lt;br/&gt;
[update] It&amp;#8217;s available &lt;a href="http://bit.ly/spcdgns"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/5839981382</link><guid>http://jpsarda.tumblr.com/post/5839981382</guid><pubDate>Wed, 25 May 2011 15:37:00 -0400</pubDate></item><item><title>Space Dragons</title><description>&lt;p&gt;Just like the &lt;a href="http://www.bonuslevel.org/moonlights/"&gt;Moonlights&lt;/a&gt; project was started to understand how works the engine of &lt;a href="http://www.worldofgoo.com/"&gt;World of Goo&lt;/a&gt;, &lt;b&gt;Space Dragons&lt;/b&gt; was started to understand how this damn talented &lt;a href="http://www.andreasilliger.com/"&gt;Andreas Illiger&lt;/a&gt; made Tiny Wings.

&lt;br/&gt;&lt;br/&gt;
Once again the same story, the engine I&amp;#8217;ve done for &lt;b&gt;Space Dragons&lt;/b&gt; is quite good and I want to make a game of it (a mini game actually). A clone? I hope not, despite it&amp;#8217;s very close to Tiny Wings, it&amp;#8217;s my own style and and my own interpretation. And to be fair, it&amp;#8217;s far less good and fun than Tiny Wings.

&lt;br/&gt;&lt;br/&gt;
So here is a video (shot in the WC!) of the work in progress. If you wish to beta test it (you need an iPod 2ng gen+, iPhone 3GS+ or iPad+), subscribe to the &lt;a href="http://bit.ly/fTmv6N"&gt;test team on testflightapp.com&lt;/a&gt;.

&lt;br/&gt;&lt;br/&gt;&lt;iframe width="480" height="390" src="http://www.youtube.com/embed/7bkWuNh4srs?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

&lt;br/&gt;&lt;br/&gt;
As &lt;a href="http://www.cocos2d-iphone.org/forum/topic/14136"&gt;promised in the cocos2d forums&lt;/a&gt;, I&amp;#8217;ll post the code of the cocos2d/opengl object that renders the hills. I&amp;#8217;ll post on the cocos2d forums and on &lt;a href="http://twitter.com/jpsarda"&gt;my twitter&lt;/a&gt;.

&lt;br/&gt;&lt;br/&gt;
[update] It&amp;#8217;s available &lt;a href="http://bit.ly/spcdgns"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/5769587340</link><guid>http://jpsarda.tumblr.com/post/5769587340</guid><pubDate>Mon, 23 May 2011 12:21:00 -0400</pubDate></item><item><title>App Store Jurassic Search Engine</title><description>&lt;p&gt;I&amp;#8217;m not a SEO specialist. I will sum up here all that I&amp;#8217;ve learned about the prehistoric app store search engine.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:200%"&gt;1)&lt;/b&gt; The search engine don&amp;#8217;t take into account the app&amp;#8217;s description (it was once, but Apple was not able to cope with the spam inside the descriptions, and decided to stop processing it).
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:200%"&gt;2)&lt;/b&gt; The search engine takes into account the title.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:200%"&gt;3)&lt;/b&gt; The search engine takes into account the hidden list of keywords the developer enters during the submission process.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:200%"&gt;4)&lt;/b&gt; The search engine don&amp;#8217;t take into account plural forms. For example, if you want your app to be listed when searching for &amp;#8220;puzzle&amp;#8221; and &amp;#8220;puzzles&amp;#8221;, you have to enter &amp;#8220;puzzle,puzzles&amp;#8221; in your keyword. As we are limited to 100 characters in the keyword list, this is not ideal.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:200%"&gt;5)&lt;/b&gt; The rank order is based on popularity, something similar (but not exactly the same) to what is used to rank the top paid/free apps.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:200%"&gt;6)&lt;/b&gt; Your app will be rejected if it uses the title of another app as a keyword (example &amp;#8220;&lt;a href="http://www.bonuslevel.org/blockoban/"&gt;blockoban&lt;/a&gt;&amp;#8221;). But, if a game is using regular words from the dictionary in its title (like &amp;#8220;Angry birds&amp;#8221;, or &amp;#8220;Fruit ninja&amp;#8221;), you can add those words separately in your list (&amp;#8220;angry,birds,fruit,ninja&amp;#8221;).
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:200%"&gt;7)&lt;/b&gt; You can&amp;#8217;t change your keywords once your app is approved (you need to submit an update to do so).
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:200%"&gt;8)&lt;/b&gt; Never heard of an app reaching the top 10 because of having &amp;#8220;angry,birds&amp;#8221; in its keywords. Don&amp;#8217;t count on the app store search engine to increase your visibility. Making a good app with a good icon is the only recommandation.
&lt;br/&gt;&lt;br/&gt;
[updated 2011-05-23]&lt;br/&gt;&lt;b style="font-size:200%"&gt;9)&lt;/b&gt; Apple just improved the search engine. If your application provide in-app purchases, the search engine takes into account the in-app purchase displayed name.
&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/4805876423</link><guid>http://jpsarda.tumblr.com/post/4805876423</guid><pubDate>Thu, 21 Apr 2011 10:14:00 -0400</pubDate></item><item><title>Popular Meow vs Tiny Wings</title><description>&lt;p&gt;Recently I&amp;#8217;ve been obsessed with this popular video of 2 talented young boys singing &amp;#8220;Meow&amp;#8221; by &lt;a href="http://en.wikipedia.org/wiki/Gioachino_Rossini"&gt;Rossini&lt;/a&gt;. This song is pure genius and it is particularly well executed here. See below. 
&lt;br/&gt;&lt;iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/EjtVDG0drG0?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;br/&gt;
Then, wanting to know more about this song, I decided to have a look at &lt;a href="http://www.youtube.com/results?search_query=meow+rossini"&gt;other versions on youtube&lt;/a&gt;. I found a lot of videos. But despite it was the same song, none was providing the same happy feeling as the original. And I asked myself why&amp;#8230; &lt;b style="font-size:150%"&gt;Why this one gets millions of views on youtube, and this other one gets only hundreds?&lt;/b&gt; As a (game) designer, this was a matter I had to analyse.
&lt;br/&gt;&lt;!-- more --&gt;&lt;br/&gt;&lt;br/&gt;
I will spot a few things that came to my mind, that could explain why the video is much more popular than its counterparts. I &lt;b&gt;recommend watching a bit of all the videos to make your own analyse&lt;/b&gt;.
&lt;br/&gt;&lt;br/&gt;&lt;b style="font-size:200%"&gt;1) A lot of work&lt;/b&gt;. All the details of the performance have been clearly adjusted to the nearest millimeter. Maybe the same reason why &lt;a href="http://www.pocketgamer.co.uk/r/iPhone/Tiny+Wings/news.asp?c=27813"&gt;Tiny Wings is a #1 game on the appstore whereas Wavespark is almost unknwon&lt;/a&gt;. &lt;a href="http://www.andreasilliger.com/"&gt;Andreas Illiger&lt;/a&gt; developed the game solely over the course of 7 months. This is a LOT for a one-man project.
&lt;br/&gt;&lt;b style="font-size:200%"&gt;2) Experience&lt;/b&gt;. &amp;#8220;&lt;a href="http://en.wikipedia.org/wiki/Little_Singers_of_the_Wooden_Cross"&gt;Les petits chanteurs à la croix de bois&lt;/a&gt;&amp;#8221; have performed thousands of concerts (since 1907!). You rarely reach success at the first try. I&amp;#8217;m pretty sure Andreas Illiger has made many attempts before Tiny Wings. &lt;a href="http://www.andreasilliger.com/about.php"&gt;His about page&lt;/a&gt; is not yet filled, but we already know he&amp;#8217;s been working on &lt;a href="http://www.microsia.de/"&gt;this&lt;/a&gt; 2 years ago.
&lt;br/&gt;&lt;b style="font-size:200%"&gt;3) Cute&lt;/b&gt;. Those 2 boys are cute and charismatic. Just as the bird character in Tiny Wings.
&lt;br/&gt;&lt;b style="font-size:200%"&gt;4) Simple&lt;/b&gt;. The song is brilliant, no need to overplay (which is the main flaw in many of the other videos below). It&amp;#8217;s just done right. Just as Tiny Wings is a brilliant idea, done simple and right.
&lt;br/&gt;&lt;b style="font-size:200%"&gt;5) Popular&lt;/b&gt;. We hear a lot of people laughing inside the video, don&amp;#8217;t we? We see the 1M+ people having played this video on youtube don&amp;#8217;t we? Perceived popularity is a reason for something to become even more popular. That&amp;#8217;s the &lt;a href="http://en.wikipedia.org/wiki/Snowball_effect"&gt;snowball effect&lt;/a&gt;.   We, iOS game developers, know this better than anybody else, as being featured in the top paid apps gets you a huge amount of sales. So much sales that developers are ready to pay to reach artificially this spot, with services such as &lt;a href="http://appvip.com/"&gt;appvip&lt;/a&gt; and &lt;a href="http://tapjoy.com/"&gt;tapjoy&lt;/a&gt; (note that Apple has recently &lt;a href="http://venturebeat.com/2011/04/19/tapjoy-says-apple-has-banned-lucrative-pay-per-install-apps/"&gt;declared war to those services&lt;/a&gt;).
&lt;br/&gt;&lt;br/&gt;

So, you&amp;#8217;re still reading and you are about to watch those videos. Beware of not becoming obsessed like me with &amp;#8220;Meow&amp;#8221; by Rossini. This song can get stuck on your head.
&lt;br/&gt;&lt;iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/FqbJHTdoTac?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/YwZtEIPvd_Y?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/gQWdsI3OHwo?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/1SX-9k7lBpQ?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/JUYLi871dXM?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/kypwDcqIrDo?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;iframe title="YouTube video player" width="480" height="293" src="http://www.youtube.com/embed/Oipjdwy5nbI?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;br/&gt;&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/4773716299</link><guid>http://jpsarda.tumblr.com/post/4773716299</guid><pubDate>Wed, 20 Apr 2011 07:00:00 -0400</pubDate></item><item><title>iPhone beta tests with promocodes</title><description>&lt;p&gt;&lt;a href="http://testflightapp.com/"&gt;Testflightapp.com&lt;/a&gt; was launched a few months ago and has made it much easier for iOS developers to manage beta tests, and most important, for testers to install beta (AdHoc) builds. (&lt;i&gt;It has some limitations though, like unsupported iOS3.x&lt;/i&gt;).
&lt;br/&gt;&lt;br/&gt;
But there is another way that makes life even easier for testers: &lt;b&gt;promocodes&lt;/b&gt;. It&amp;#8217;s not very well known, but when your app is approved with a release date set in the future (thus, not available on the app store), downloads through promocodes still work. Just select up to 50 testers (who can be outside of the 100 AdHoc devices authorized by Apple) and send them one promocode each. Of course your app need to be in its latest development stages to be approved by Apple, which should be the case with beta tests. Most of iOS users already know how promocodes work, it makes it easier to convince a user to test your game.
&lt;br/&gt;&lt;br/&gt;
Testflighapp.com and promocodes are 2 complementary ways to manage your tests that you should know and use. For my &lt;strike&gt;upcoming&lt;/strike&gt; game &lt;a href="http://www.bonuslevel.org/mozzle/"&gt;Mozzle&lt;/a&gt;, both technics were used. Testflighapp.com was used all along the way and promocodes were used only in the latest stages. Both have provided very good feedback to improve the game.
&lt;br/&gt;&lt;br/&gt;&lt;i&gt;On a side note, submitting your app before it&amp;#8217;s totally finished will also prevent bad surprises when your app is rejected 2 days before the launch date.&lt;/i&gt;
&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/4463483299</link><guid>http://jpsarda.tumblr.com/post/4463483299</guid><pubDate>Sun, 10 Apr 2011 06:44:28 -0400</pubDate></item><item><title>Your Flixel game on iPad, not yet there</title><description>&lt;p&gt;&lt;a href="http://www.adobe.com/products/air/sdk/"&gt;AIR SDK 2.6&lt;/a&gt; was released a few days ago, with iOS packager included. It means you can now compile your Flixel (Flex) game with the AIR compiler and package it for your iPhone or iPad. &lt;br/&gt;&lt;br/&gt;

Porting my Flixel game &lt;a href="http://twitter.com/icualgame"&gt;Icual&lt;/a&gt; to the iPad was a matter of 1 hour (!). It works and it&amp;#8217;s playable. But unfortunately the performances are not yet there. There was a post+video recently about &lt;a href="http://johnlindquist.com/2011/03/29/flixel-on-the-ipad/"&gt;nice performances with Flixel+iPAD&lt;/a&gt;. The FPS (Frames Per Seconds) looks quite good on this video but it doesn&amp;#8217;t look suffisant for a proper release. Here is a video of Icual ported to the iPad. (Note that I had to remove the white flash effect when you win a level because it was slowing down the performances too much). As you see it works but for such a simple game with only a few bitmaps to move, you would expect a much better FPS.&lt;br/&gt;&lt;br/&gt;&lt;iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/ME9KDB5Qpuc?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

&lt;br/&gt;&lt;br/&gt;
Most of the tutorials I used to port the game on iPad uses Flex builder Burrito which is quite expensive. I used &lt;b&gt;Xcode&lt;/b&gt; (as I&amp;#8217;m on Mac OSX but FlashDevelop on windows will do the job) and the &lt;b&gt;command line&lt;/b&gt; only. All you need to pay is the iOS developer program (about 100$) for the final step. Here is how I did it.&lt;br/&gt;&lt;br/&gt;&lt;!-- more --&gt;

More infos about Flixel and Flex on this previous post about &lt;a href="http://jpsarda.tumblr.com/post/3807096732/get-your-flixel-game-on-blackberry-playbook"&gt;Flixel and the Playbook&lt;/a&gt;. The game &lt;a href="http://twitter.com/icualgame"&gt;Icual&lt;/a&gt; has been approved in the meanwhile and will be part of the Playbook app store (yeah). This tutorial is about porting the same game on the iPad.

First of all, you need to be a registered iOS developer to sign your package. A good tutorial &lt;a href="http://va.lent.in/blog/2011/03/25/air2-6-app-for-ios/"&gt;here&lt;/a&gt;.
&lt;br/&gt;
Then you need to compile your game. 
&lt;br/&gt;&lt;pre&gt;&lt;code&gt;
/[PATH TO FLEX SDK]/bin/amxmlc MyGame.as -o MyGameIPAD.swf
&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;
Then you need to provide a XML for the iOS packager that you will call MyGameIPAD-app.xml. Create a directory with the icons the iOS needs for your application and activate the GPU rendering for better performances.
&lt;br/&gt;
Here is the XML I used&amp;#160;:
&lt;br/&gt;&lt;pre&gt;&lt;code&gt;
&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt; 
&amp;lt;application xmlns="http://ns.adobe.com/air/application/2.6" minimumPatchLevel="0"&amp;gt; 
    &amp;lt;id&amp;gt;org.bonuslevel.IcualIPAD&amp;lt;/id&amp;gt; 
    &amp;lt;name&amp;gt;Icual&amp;lt;/name&amp;gt; 
    &amp;lt;versionNumber&amp;gt;0.0.1&amp;lt;/versionNumber&amp;gt; 
    &amp;lt;filename&amp;gt;IcualIPAD&amp;lt;/filename&amp;gt; 
    &amp;lt;supportedProfiles&amp;gt;mobileDevice&amp;lt;/supportedProfiles&amp;gt;
    &amp;lt;initialWindow&amp;gt; 
        &amp;lt;content&amp;gt;IcualIPAD.swf&amp;lt;/content&amp;gt; 
        &amp;lt;title&amp;gt;Icual&amp;lt;/title&amp;gt; 
		&amp;lt;aspectRatio&amp;gt;portrait&amp;lt;/aspectRatio&amp;gt;
		&amp;lt;autoOrients&amp;gt;false&amp;lt;/autoOrients&amp;gt;
		&amp;lt;fullScreen&amp;gt;true&amp;lt;/fullScreen&amp;gt;
		&amp;lt;renderMode&amp;gt;gpu&amp;lt;/renderMode&amp;gt;
		&amp;lt;softKeyboardBehavior&amp;gt;none&amp;lt;/softKeyboardBehavior&amp;gt;
		&amp;lt;visible&amp;gt;true&amp;lt;/visible&amp;gt;
		&amp;lt;width&amp;gt;768&amp;lt;/width&amp;gt;
		&amp;lt;height&amp;gt;1024&amp;lt;/height&amp;gt;
		&amp;lt;transparent&amp;gt;false&amp;lt;/transparent&amp;gt;
    &amp;lt;/initialWindow&amp;gt; 
    &amp;lt;icon&amp;gt; 
        &amp;lt;image29x29&amp;gt;iconsdirectory/icon29.png&amp;lt;/image29x29&amp;gt; 
        &amp;lt;image57x57&amp;gt;iconsdirectory/icon57.png&amp;lt;/image57x57&amp;gt; 
	&amp;lt;image72x72&amp;gt;iconsdirectory/icon72.png&amp;lt;/image72x72&amp;gt; 
	&amp;lt;image114x114&amp;gt;iconsdirectory/icon114.png&amp;lt;/image114x114&amp;gt; 
        &amp;lt;image512x512&amp;gt;iconsdirectory/icon512.png&amp;lt;/image512x512&amp;gt; 
    &amp;lt;/icon&amp;gt; 
	&amp;lt;iPhone&amp;gt;
    &amp;lt;InfoAdditions&amp;gt;
        &amp;lt;![CDATA[
            &amp;lt;key&amp;gt;UIDeviceFamily&amp;lt;/key&amp;gt;
            &amp;lt;array&amp;gt;
                &amp;lt;string&amp;gt;2&amp;lt;/string&amp;gt;
            &amp;lt;/array&amp;gt;
            &amp;lt;key&amp;gt;UIRequiresPersistentWiFi&amp;lt;/key&amp;gt;
            &amp;lt;string&amp;gt;NO&amp;lt;/string&amp;gt;
	    &amp;lt;key&amp;gt;UIApplicationExitsOnSuspend&amp;lt;/key&amp;gt;
	    &amp;lt;string&amp;gt;YES&amp;lt;/string&amp;gt;
        ]]&amp;gt;
    &amp;lt;/InfoAdditions&amp;gt;
	&amp;lt;/iPhone&amp;gt;
&amp;lt;/application&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;&lt;br/&gt;

Now you need one last step, package the .swf for iOS. This is the command line&amp;#160;:
&lt;br/&gt;&lt;pre&gt;&lt;code&gt;
/[PATH TO THE AIR SDK]/bin/adt -package -target ipa-debug -keystore yourioscertificat.p12 -storetype pkcs12 -storepass yourcertificatpassword -provisioning-profile YouProvisioningProfile.mobileprovision MyGameIPAD.ipa MyGameIPAD-app.xml IcualIPAD.swf iconsdirectory
&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;
Now you got a signed IPA that you can burn on your iPad with drag and drop in Xcode Organizer window.&lt;/p&gt;</description><link>http://jpsarda.tumblr.com/post/4392606630</link><guid>http://jpsarda.tumblr.com/post/4392606630</guid><pubDate>Wed, 06 Apr 2011 12:33:00 -0400</pubDate></item></channel></rss>
