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

<channel>
	<title>Nick Waynik.com &#187; Cocos2d</title>
	<atom:link href="http://nickwaynik.com/category/cocos2d/feed/" rel="self" type="application/rss+xml" />
	<link>http://nickwaynik.com</link>
	<description></description>
	<lastBuildDate>Wed, 07 Dec 2011 14:56:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Cocoaheads Pittsburgh</title>
		<link>http://nickwaynik.com/cocos2d/cocoaheads-pittsburgh/</link>
		<comments>http://nickwaynik.com/cocos2d/cocoaheads-pittsburgh/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 18:28:32 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Cocos2d]]></category>

		<guid isPermaLink="false">http://nickwaynik.com/?p=439</guid>
		<description><![CDATA[Here is the pdf version of the slides and a zip of the project. Intro To Cocos2D Slides TestApp Project]]></description>
			<content:encoded><![CDATA[<p>Here is the pdf version of the slides and a zip of the project.</p>
<p><a href="http://nickwaynik.com/code/IntroToCocos2d.pdf" target="_blank">Intro To Cocos2D Slides</a></p>
<p><a href="http://nickwaynik.com/code/TestApp.zip">TestApp Project</a></p>
]]></content:encoded>
			<wfw:commentRss>http://nickwaynik.com/cocos2d/cocoaheads-pittsburgh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Augmented Reality with Cocos2D</title>
		<link>http://nickwaynik.com/cocos2d/augmented-reality-with-cocos2d/</link>
		<comments>http://nickwaynik.com/cocos2d/augmented-reality-with-cocos2d/#comments</comments>
		<pubDate>Wed, 25 May 2011 12:27:07 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Cocos2d]]></category>
		<category><![CDATA[iOS Dev]]></category>

		<guid isPermaLink="false">http://nickwaynik.com/?p=424</guid>
		<description><![CDATA[A sample video of a tutorial I&#8217;m working on for Ray Wenderlich&#8217;s website.]]></description>
			<content:encoded><![CDATA[<p>A sample video of a tutorial I&#8217;m working on for <a href="http://www.raywenderlich.com/">Ray Wenderlich&#8217;s website</a>.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/X_MaMNIgRvU?hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/X_MaMNIgRvU?hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://nickwaynik.com/cocos2d/augmented-reality-with-cocos2d/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Most Unknown Feature of Cocos2d</title>
		<link>http://nickwaynik.com/cocos2d/most-unknown-feature-of-cocos2d/</link>
		<comments>http://nickwaynik.com/cocos2d/most-unknown-feature-of-cocos2d/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 13:09:37 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Cocos2d]]></category>

		<guid isPermaLink="false">http://nickwaynik.com/?p=336</guid>
		<description><![CDATA[The Cocos2d-iPhone website just posted an article on the samples that come with Cocos2d. This is probably THE best resource that a developer can have at their disposal. If you are using Cocos2d on the iPhone you definitely need to check out the sample code that comes with it. Here is the link to the [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.cocos2d-iphone.org/">Cocos2d-iPhone</a> website just posted an article on the samples that come with Cocos2d.  This is probably THE best resource that a developer can have at their disposal.  If you are using Cocos2d on the iPhone you definitely need to check out the sample code that comes with it.  </p>
<p>Here is the <a href="http://www.cocos2d-iphone.org/archives/663">link to the tutorial</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nickwaynik.com/cocos2d/most-unknown-feature-of-cocos2d/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CocosDenshion Sound Engine</title>
		<link>http://nickwaynik.com/iphonedev/cocosdenshion/</link>
		<comments>http://nickwaynik.com/iphonedev/cocosdenshion/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 15:04:02 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Cocos2d]]></category>
		<category><![CDATA[iPhoneDev]]></category>

		<guid isPermaLink="false">http://nickwaynik.com/?p=326</guid>
		<description><![CDATA[Version 0.99 of Cocos2d for the iPhone was just released this week. I am using the Cocos2d framework in my game, and wanted to post a short tutorial/sample code for the CocosDenshion sound engine that is shipping with the latest version. I am going to start off with the the basic Hello World example that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cocos2d-iphone.org/archives/598">Version 0.99 of Cocos2d</a> for the iPhone was just released this week.  I am using the Cocos2d framework in my game, and wanted to post a short tutorial/sample code for the CocosDenshion sound engine that is shipping with the latest version.  </p>
<p>I am going to start off with the the basic Hello World example that is created for you when you create a new Cocos2d project.<br />
</p>
<p>&nbsp;</p>
<p>
In the HelloWorld.h file add the following lines of code to import the needed files:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;SimpleAudioEngine.h&quot;</span>
<span style="color: #6e371a;">#import &quot;CocosDenshion.h&quot;</span>
<span style="color: #6e371a;">#import &quot;CDAudioManager.h&quot;</span></pre></td></tr></table></div>

<p></p>
<p>&nbsp;</p>
<p>
Now we will move to the HelloWorld.m file to add the rest of the code.  Inside the init method will will preload the background music so there is no lag when opening this layer.  Since we only have one layer, it makes no difference.  This will help when you have multiple layers in a game.  One thing to note, the backgroundMusicVolume can be set from the range of 0.0 to 1.0.  If you load a new background music file, you will need to set this again.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;">SimpleAudioEngine <span style="color: #002200;">*</span>sae <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>SimpleAudioEngine sharedEngine<span style="color: #002200;">&#93;</span>;
<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>sae <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
	<span style="color: #002200;">&#91;</span>sae preloadBackgroundMusic<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;mario-theme.mp3&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>sae.willPlayBackgroundMusic<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>		
		sae.backgroundMusicVolume <span style="color: #002200;">=</span> 0.5f;
	<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p></p>
<p>&nbsp;</p>
<p>
To play the background sound and other sounds use the following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Start the background music from the beginning and stop the background music</span>
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>SimpleAudioEngine sharedEngine<span style="color: #002200;">&#93;</span> playBackgroundMusic<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;mario-theme.mp3&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>SimpleAudioEngine sharedEngine<span style="color: #002200;">&#93;</span> stopBackgroundMusic<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// Mute and unmute all sounds</span>
<span style="color: #002200;">&#91;</span>CDAudioManager sharedManager<span style="color: #002200;">&#93;</span>.mute <span style="color: #002200;">=</span> TRUE;
<span style="color: #002200;">&#91;</span>CDAudioManager sharedManager<span style="color: #002200;">&#93;</span>.mute <span style="color: #002200;">=</span> FALSE;
&nbsp;
<span style="color: #11740a; font-style: italic;">// Pause and unpause the background music</span>
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>SimpleAudioEngine sharedEngine<span style="color: #002200;">&#93;</span> pauseBackgroundMusic<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>SimpleAudioEngine sharedEngine<span style="color: #002200;">&#93;</span> resumeBackgroundMusic<span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p></p>
<p>&nbsp;</p>
<p>
As you can see, CocosDenshion is very simple and easy to use.  More information on it can be <a href="http://www.cocos2d-iphone.org/wiki/doku.php/cocosdenshion:cookbook">found here.</a><br />
If you would like to see this in working action, then head on over to my github repository and download the sample project.<br />
<a href="http://github.com/ndubbs/CocosDenshion-Example">http://github.com/ndubbs/CocosDenshion-Example</a><br />
As always, comments are welcomed and greatly appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://nickwaynik.com/iphonedev/cocosdenshion/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

