<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>BlackBerry Developer Blog &#187; NME</title>
	<atom:link href="http://devblog.blackberry.com/tag/nme/feed/" rel="self" type="application/rss+xml" />
	<link>http://devblog.blackberry.com</link>
	<description></description>
	<lastBuildDate>Fri, 17 May 2013 17:47:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='devblog.blackberry.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/9ef0a66c09615fa946c4179662398878?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>BlackBerry Developer Blog &#187; NME</title>
		<link>http://devblog.blackberry.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://devblog.blackberry.com/osd.xml" title="BlackBerry Developer Blog" />
	<atom:link rel='hub' href='http://devblog.blackberry.com/?pushpress=hub'/>
		<item>
		<title>Building Your First Game Using NME</title>
		<link>http://devblog.blackberry.com/2012/11/game-development-nme/</link>
		<comments>http://devblog.blackberry.com/2012/11/game-development-nme/#comments</comments>
		<pubDate>Tue, 27 Nov 2012 14:21:11 +0000</pubDate>
		<dc:creator>Joshua Granick</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Native SDK Development]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[BlackBerry 10 Games]]></category>
		<category><![CDATA[BlackBerry PlayBook games]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[Haxe]]></category>
		<category><![CDATA[NME]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=12353</guid>
		<description><![CDATA[I know there are many choices when developing a game for the BlackBerry platform, but I wanted to share my favorite with you. If you have not heard of it before, NME is a free and open-source framework, designed to bring a unified feature set and native performance to many platforms, including the BlackBerry® PlayBook™ [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=12353&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p style="text-align:center;"><img class="aligncenter  wp-image-12362" title="josh" alt="TITLE_IMAGE" src="http://rimdevblog.files.wordpress.com/2012/11/josh.jpg?w=576&#038;h=383" height="383" width="576" /></p>
<p>I know there are many choices when developing a game for the BlackBerry platform, but I wanted to share my favorite with you. If you have not heard of it before, <a href="http://www.haxenme.org/" target="_new">NME</a> is a free and open-source framework, designed to bring a unified feature set and native performance to many platforms, including the BlackBerry® PlayBook™ tablet and BlackBerry® 10.</p>
<h3><strong>Defining a Project File</strong></h3>
<p>The first place to start when building an NME project is to make sure you have a project file. This will tell NME where your asset and source files are located, as well as meta-data like the application name, version and author.</p>
<p>Unlike other BlackBerry applications, you will not need to define a “bar-descriptor.xml” file later. NME will generate the file for you, based on the values in the NME project file.</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;project&gt;
&lt;meta title="Asterisk Game" package="com.testing.asteriskgame" version="1.0.0" company="Joshua Granick" /&gt;
&lt;app main="AsteriskGame" path="Export" /&gt;
	&lt;window width="800" height="600" unless="mobile" /&gt;
&lt;source path="Source" /&gt;
&lt;haxelib name="nme" /&gt;
&lt;haxelib name="actuate" /&gt;
	&lt;assets path="Assets" rename="assets" exclude="icon-*.png" /&gt;
&lt;icon path="Assets/icon-114.png" size="114" /&gt;
&lt;icon path="Assets/icon-86.png" size="86" /&gt;
&lt;/project&gt;</pre>
<p>You can find more details about the NMML format <a href="https://github.com/blackberry/NME/blob/master/tools/command-line-old/spec.nmml" target="_new">here</a>.</p>
<p><span id="more-12353"></span></p>
<h3><strong>Loading Assets</strong></h3>
<p>NME has an <i>Assets</i> class that makes it simple to load resource files. It accepts a path, based on the file structure of your project and the <i>&lt;assets /&gt;</i> nodes you include in the project file. You can use the <i>Assets</i> class to load bitmap data, bytes, font references, sounds and plain text synchronously.</p>
<p>If you need to load an asset asynchronously, such as from a remote server, you can use the NME <i>Loader</i> and <i>URLLoader</i> classes, which are outside the scope of this post.</p>
<h3><strong>Creating a Bitmap</strong></h3>
<pre>var bitmapData = Assets.getBitmapData (“assets/asterisk.png”);
var bitmap = new Bitmap (bitmapData);
addChild (bitmap);</pre>
<p>Unless you are creating a new bitmap in memory, the first step is to load an existing image asset from a file or a web server. In this sample, I am using an existing graphic called “asterisk.png”, which I have included in my project.</p>
<p>Once this process is complete, I will have the data for my bitmap, represented in NME by the <i>BitmapData</i> class. With a <i>BitmapData</i> object, I can use one of multiple rendering methods available. The simplest and most common is to create a <i>Bitmap</i> and add it to the “display list.” In NME, there is a tree of objects which are rendered automatically. By adding a display object to a parent that already is a member of the “display list,” it will be rendered as well. In this way, we can decide when our <i>Bitmap</i> is able to be rendered.</p>
<h3><strong>Adding Touch Interaction</strong></h3>
<p>It is exciting to get a bitmap on-screen, but in order to build a game we need to be able to handle touch interaction. Although a <i>Bitmap</i> has values like a position, size, scale and alpha (transparency), the <i>Bitmap</i> class cannot handle touch or mouse interaction.</p>
<p>The easiest way to add this support is to put our bitmap inside of a Sprite:</p>
<pre>var sprite = new Sprite ();
var bitmap = new Bitmap (Assets.getBitmapData (“assets/asterisk.png”));
sprite.addChild (bitmap);
addChild (sprite);</pre>
<p>The <i>Sprite</i> class is one of the most common classes in NME development. In addition to being a <i>DisplayObject</i>, like the <i>Bitmap</i> class, a <i>Sprite</i> instance can contain other objects. The <i>Sprite</i> class also supports dispatches touch and mouse events, which is what we are looking for.</p>
<pre>sprite.addEventListener (MouseEvent.MOUSE_DOWN, function (event) { bitmap.visible = false; });</pre>
<p>Adding an event listener makes it possible to respond when an event occurs on the objects, such as the <i>MouseEvent.MOUSE_DOWN</i> event.</p>
<p>NME supports a touch-specific API, but most applications will only need to listen to standard mouse events. These will work with touch screens as well as traditional desktop and laptop systems, making it simpler for your project to run on multiple form-factors.</p>
<h3><strong>Playing Sound</strong></h3>
<pre>var sound = Assets.getSound ("assets/fuzz.wav");
sound.play ();</pre>
<p>Loading a <i>Sound</i> is simple, thanks to the NME <i>Assets</i> class. Then you can call play to your sound.</p>
<p>Internally, NME is using SDL_mixer on BlackBerry to play audio. This provides excellent support for many file formats, but also presents some restrictions. SDL_mixer supports one streaming “music” channel at once and multiple event “sound” channels simultaneously. NME will try to automatically detect whether a file is “music” or “sound” based on the file extension, but this can be controlled manually in your NMML project file.</p>
<p>SDL_mixer only supports MP3 in the “music” channel, while other formats, such as OGG and WAV, can be used for “sound”. This is a limitation to be aware of, especially if you are using MP3 files.</p>
<h3><strong>Download the Sample</strong></h3>
<p>You can download the “Asterisk Game,” a small sample that uses these features to make a simple “whack-a-mole” style game. Asterisks will appear on screen, and the player taps the asterisks to make them disappear until time runs out. The score is based on the number of asterisks the player is able to tap before they fade on their own, and bonus points are awarded based on the size of the asterisk – smaller asterisks are worth more points.</p>
<p>If you appreciated this tutorial and would like to learn more about NME, please sound off in the comments!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/12353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/12353/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=12353&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2012/11/game-development-nme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfbe0800e72c5d771f9fef2ea4f941e9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">singmajesty</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/11/josh.jpg" medium="image">
			<media:title type="html">josh</media:title>
		</media:content>
	</item>
		<item>
		<title>Fast, Native Games for BlackBerry (without C/C++)</title>
		<link>http://devblog.blackberry.com/2012/09/fast-native-games-for-blackberry-without-cc/</link>
		<comments>http://devblog.blackberry.com/2012/09/fast-native-games-for-blackberry-without-cc/#comments</comments>
		<pubDate>Sat, 08 Sep 2012 00:26:01 +0000</pubDate>
		<dc:creator>Joshua Granick</dc:creator>
				<category><![CDATA[Adobe AIR Development]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Editorials]]></category>
		<category><![CDATA[Game Development]]></category>
		<category><![CDATA[adobe air]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[NME]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=10959</guid>
		<description><![CDATA[Developers like Retro64 Inc, Artificial Games and Innivo have brought their titles to BlackBerry® in record time. For Ido Yehieli, this meant an increase in performance of &#8220;more than 10 times compared to using Adobe AIR&#8221; with only a few small changes to his code. How was this possible? NME is a fast, cross-platform framework [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=10959&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div id="attachment_10961" class="wp-caption aligncenter" style="width: 610px"><a href="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f52756e65526169646572732e706e67.png"><img class="size-full wp-image-10961" title="687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f52756e65526169646572732e706e67" src="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f52756e65526169646572732e706e67.png?w=600&#038;h=200" alt="TITLE_IMAGE" width="600" height="200" /></a><p class="wp-caption-text">Fight the bad guys in <a href="http://appworld.blackberry.com/webstore/content/133724/">Rune Raiders,</a> an exciting, easy-to-learn adventure game.</p></div>
<p>Developers like Retro64 Inc, Artificial Games and Innivo have brought their titles to BlackBerry® in record time. For Ido Yehieli, this meant an increase in performance of &#8220;more than 10 times compared to using Adobe AIR&#8221; with only a few small changes to his code. How was this possible?</p>
<p>NME is a fast, cross-platform framework for rapid game and application development. Unlike other libraries, NME does not require that you write native code. It does not use a virtual machine or a scripting language. NME uses a language called Haxe to convert your code to C++ and OpenGL, with amazing results.</p>
<p><span id="more-10959"></span></p>
<p>BunnyMark is a popular benchmark for Flash Player. Testing on a BlackBerry® PlayBook™, Adobe AIR rendered 500 bunnies @ 11 FPS. Using NME, the same device rendered an astonishing 5250 bunnies @ 30 FPS. NME applications are significantly faster than AIR (with or without Stage3D) and are comparable to applications built with other native frameworks.</p>
<div id="attachment_10962" class="wp-caption aligncenter" style="width: 610px"><a href="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f4d724e6962626c65732e706e671.png"><img class="size-full wp-image-10962" title="687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f4d724e6962626c65732e706e67" src="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f4d724e6962626c65732e706e671.png?w=600&#038;h=275" alt="" width="600" height="275" /></a><p class="wp-caption-text">Help <a href="http://appworld.blackberry.com/webstore/content/133542/">Mr Nibbles</a> solve devious puzzles and become the first hamster to enter orbit!</p></div>
<p>In addition to native, NME also supports publishing for Flash and beta support for HTML5. This offers a unique opportunity to create games that are optimized for the web, desktop and mobile, using a single codebase.</p>
<blockquote><p>&#8220;I just tried [NME] today &#8211; super impressive. One codebase, compiled straight away &#8230; 60FPS!&#8221; <em>- James Frost</em></p></blockquote>
<p>This flexibility also enables support for BlackBerry OS 6 and 7 devices. Since they are unable to run native C/C++ applications, they can be supported using HTML5, Apache Cordova and BlackBerry® WebWorks™.</p>
<div id="attachment_10963" class="wp-caption aligncenter" style="width: 610px"><a href="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f50616b6b756d616e2e706e67.png"><img class="size-full wp-image-10963" title="687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f50616b6b756d616e2e706e67" src="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f50616b6b756d616e2e706e67.png?w=600&#038;h=275" alt="" width="600" height="275" /></a><p class="wp-caption-text"><a href="http://appworld.blackberry.com/">Pakkuman&#8217;s Defense</a> is a fun and satisfying mix of Pac-Man and tower defense.</p></div>
<p>It is simple to build a game using NME. For anyone who already knows Flash, NME is an instant transition. Other developers will find that the API and language are still easy to learn.</p>
<p>Haxe shares roots with ECMAScript languages like Actionscript and Javascript, but supports more features such as conditional compilation, type inference, typedefs, enums, generics, iterators and compiler macros. Haxe also has a vibrant and helpful developer community.</p>
<blockquote><p>&#8220;I think making this game in Haxe/NME is about as inspired as I&#8217;ve been as a developer for a long time. Really exciting.&#8221; <em>- Andreas Rønning</em></p></blockquote>
<p>Many popular libraries are available for NME, like Flixel, HaxePunk, awe6, Nape and Box2D. NME also supports native C/C++ extensions.</p>
<div id="attachment_10964" class="wp-caption aligncenter" style="width: 610px"><a href="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f4d616b65415363656e652e706e67.png"><img class="size-full wp-image-10964" title="687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f4d616b65415363656e652e706e67" src="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f4d616b65415363656e652e706e67.png?w=600&#038;h=275" alt="" width="600" height="275" /></a><p class="wp-caption-text">Children love to create with <a href="https://appworld.blackberry.com/webstore/content/125479/">Make A Scene: Farmyard</a>, <a href="https://appworld.blackberry.com/webstore/content/125481/">Make A Scene: Under The Sea</a>, <a href="https://appworld.blackberry.com/webstore/content/125480/">Make A Scene: Safari</a>, <a href="https://appworld.blackberry.com/webstore/content/125484/">Make A Scene: Outer Space</a>, <a href="https://appworld.blackberry.com/webstore/content/127802/">Make A Scene: Polar Adventure</a>, <a href="https://appworld.blackberry.com/webstore/content/127798/">Make A Scene: Jungle</a> and <a href="https://appworld.blackberry.com/webstore/content/127804/">Make A Scene: Princess Fairy Tales</a>.</p></div>
<p>NME is available free for Windows, Mac and Linux: <a href="http://www.haxenme.org/download">http://www.haxenme.org/download</a>.</p>
<p>If you have more questions about Haxe or NME, or would like to learn more about how to build your own native BlackBerry games using the framework, let us know with your comments!</p>
<p><a href="http://rimdevblog.files.wordpress.com/2012/09/bbjam_americas_450x150_emailsig_logomap.jpg"><img title="BBJam_Americas_450x150_EmailSig_LogoMap" src="http://rimdevblog.files.wordpress.com/2012/09/bbjam_americas_450x150_emailsig_logomap.jpg?w=450&#038;h=150" alt="" width="450" height="150" /></a></p>
<p><strong>BlackBerry Jam Americas – Sept 25-27, San Jose CA</strong></p>
<p>BlackBerry® Jam Americas 2012 is a showcase for the bold, new direction BlackBerry is heading with the upcoming BlackBerry® 10 platform. The event attracts developers and industry leaders who understand the power of BlackBerry and want to build their success with the platform. Whether you&#8217;re a Native, Web, or Android™ developer, don&#8217;t miss this opportunity to explore the powerful, game-changing BlackBerry 10 platform.</p>
<p>Join us, September 25-27 in San Jose, California. <a href="http://www.blackberryjamconference.com/americas/register%20?CPID=OTC-2012BBJAMAM03">Register Now</a> and use promo code DJAA45 to register for only $299.00</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/10959/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/10959/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=10959&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2012/09/fast-native-games-for-blackberry-without-cc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cfbe0800e72c5d771f9fef2ea4f941e9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">singmajesty</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f52756e65526169646572732e706e67.png" medium="image">
			<media:title type="html">687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f52756e65526169646572732e706e67</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f4d724e6962626c65732e706e671.png" medium="image">
			<media:title type="html">687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f4d724e6962626c65732e706e67</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f50616b6b756d616e2e706e67.png" medium="image">
			<media:title type="html">687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f50616b6b756d616e2e706e67</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/09/687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f4d616b65415363656e652e706e67.png" medium="image">
			<media:title type="html">687474703a2f2f7777772e6a6f736875616772616e69636b2e636f6d2f75706c6f61642f4d616b65415363656e652e706e67</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2012/09/bbjam_americas_450x150_emailsig_logomap.jpg" medium="image">
			<media:title type="html">BBJam_Americas_450x150_EmailSig_LogoMap</media:title>
		</media:content>
	</item>
	</channel>
</rss>
