<?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>DrMop &#187; Blackberry Playbook App Development</title>
	<atom:link href="http://www.drmop.com/index.php/categories/programming/game-and-app-development/blackberry-playbook-app-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.drmop.com</link>
	<description>Mobile Game and App Programming Tutorials</description>
	<lastBuildDate>Sat, 19 May 2012 22:16:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Marmalade SDK 6.0.2 Released</title>
		<link>http://www.drmop.com/index.php/2012/05/11/marmalade-sdk-6-0-2-released/</link>
		<comments>http://www.drmop.com/index.php/2012/05/11/marmalade-sdk-6-0-2-released/#comments</comments>
		<pubDate>Fri, 11 May 2012 14:51:39 +0000</pubDate>
		<dc:creator>drmop</dc:creator>
				<category><![CDATA[AirPlay SDK]]></category>
		<category><![CDATA[Android App Development]]></category>
		<category><![CDATA[Blackberry Playbook App Development]]></category>
		<category><![CDATA[C++ Programming]]></category>
		<category><![CDATA[Game and App Development]]></category>
		<category><![CDATA[iOS App Development]]></category>
		<category><![CDATA[Marmalade SDK]]></category>
		<category><![CDATA[Samsung Bada Development]]></category>
		<category><![CDATA[Marmalade SDK Update 6.0.2]]></category>

		<guid isPermaLink="false">http://www.drmop.com/?p=1667</guid>
		<description><![CDATA[Marmalade have just released 6.0.2 of their awesome SDK. Looking at the change list there are some very welcome bug fixes: Exporters: Added support for Maya 2013 and Max 2012 iOS: touches are no longer passed to the surface below the web view iOS: s3eOSReadString now handles split keyboards correctly iOS: added s3eEdkAppGetInitialOpenURL to get [...]]]></description>
			<content:encoded><![CDATA[<p>Marmalade have just released 6.0.2 of their <a title="Marmalade SDK download 6.0.2 update" href="https://www.madewithmarmalade.com/downloads" rel="nofollow" target="_blank">awesome SDK</a>. Looking at the change list there are some very welcome bug fixes:</p>
<ul>
<li>Exporters: Added support for Maya 2013 and Max 2012</li>
<li>iOS: touches are no longer passed to the surface below the web view</li>
<li>iOS: s3eOSReadString now handles split keyboards correctly</li>
<li>iOS: added s3eEdkAppGetInitialOpenURL to get the initial open URL</li>
<li>android: fixed icf splash screens when fixing rotation</li>
<li>playbook: s3eOSReadString now cancels properly</li>
<li>IwHTTP: fixed to work without threads</li>
<li>Added menu options to Windows simulator for Retina display</li>
<li>OSX: fixed to make building extensions possible</li>
<li>Android splash fixed when using dispfixrot=2</li>
<li>android: building of EDK modules</li>
<li>ios: WebView orientation (IwGX and s3eWebView) on iPad</li>
<li>android: fixed crash with image property in CImagePtr when loading a png file</li>
</ul>
<p>There is however a crash issue with Bada builds</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drmop.com/index.php/2012/05/11/marmalade-sdk-6-0-2-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Yet another IwGame Engine UI Progress Update</title>
		<link>http://www.drmop.com/index.php/2012/05/09/yet-another-iwgame-engine-ui-progress-update/</link>
		<comments>http://www.drmop.com/index.php/2012/05/09/yet-another-iwgame-engine-ui-progress-update/#comments</comments>
		<pubDate>Wed, 09 May 2012 23:37:57 +0000</pubDate>
		<dc:creator>drmop</dc:creator>
				<category><![CDATA[Android App Development]]></category>
		<category><![CDATA[Apps]]></category>
		<category><![CDATA[Blackberry Playbook App Development]]></category>
		<category><![CDATA[C++ Programming]]></category>
		<category><![CDATA[Cool news]]></category>
		<category><![CDATA[Game and App Development]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[iOS App Development]]></category>
		<category><![CDATA[IwGame Engine]]></category>
		<category><![CDATA[Pocketeers Limited]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Samsung Bada Development]]></category>
		<category><![CDATA[IwGame Engine UI]]></category>

		<guid isPermaLink="false">http://www.drmop.com/?p=1641</guid>
		<description><![CDATA[Not had a great deal of spare time to spend on the UI this week but did manage to get a few cool things in there including: Scrolling grids Scrolling list boxes Horizontal list boxes 9-patch brushes Child element sizing based on percentage of parent Child clipping Grid per column bindings Dynamic resizing of elements, [...]]]></description>
			<content:encoded><![CDATA[<p>Not had a great deal of spare time to spend on the UI this week but did manage to get a few cool things in there including:</p>
<ul>
<li>Scrolling grids</li>
<li>Scrolling list boxes</li>
<li>Horizontal list boxes</li>
<li>9-patch brushes</li>
<li>Child element sizing based on percentage of parent</li>
<li>Child clipping</li>
<li>Grid per column bindings</li>
<li>Dynamic resizing of elements, grids and list boxes will automatically re-layout child elements to make use of extra space</li>
<li>UI elements can allow touch events to bubble up to parent elements allowing them to also receive the same events</li>
<li>Tidied up the UI input system</li>
<li>4 parameter skewing &#8211;  See the wonky text on the large and small buttons for an example</li>
</ul>
<p>Heres a quick screen shot showing the current UI demo:</p>
<div id="attachment_1640" class="wp-caption aligncenter" style="width: 1034px"><a href="http://www.drmop.com/wp-content/uploads/2012/05/ui1.jpg"><img class="size-full wp-image-1640" title="More Advanced IwGame Engine UI" src="http://www.drmop.com/wp-content/uploads/2012/05/ui1.jpg" alt="More Advanced IwGame Engine UI Screen Shot" width="1024" height="768" /></a><p class="wp-caption-text">More Advanced IwGame Engine UI Screen Shot</p></div>
<p>Those frogs look happy to be sat in that list box like that <img src='http://www.drmop.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And here&#8217;s a new and better video showing the new UI <a href="http://www.youtube.com/watch?v=IhtT_e5u8gU" target="_blank" rel="nofollow">http://www.youtube.com/watch?v=IhtT_e5u8gU</a></p>
<p>I hope to spend a few additional weeks on implementing more UI controls such as sliders and tab vies etc.. before we released 0.35.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drmop.com/index.php/2012/05/09/yet-another-iwgame-engine-ui-progress-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IwGame UI Progress Update</title>
		<link>http://www.drmop.com/index.php/2012/05/04/iwgame-ui-progress-update/</link>
		<comments>http://www.drmop.com/index.php/2012/05/04/iwgame-ui-progress-update/#comments</comments>
		<pubDate>Fri, 04 May 2012 11:24:47 +0000</pubDate>
		<dc:creator>drmop</dc:creator>
				<category><![CDATA[Android App Development]]></category>
		<category><![CDATA[Apps]]></category>
		<category><![CDATA[Blackberry Playbook App Development]]></category>
		<category><![CDATA[C++ Programming]]></category>
		<category><![CDATA[Cool news]]></category>
		<category><![CDATA[Game and App Development]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[iOS App Development]]></category>
		<category><![CDATA[IwGame Engine]]></category>
		<category><![CDATA[Pocketeers Limited]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Samsung Bada Development]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[IwGame Engine UI]]></category>
		<category><![CDATA[User interface]]></category>

		<guid isPermaLink="false">http://www.drmop.com/?p=1577</guid>
		<description><![CDATA[Got a quick update showing how the IwGame engines UI system is shaping up. Note that the UI system is &#8220;bitmap&#8221; based and IwGame does not draw things like buttons, grids etc.. manually. Here&#8217;s a quick screen shot at iPad resolution showing some basic UI: This is just a static image however, so you cannot [...]]]></description>
			<content:encoded><![CDATA[<p>Got a quick update showing how the IwGame engines UI system is shaping up. Note that the UI system is &#8220;bitmap&#8221; based and IwGame does not draw things like buttons, grids etc.. manually. Here&#8217;s a quick screen shot at iPad resolution showing some basic UI:</p>
<div id="attachment_1578" class="wp-caption aligncenter" style="width: 1034px"><a href="http://www.drmop.com/wp-content/uploads/2012/05/ui.jpg"><img class="size-full wp-image-1578" title="Basic IwGame Engine UI" src="http://www.drmop.com/wp-content/uploads/2012/05/ui.jpg" alt="Basic IwGame Engine UI Screenshot" width="1024" height="768" /></a><p class="wp-caption-text">Basic IwGame Engine UI Screenshot</p></div>
<p>This is just a static image however, so you cannot really see the animation that&#8217;s built into the UI, for that you need to take a look at a quick video I stuck together showing the UI in action at <a title="iwGame Engine Basic UI Video" href="http://www.youtube.com/watch?v=oV3kYLbzcKo" rel="nofollow" target="_blank">http://www.youtube.com/watch?v=oV3kYLbzcKo</a></p>
<p>&nbsp;</p>
<p>The UI itself consists of the following elements:</p>
<ul>
<li> StackPanels &#8211; The top left hand control is a vertical stack panel containing 3 horizontal stack panels. Each horizontal stack panel contains multiple basic UI components including buttons, labels and text input boxes. The check boxes and the long named button are toggle buttons. The top stack panel and the components within the panel have been draggable so they can be dragged away from the stack panel and moved around. Tapping the Expert check box will spin the control 360 degrees using an animation time line. One of the buttons and two of the check boxes also have animation time lines applied to them.</li>
<li>Grid &#8211; The control to the bottom left is a 3&#215;4 grid that contains 12 items. These items are simple label buttons that when tapped will animate. A XOML array variable is bound to the grid and data from the array is moved into the grid. Updating the XOML array will automatically update the grid elements. The types of elements within the grid are defined using an item template. You can create a grid manually by adding components directly to the grid in XOML or in code bypassing the binding system. This allows you to create more complex controls within each grid cell. Tapping an item in the grid will set it animating</li>
<li>List box &#8211; The list box to the top right work on the same principles as the grid where data is bound to the list box and a template can be specified that defnies the type of items. This list box is a multi-select list box which allows you to select multiple  items</li>
<li>List Box 2 &#8211; The list box to the bottom right is more complex list box that shows list items using a more complex control. The list box items in this instance are created using a horizontal stack panel, which contains a label and a button. The list box is a single item selection list box</li>
</ul>
<p>The UI controls themselves can be moved around and placed anywhere in the scene. the whole scene can also be moved around.</p>
<p>To give you an idea as to how the XOML looks, here&#8217;s a short code clip showing the XOL that creates the list box to the upper right of the screen:</p>
<pre>   <span style="color: #008000;"> &lt;!-- Create a listbox --&gt; </span>
    <span style="color: #008000;">&lt;!-- ListBoxItems - Defines a list of items that will be bound to the list box --&gt;</span>
    &lt;<span style="color: #0000ff;">Variable</span> Name="ListBoxItems" Type="arraystring" Size="4" Value="Item 1, Item 2, Item 3, Item 4" /&gt;
    <span style="color: #008000;">&lt;!-- Create a template that will be used to generate the list box actors --&gt;</span>
    &lt;<span style="color: #0000ff;">Template</span> Name="ListBoxItemTemp"&gt;
        &lt;Label Name="ListItem$index$" Background="ListBoxItemBrush" BackgroundColour="200, 200, 200, 255" SelectedColour="80, 80, 255, 255" Font="trebuchet_12" TextColour="255, 255, 255, 255" SelectedTextColour="255, 255, 255, 255" Margin="0, 0, 20, 0" SelectType="toggle" Selected="false" /&gt;
    &lt;/<span style="color: #0000ff;">Template</span>&gt;
    &lt;<span style="color: #0000ff;">ListBox</span> Name="ListBox" Position="351, -190" Background="ListBoxBrush" MultiSelect="true" <span style="color: #ff00ff;">ItemsData="ListBoxItems"</span> <span style="color: #ff00ff;">ItemsTargetType="text"</span> ItemsTemplate="<span style="color: #ff00ff;">ListBoxItemTemp"</span> HitTest="true" Draggable="true" /&gt;</pre>
<p>&nbsp;</p>
<p>As you can see its pretty straight forward:</p>
<ul>
<li>We create an array string variable and assign it the data that will be bound to the list box</li>
<li>We create a template that represents our items</li>
<li>We create a list box that uses the template and data and make it draggable</li>
</ul>
<p>Well that&#8217;s it for now. We will be adding more and more features to the UI over the coming weeks and will keep you updated.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drmop.com/index.php/2012/05/04/iwgame-ui-progress-update/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Pocketeers Limited is taking on New Mobile Projects</title>
		<link>http://www.drmop.com/index.php/2012/05/03/pocketeers-limited-new-mobile-projects/</link>
		<comments>http://www.drmop.com/index.php/2012/05/03/pocketeers-limited-new-mobile-projects/#comments</comments>
		<pubDate>Thu, 03 May 2012 14:05:55 +0000</pubDate>
		<dc:creator>drmop</dc:creator>
				<category><![CDATA[Android App Development]]></category>
		<category><![CDATA[Apps]]></category>
		<category><![CDATA[Blackberry Playbook App Development]]></category>
		<category><![CDATA[Cool news]]></category>
		<category><![CDATA[Digital Publishing]]></category>
		<category><![CDATA[Game and App Development]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[iOS App Development]]></category>
		<category><![CDATA[IwGame Engine]]></category>
		<category><![CDATA[Marmalade SDK]]></category>
		<category><![CDATA[Nintendo]]></category>
		<category><![CDATA[Pocketeers Limited]]></category>
		<category><![CDATA[Samsung Bada Development]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Game projects wanted]]></category>
		<category><![CDATA[Mobile projects]]></category>

		<guid isPermaLink="false">http://www.drmop.com/?p=1568</guid>
		<description><![CDATA[&#160; Need a mobile game or app developed across multiple platforms (iPhone, iPad, Andriod,Bada, PlayBook etc..) at little extra cost? Or maybe you need a rapid prototype of your next game or app idea creating as proof of concept? Pocketeers Limited a UK based mobile app and game developer (established in 2002) responsible for the [...]]]></description>
			<content:encoded><![CDATA[<p><!--adsandwich--><br />
<div id="attachment_1569" class="wp-caption aligncenter" style="width: 266px"><a href="http://www.drmop.com/wp-content/uploads/2012/05/Pocketeers_Logo_256x256.png"><img class="size-full wp-image-1569" title="Pocketeers_Logo_256x256" src="http://www.drmop.com/wp-content/uploads/2012/05/Pocketeers_Logo_256x256.png" alt="Pocketeers Limited Mobile Developer Logo" width="256" height="256" /></a><p class="wp-caption-text">Pocketeers Limited Mobile Developer</p></div></p>
<p>&nbsp;</p>
<p>Need a mobile game or app developed across multiple platforms (iPhone, iPad, Andriod,Bada, PlayBook etc..) at little extra cost? Or maybe you need a rapid prototype of your next game or app idea creating as proof of concept?</p>
<p>Pocketeers Limited a UK based mobile app and game developer (established in 2002) responsible for the creation of the IwGame Engine are looking to take on additional gaming and app projects. Pocketeers will consider any size project, but will favour those projects that utilise the IwGame engine / Marmalade SDK. Pocketeers have worked with clients large and small including the likes of Electronic Arts, Destination Software, Ideaworks, Honey Badger Studios, Tournay Software, and others.  Pocketeers provide a full range of services including design, coding, art work, audio and testing at very competitive prices.</p>
<p>For more details you can contact Pocketeers Limited via the web at <a href="http://www.pocketeers.co.uk/?page_id=8">http://www.pocketeers.co.uk/?page_id=8</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.drmop.com/index.php/2012/05/03/pocketeers-limited-new-mobile-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Marmalade Job Post &#8211; Playalla Need Word Game Developer</title>
		<link>http://www.drmop.com/index.php/2012/04/30/marmalade-job-post-playalla-need-word-game-developer/</link>
		<comments>http://www.drmop.com/index.php/2012/04/30/marmalade-job-post-playalla-need-word-game-developer/#comments</comments>
		<pubDate>Mon, 30 Apr 2012 09:41:27 +0000</pubDate>
		<dc:creator>drmop</dc:creator>
				<category><![CDATA[AirPlay SDK]]></category>
		<category><![CDATA[Android App Development]]></category>
		<category><![CDATA[Blackberry Playbook App Development]]></category>
		<category><![CDATA[C++ Programming]]></category>
		<category><![CDATA[Cool news]]></category>
		<category><![CDATA[iOS App Development]]></category>
		<category><![CDATA[Marmalade SDK]]></category>
		<category><![CDATA[Marmalade SDK Jobs]]></category>
		<category><![CDATA[Samsung Bada Development]]></category>
		<category><![CDATA[Marmalade SDK Job]]></category>

		<guid isPermaLink="false">http://www.drmop.com/?p=1540</guid>
		<description><![CDATA[Hi Everyone, Another job posting has come across my desk recently so here it is. A new start-up called Playalla is seeking a  C/C++ Marmalade SDK developer for a short term contract (around 3 months) to help them finish their word games. Playalla already have a prototype of their game up and running based on [...]]]></description>
			<content:encoded><![CDATA[<p>Hi Everyone,</p>
<p>Another job posting has come across my desk recently so here it is. A new start-up called Playalla is seeking a  C/C++ Marmalade SDK developer for a short term contract (around 3 months) to help them finish their word games. Playalla already have a prototype of their game up and running based on match-3 game play. Ideally they are looking for a developer that has previous experience with creating word games. The work can be carried out remotely so is ideal for a freelance game developer.</p>
<p>If you are interested then please send a few details about yuorself, your experience (games released etc..) to Wissam at <a href="mailto:wissamharoun@hotmail.com">wissamharoun@hotmail.com</a></p>
<p>Mat</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drmop.com/index.php/2012/04/30/marmalade-job-post-playalla-need-word-game-developer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Marmalade Job Post &#8211; BeInToo Need A Developer</title>
		<link>http://www.drmop.com/index.php/2012/04/27/marmalade-job-post-beintoo-need-a-developer/</link>
		<comments>http://www.drmop.com/index.php/2012/04/27/marmalade-job-post-beintoo-need-a-developer/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 19:35:57 +0000</pubDate>
		<dc:creator>drmop</dc:creator>
				<category><![CDATA[AirPlay SDK]]></category>
		<category><![CDATA[Android App Development]]></category>
		<category><![CDATA[Blackberry Playbook App Development]]></category>
		<category><![CDATA[C++ Programming]]></category>
		<category><![CDATA[Game and App Development]]></category>
		<category><![CDATA[iOS App Development]]></category>
		<category><![CDATA[Marmalade SDK]]></category>
		<category><![CDATA[Marmalade SDK Jobs]]></category>
		<category><![CDATA[Samsung Bada Development]]></category>
		<category><![CDATA[Marmalade SDK Job]]></category>

		<guid isPermaLink="false">http://www.drmop.com/?p=1525</guid>
		<description><![CDATA[Hi Everyone. The guys over at http://www.beintoo.com/ that developed the awesome BeInToo gamification and rewarding technology are looking for a capable Marmalade SDK developer that can use the EDK to bring their SDK over to Marmalade. If you know your way around the EDK and know enough about the Android / iPhone SDK&#8217;s then you should probably get [...]]]></description>
			<content:encoded><![CDATA[<p>Hi Everyone.</p>
<p>The guys over at <a href="http://www.beintoo.com/" rel="nofollow" target="_parent">http://www.beintoo.com/</a> that developed the awesome BeInToo gamification and rewarding technology are looking for a capable Marmalade SDK developer that can use the EDK to bring their SDK over to Marmalade. If you know your way around the EDK and know enough about the Android / iPhone SDK&#8217;s then you should probably <a href="http://www.beintoo.com/contacts.html" rel="nofollow" target="_parent">get in touch.</a></p>
<p>The work can be carried out remotely and does not have to be done on-site which is great for freelance developers.</p>
<p>You can take a quick look at the RESTful API to see what the SDK is all about <a href="http://documentation.beintoo.com/" rel="nofollow" target="_parent">http://documentation.beintoo.com/</a></p>
<p>Good luck</p>
<p>Mat</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drmop.com/index.php/2012/04/27/marmalade-job-post-beintoo-need-a-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IwGame Engine v0.34 Released &#8211; Modifiers, Box2D Joints and Marmalade 6.0 fix</title>
		<link>http://www.drmop.com/index.php/2012/04/17/iwgame-engine-v0-34-released-modifiers-box2d-joints-and-marmalade-6-0-fix/</link>
		<comments>http://www.drmop.com/index.php/2012/04/17/iwgame-engine-v0-34-released-modifiers-box2d-joints-and-marmalade-6-0-fix/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 17:23:33 +0000</pubDate>
		<dc:creator>drmop</dc:creator>
				<category><![CDATA[AirPlay SDK]]></category>
		<category><![CDATA[Android App Development]]></category>
		<category><![CDATA[Blackberry Playbook App Development]]></category>
		<category><![CDATA[C++ Programming]]></category>
		<category><![CDATA[Cool news]]></category>
		<category><![CDATA[iOS App Development]]></category>
		<category><![CDATA[IwGame Engine]]></category>
		<category><![CDATA[Marmalade SDK]]></category>
		<category><![CDATA[Pocketeers Limited]]></category>
		<category><![CDATA[Samsung Bada Development]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[IwGame Update]]></category>

		<guid isPermaLink="false">http://www.drmop.com/?p=1442</guid>
		<description><![CDATA[New here? What&#8217;s IwGame? IwGame is an open source free to use cross platform game engine for iPhone, iPad, Android, Bada, Playbook, Symbian, Windows Mobile, LG-TV, Windows and Mac, built on top of the Marmalade SDK. You can find out more and download the SDK from our IwGame Engine page. Well this release is a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.drmop.com/wp-content/uploads/2012/01/IwGameLogo2.png"><img class="aligncenter size-large wp-image-705" title="IwGameLogo2" src="http://www.drmop.com/wp-content/uploads/2012/01/IwGameLogo2-1024x300.png" alt="" width="512" height="150" /></a></p>
<p>New here? What&#8217;s IwGame? IwGame is an open source free to use cross platform game engine for iPhone, iPad, Android, Bada, Playbook, Symbian, Windows Mobile, LG-TV, Windows and Mac, built on top of the <a title="Marmalade SDK" href="http://www.madewithmarmalade.com/" rel="nofollow" target="_blank">Marmalade SDK</a>. You can find out more and download the SDK from our <a title="IwGame Engine" href="http://www.drmop.com/index.php/iwgame-engine/" target="_self">IwGame Engine page</a>.</p>
<p>Well this release is a little earlier I’m afraid, we wanted to get UI functionality into 0.34, but 0.33 had a compile issue with the recent Marmalade 6.0 release so we decided to do a release now.</p>
<p>Below is the list of changes for IwGame 0.34:</p>
<ul>
<li>Fixed Marmalade 6.0 compile error</li>
<li>JPEG loading support has been removed as this is now supported by Marmalade image classes</li>
<li>New extensions system added (pass true for enable_extensions in IwGame::Init() to enable, enabled by default) – Extensions are none standard IwGame code that will be added over the coming months to support game specific features</li>
<li>Actions now have a 4th parameter</li>
<li>New modifier system added that allows you to add functionality units to actors and scene. This enables a build from blocks style development</li>
<li>New AddModifier action that can be used to add a modifier to an actor or scene and modifier its behaviour in real-time</li>
<li>New ChangeModifier action that can be used to change the active state or remove a modifier from an actor or scene</li>
<li>Actors can now be marked as draggable. A draggable actor can be moved aruond by the user using their finger</li>
<li>New SetProperty action added for actors. You can now directly change the properties of an actor using actions. Can also be used to add torque and force onto actors under control of the physics system</li>
<li>New AddProperty action added for actors. This action can be used to add a value onto the peoperties of an actor</li>
<li>IwGame now supports brushes in code and in XOML. Brushes can be created and attached to actors saving you from having to specify image and SrcRect for each actor. This enables actor styling across any actors</li>
<li>CIwGameActorImage can now be instantiated from XOML using the ActorImage tag</li>
<li>New XOML atlas inner tag added to animations to allow auto generation of sprite atlas frames</li>
<li>Support has been added for joints (distance, revolute, prismatic, pulley and wheel joints are supported in code and in XOML)</li>
<li>A scenes physics update can now be changed between constant time step and variable</li>
<li>Box2D materials now support bullet, fixed rotation and gravity scaling parameters</li>
<li>Checks for duplicates added to resources, variables, actions, modifiers, class creators</li>
<li>New CIwGameActorConnector extension actor added – This actor will size and orientate itself so that it connects two static / dynamic points in space (can target moving actors)</li>
<li>New CIwGameModFollowHeading modifier extension added – When added to an existing actor the actor can be controlled using headnig and speed instead of velocity</li>
<li>CIwGameImage::CreatePNG() now supports RGBA_8888</li>
<li>Two basic Hello World examples added, one that displays text in code and another that uses XOML</li>
<li>BUG FIX: IwGameBox2d now coompiles on Mac without error</li>
<li>BUG FIX: CIwGameBox2dBody::setFixture() now behaves as expected</li>
<li>BUG FIX: Collision flags are now restored when turning an object from none collidable to collidable</li>
<li>BUG FIX: Memory leak in CIwGameActorImage::SetSrcDest(), SetSrcRect() and SetDestSize()</li>
<li>BUG FIX: Fixed problem with html parsing in CIwGameAds::ExtractLinkAndImageFromtHTML()</li>
<li>BUG FIX: CIwGameImage::CreatePNG() crash bug fixed</li>
</ul>
<p>Lots of changes and a few bug fixes for good measure. The most interesting changes include Box2D physics joints (been playing with them all week and they are awesome), the new modifiers system, draggable actors and the ability to set actor properties directly using actions. Lets look at some of these new changes in more detail:</p>
<h2>Box2D Joints Support</h2>
<p>Physics joints enable you to connect physical bodies together in a variety of ways. The following types of physical joints are currently supported:</p>
<ul>
<li>Distance – A distance joint limits the distance of two bodies and attempts to keep them the same distance apart, damping can also be applied</li>
<li>Revolute – A revolute joint forces two bodies to share a common anchor point. It has a single degree of freedom and the angle between the two bodies can be limited. In addition a motor can also be applied to the joint</li>
<li>Prismatic – A prismatic joint limits movement between the two bodies by translation (rotation is prevented). The translational distance between the two joints can be limited. In addition a motor can also be applied to the joint</li>
<li>Pulley Joint – A pulley joint can be used to create a pulley system between two bodies so that when one body rises the other will fall.</li>
<li>Wheel Joint – A wheel joint restricts one body to the line on another body and can be used to create suspension springs. A motor can also be applied to the joint</li>
</ul>
<p>All joints share the same base class IIwGameBox2dJoint</p>
<p>Joints can be created in code and attached to a body using CiwGameBox2dBody::addJoint(). Joints can later be removed using removeJoint(). You can also search for existing joints using getJoint() and findJoint()</p>
<pre>        &lt;ActorImage Name="Crate1" ...... /&gt;
        &lt;ActorImage Name="Crate2" ...... &gt;
            &lt;Joints&gt;
                &lt;Joint type="distance" ActorB="Crate1" OffsetA="0, 50" OffsetB="0, -50" Frequency="10" Damping="0" SelfCollide="true" /&gt;
            &lt;/Joints&gt;
        &lt;/ActorImage&gt;</pre>
<p>The easiest way to create and attach joints is using XOML. Below is an example showing how to create and attach a distance joint between two crates:</p>
<h2>Actor and Scene Modifiers</h2>
<p>IwGame supports modifiers using the IwGameModfier system. Modifiers can be thought of as small functional building blocks that can be stacked in an actor or scene to extend the functionality of that actor or scene. For example, a typical modifier for a scene could be one that tracks the players scores / hi-scores, change day / night settings or detects special gestures. An actor modifier example could be a modifier that allows the actor move around using heading and speed or even a modifier with functionality specific to your game such as make a baddy that walks left and right on a platform. The idea is to allow developers to build games and apps up from smaller re-usable building blocks and be able to add them using code or XOML. Below is a quick example showing how to attach a modifiers list to an actor in XOML:</p>
<pre>     &lt;ActorImage Name="Baddy1" ....... &gt;
          &lt;Modifiers&gt;
              &lt;Modifier Name="AddThrustMod" Active="true" Param1="1" /&gt;
              &lt;Modifier Name="ShootPlayerWhenClose" Active="true" Param1="1" /&gt;
          &lt;/Modifiers&gt;
     &lt;/ActorImage&gt;</pre>
<p>Here we have added two modifiers to the Baddy1 actor which modify its behaviour. Note that up to 4 parameters can be passed to the modifier</p>
<p>Modifiers can also be attached in code like this:</p>
<pre>    // Find the modifiers creator
    IIwGameModifierCreator* creator = IW_GAME_MODS-&gt;findCreator("addthrustmod");
    if (creator != NULL)
    {
        // Create an instance of the modifier
        IIwGameModifier* mod = creator-&gt;CreateInstance();
        if (mod != NULL)
        {
            // Set up the instance
            mod-&gt;setName("addthrustmod");
            mod-&gt;setActive(true);
            mod-&gt;setParameter(0, "1");

            // Add the modifier to the actor
            actor-&gt;getModifiers()-&gt;addModifier(mod);
        }
    }</pre>
<h2>Draggable Actors</h2>
<p>Any actor can now be set as draggable, allowing the user to tap it and drag it around the world. You can make any actor draggble in XOML by adding Draggable=&#8221;true&#8221; to its definition.</p>
<h2>Setting / Updating Actor Properties from XOML</h2>
<p>Its now possible to set or update actor properties directly from an action in XOML. Using the new SetProperty / AddProperty actions</p>
<h2>Extensions System</h2>
<p>From v0.34 of IwGame a new optional extensions system has been added. The extensions system is basically a collection of actors, scenes, actions, modifiers and other elements that are not part of the base IwGame engine. The extensions system provides support for game specific objects and other functionality that can be used to make creating specific types of games much easier. There&#8217;s not many extensions available yet but many more will be added in the future</p>
<h2>IwGame Usage Changes</h2>
<p>Please note the recent changes that have been applied to IwGame Usage. The new usage terms are shown below:</p>
<p>You are free to use IwGame in your projects in part or in whole as long as the header comments remain in-tact. Whilst you are not obliged to mention your usage of IwGame in your products it would be great and beneficial to let us know as we can publicise your product on our blog and other web sites / services (Our blog receives over 200,000 hits per month) However, if you use any part of the IwGame extensions system, which includes extension actors, extension scenes or extension modifiers then you are required to mention usage of the IwGame Engine in your product.</p>
<p>You may not claim the IwGame engine or its documentation as your own work or package it up and include it in any kind of middleware product without express prior written notice from an executive of Pocketeers Limited with the correct authority to grant authorisation. You may not publicly host any source code that is part of the IwGame Engine, the source will be hosted at <a title="IwGame Engine" href="http://www.drmop.com/index.php/iwgame-engine/">http://www.drmop.com/index.php/iwgame-engine/</a></p>
<p>These changes apply to all versions of the IwGame Engine.</p>
<p>Well that&#8217;s it for this update</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drmop.com/index.php/2012/04/17/iwgame-engine-v0-34-released-modifiers-box2d-joints-and-marmalade-6-0-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Marmalade 6.0 is out NOW!</title>
		<link>http://www.drmop.com/index.php/2012/04/16/marmalade-6-0-is-out-now/</link>
		<comments>http://www.drmop.com/index.php/2012/04/16/marmalade-6-0-is-out-now/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 20:20:48 +0000</pubDate>
		<dc:creator>drmop</dc:creator>
				<category><![CDATA[AirPlay SDK]]></category>
		<category><![CDATA[Android App Development]]></category>
		<category><![CDATA[Blackberry Playbook App Development]]></category>
		<category><![CDATA[C++ Programming]]></category>
		<category><![CDATA[Cool news]]></category>
		<category><![CDATA[Game and App Development]]></category>
		<category><![CDATA[HTML Programming]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[iOS App Development]]></category>
		<category><![CDATA[JavaScript Programming]]></category>
		<category><![CDATA[Marmalade SDK]]></category>
		<category><![CDATA[Samsung Bada Development]]></category>
		<category><![CDATA[Marmalade 6.0]]></category>

		<guid isPermaLink="false">http://www.drmop.com/?p=1429</guid>
		<description><![CDATA[**** IwGame does not compile with Marmalade 6.0. To fix please comment out the following line at the top of IwGameImage.cpp for now. We will release an early update this week to fix it **** //#include &#8220;pngstruct.h&#8221; Ok, its not often I look in my email box and find good news, but today I saw [...]]]></description>
			<content:encoded><![CDATA[<p>**** IwGame does not compile with Marmalade 6.0. To fix please comment out the following line at the top of IwGameImage.cpp for now. We will release an early update this week to fix it ****</p>
<p>//#include &#8220;pngstruct.h&#8221;</p>
<p>Ok, its not often I look in my email box and find good news, but today I saw an email from Marmalade announcing Marmalade 6.0. I took a quick look over the changes list and the new features and it looks pretty awesome. I&#8217;m a little disappointed that there&#8217;s no native web deployment, but there&#8217;s plenty of other cool features to be playing with including:</p>
<ul>
<li>Web Marmalade &#8211; You can now develop apps with HTML5 / CSS3 and Javascript. Marmalade have used the same standard as Phone Gap to make it compatible (smart move IMO). This is pretty awesome in itself, but to be honest I&#8217;m waiting for the full native bridge exposure and documentation. You wont be making any real time smooth arcade style games with 6.0 but its great for apps and none arcade style game development. Either way I&#8217;m going to be getting my hands dirty with Javascript (the most lawless language on Earth <img src='http://www.drmop.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</li>
<li>iPad retina support</li>
<li>New native UI enhancements including Toolbar, Table, Picket / Listbox , Tab / Tap Group, Activity indicator and Navigation bar</li>
<li>New Mac anehancements such as support accelerometer and location in the simulator</li>
<li>And a mass of bug fixes, including the notorious Facebook extension which has been upgraded to the latest on  Facebook SDK for iOS. Also native support for JPEG images</li>
</ul>
<p>To see the full list of changes check out Marmalades web site at <a href="https://www.madewithmarmalade.com/marmalade/whats-new" rel="nofollow" target="_blank">https://www.madewithmarmalade.com/marmalade/whats-new</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.drmop.com/index.php/2012/04/16/marmalade-6-0-is-out-now/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>IwGame &#8211; We Need Your Feedback</title>
		<link>http://www.drmop.com/index.php/2012/04/14/iwgame-we-need-feedback/</link>
		<comments>http://www.drmop.com/index.php/2012/04/14/iwgame-we-need-feedback/#comments</comments>
		<pubDate>Sat, 14 Apr 2012 12:11:57 +0000</pubDate>
		<dc:creator>drmop</dc:creator>
				<category><![CDATA[Android App Development]]></category>
		<category><![CDATA[Apps]]></category>
		<category><![CDATA[Blackberry Playbook App Development]]></category>
		<category><![CDATA[C++ Programming]]></category>
		<category><![CDATA[Game and App Development]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[iOS App Development]]></category>
		<category><![CDATA[IwGame Engine]]></category>
		<category><![CDATA[Pocketeers Limited]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Samsung Bada Development]]></category>
		<category><![CDATA[Need feedback]]></category>

		<guid isPermaLink="false">http://www.drmop.com/?p=1375</guid>
		<description><![CDATA[Hi Everyone, The IwGame Engine has been in development for around 6 months now and although we&#8217;ve received lots of feedback regarding bug reports and feature requests we would like to know your opinions on the current state of the engine. Here are a few questions to consider: Is IwGame difficult to use, if so [...]]]></description>
			<content:encoded><![CDATA[<p>Hi Everyone, </p>
<p>The IwGame Engine has been in development for around 6 months now and although we&#8217;ve received lots of feedback regarding bug reports and feature requests we would like to know your opinions on the current state of the engine. Here are a few questions to consider:</p>
<ul>
<li>Is IwGame difficult to use, if so can you suggest any improvements that we could make to make it easier to use?</li>
<li>How are you finding the current feature set? Is anything particularly buggy, hard to use or simply missing something?</li>
<li>What&#8217;s the next BIG feature for you, what would you really like to see come next?</li>
<li>How are you finding using XOML? Do you prefer the declarative approach or do you prefer to code things up in C++ instead. Can you suggest any improvements you would like to see?</li>
<li>If you have recently stopped using IwGame, what made you leave? Was there a better option and if so, what was the deal making features?</li>
</ul>
<p>This is the opportunity to have your say, any feedback that you can provide is greatly appreciated and will help steer the direction of the IwGame engine.</p>
<p>Mat</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drmop.com/index.php/2012/04/14/iwgame-we-need-feedback/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>IwGame Engine Tutorial &#8211; Actors</title>
		<link>http://www.drmop.com/index.php/2012/04/08/iwgame-engine-tutorial-actors/</link>
		<comments>http://www.drmop.com/index.php/2012/04/08/iwgame-engine-tutorial-actors/#comments</comments>
		<pubDate>Sun, 08 Apr 2012 19:08:07 +0000</pubDate>
		<dc:creator>drmop</dc:creator>
				<category><![CDATA[Android App Development]]></category>
		<category><![CDATA[Blackberry Playbook App Development]]></category>
		<category><![CDATA[C++ Programming]]></category>
		<category><![CDATA[Game and App Development]]></category>
		<category><![CDATA[iOS App Development]]></category>
		<category><![CDATA[IwGame Engine]]></category>
		<category><![CDATA[Pocketeers Limited]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Samsung Bada Development]]></category>
		<category><![CDATA[Actors]]></category>
		<category><![CDATA[IwGame Engine Tutorial]]></category>

		<guid isPermaLink="false">http://www.drmop.com/?p=1301</guid>
		<description><![CDATA[CIwGameActor Object – Sprites With Brains Introduction Whilst our title comparison suggests that actors are simply sprites with brains they have the potential to be much more. Going back to comparison in the scene introduction section, actors play a pivotal role in our scenes, each actor having its own unique role and visual appearance. Actors [...]]]></description>
			<content:encoded><![CDATA[<h1>CIwGameActor Object – Sprites With Brains</h1>
<h2>Introduction</h2>
<p>Whilst our title comparison suggests that actors are simply sprites with brains they have the potential to be much more.</p>
<p>Going back to comparison in the scene introduction section, actors play a pivotal role in our scenes, each actor having its own unique role and visual appearance. Actors are the building block of the game, they provide the actual unique functionality and visuals that make up the game as a whole. They can provide any type of functionality from a simple bullet fleeting across the screen to something as complex as a dynamic machine that modifies its behaviour and appearance based upon data streamed from a web server.</p>
<p>A CIwGameActor is a very generic object that provides quite a lot of functionality out of the box. The idea is for developers to create their own actor types from the base CIwGameActor class then implement their own custom functionality within its Update() method. The basic functionality provided by CIwGameActor includes:</p>
<ul>
<li>Support for actor pooling to help reduce memory fragmentation</li>
<li>Unique names so they can be searched</li>
<li>Actor types</li>
<li>Position, Depth, Origin, velocity and velocity damping</li>
<li>Angle, angular velocity and angular velocity damping</li>
<li>Scale and Colour</li>
<li>Layers</li>
<li>Active and visible states</li>
<li>A visual that represents it on screen</li>
<li>Animation timeline that can be attached to the visual</li>
<li>Collision size / rectangle</li>
<li>Wrapping at scenes extents</li>
<li>Instantiation itself from XOML</li>
<li>Animation timline update</li>
<li>Other actor linkage (used to connect actors in a child / parent style system)</li>
<li>A Box2D physical body consisting of a material and shape</li>
<li>Box2D collision category, mask and group</li>
</ul>
<p>Note that any changes made to the actor will automatically be applied to the actors visual.</p>
<p>As IwGame progresses more actor types with additional functionality will be created to create more out of the box style game objects (plug-in actors if you will). For the moment the following actors have been created for you:</p>
<p>CIwGameActorImage – This object represents a basic image based actor which has an associated image and animation.<br />
CIwGameActorText – This object represents a basic text based actor which has an associated font and animation.<br />
CIwGameActorParticles – This object represents a complex particle based actor system consists of manypatricles that move independently and have varying life spans.</p>
<p>A word of warning, do not forget to call the based classes Init(), Reset(), Update(), UpdateVisual() methods from your own derived classes or the underlying functionality will not be provided.</p>
<h2>Creating Actors</h2>
<p>Creating an actor is very simple as the following code shows:</p>
<pre>	<span style="color: #008000;">// Create player actor</span>
	MyActor* actor = new MyActor();
	if (actor == NULL)
		return NULL;

	actor-&gt;Init();
	actor-&gt;setName("Player1");
	actor-&gt;setPosition(x, y);

	<span style="color: #008000;">// Add player actor to the scene</span>
	scene-&gt;addActor(actor);</pre>
<p>In the above code we create a a basic MyActor object, which is a class that I created derived from CIwGameActor giving us the base CIwGameActor functionality. However, adding this code into a game wouldn&#8217;t actually see anything as we have not assigned a visual element to the actor. CIwGameActor does not handle the creation of a visual for you, instead it handles the rendering and update of a visual and its animations.</p>
<p>To get developers started with actors we included the CIwGameActorImage that will create a basic image based actor that supports animation.</p>
<p>If you require your actor to support Box2D physics then you should either define the Box2DMaterial and Shape in XOML or if creating manually then call:</p>
<pre>	InitBody(Scene, shape, material, &amp;Position, Angle, com.x, com.y);</pre>
<p>This can be called before or after CIwGameActor::Init()</p>
<h2>Creating a CIwGameActorImage</h2>
<p>Creating an image based actor is a little more complicated, lets take a look at some example code:</p>
<pre>	<span style="color: #008000;">// Create a new instance</span>
	ActorPlayer* actor = new ActorPlayer();
	if (actor == NULL)
		return NULL;

	<span style="color: #008000;">// Create player actor</span>
	actor-&gt;setScene(scene);
	actor-&gt;Init(image, 36, 40);
	actor-&gt;setPosition(x, y);

	<span style="color: #008000;">// Add player actor to the scene</span>
	scene-&gt;addActor(actor);</pre>
<p>Creation is very similar to creating a basic CIwGameActor with the additional complication of having to pass an image to the actors Init() method.</p>
<p>Looking at the above code we create an ActorPlayer, which is a class that I created derived from CIwGameActorImage as we want some basic image functionality.</p>
<p>We then call the actors its Init() method to set up actor internals. We give the actor a name so that we can find it later then set its world position to the centre of the scene. Finally we add the actor to the scene.</p>
<p>You will notice that ActorPlayer&#8217;s Init() method has quite a a few parameters. When we call Init(&#8230;.) we are actually calling CIwGameActorImage::Init(&#8230;.) and passing along all the details shown in the code above which includes an image that will represent our actor (or more usually an image atlas), and the width and height of the visual on screen (in virtual canvas coordinates). Internally CIwGameActorImage will create a sprite to display our actor.</p>
<p>The end product of the above code is an actor that can be seen, moved around, scaled, rotated etc..</p>
<p>Now lets take a look at a slightly more complicated ezmple that creates an image based actor that uses an animation time line (more details on time line&#8217;s later):</p>
<pre>	<span style="color: #008000;">// Create a new instance</span>
	ActorPlayer* actor = new ActorPlayer();
	if (actor == NULL)
		return NULL;

	<span style="color: #008000;">// Create an animation timeline to hold our image animation</span>
	CIwGameAnimTimeline* timeline = new CIwGameAnimTimeline();

	<span style="color: #008000;">// Create and set up our face animation</span>
	CIwGameAnimInstance* face_anim = new CIwGameAnimInstance();
	face_anim-&gt;setAnimation(anim);
	face_anim-&gt;setTarget(actor, "SrcRect");
	timeline-&gt;addAnimation(face_anim);
	timeline-&gt;play();

	<span style="color: #008000;">// Create player actor</span>
	actor-&gt;setScene(scene);
	actor-&gt;Init(image, 36, 40);
	actor-&gt;setTimeline(timeline);
	actor-&gt;setPosition(x, y);

	<span style="color: #008000;">// Add player actor to the scene</span>
	scene-&gt;addActor(actor);</pre>
<p>I have marked the changes from the previous example.</p>
<p>The first set of changes deals with creating a time line object then creating the instance of an animation and adding that to the time line. This process allows the actor to track and update its own animations</p>
<p>In the last change we simply assign the time line to the actor, the actor will now take care of playing the animation and updating the actors visual with animation changes.</p>
<h2>Text Based Actors</h2>
<p>Text based actors enable you to instantiate text into the scene with very little effort from code or more easily from XOML. Thse text objects can be use very much in the same way as image based actors in that they can be moved around, scaled, rotated, hit tested or even have physics and collision applied to them.</p>
<p>Lets firstly take a look at creating a text based actor in code:</p>
<pre>	<span style="color: #008000;">// Find our preloaded font</span>
	CIwGameFont* font = (CIwGameFont*)IW_GAME_GLOBAL_RESOURCES-&gt;getResourceManager()-&gt;findResource("font1", CIwGameXomlNames::Font_Hash);

	<span style="color: #008000;">// Create a text actor</span>
	CIwGameActorText* text_actor = new CIwGameActorText();
	text_actor-&gt;Init(font);
	text_actor-&gt;setText("Hello World!");
	text_actor-&gt;setRect(CIwRect(-100, -100, 200, 200));
	text_actor-&gt;setColour(0, 0, 0, 255);
	text_actor-&gt;setPosition(0, 0);
	text_actor-&gt;setAngle(45);

	<span style="color: #008000;">// Add to the scene</span>
	CIwGameScene* scene = findScene("Scene1");
	scene-&gt;addActor(text_actor);</pre>
<p>In the above code we firstly locate our font (which we have already preloaded into the resource system) then we create a text based actor from CIwGameActorText initialising it with the font. We then set the text, rect and some other parameters.</p>
<p>We now search for the scene we want to place the actor in and it to the scene.</p>
<p>Now lets take a look at how to instantiate a text based actor in XOML:</p>
<p>&lt;<span style="color: #0000ff;">ActorText</span> Position=&#8221;0, 0&#8243; Rect=&#8221;-100, -100, 200, 200&#8243; Angle=&#8221;45&#8243; Font=&#8221;font1&#8243; Text=&#8221;Hello World!&#8221; Colour=&#8221;0, 0, 0, 255&#8243; /&gt;</p>
<p>As you can see the XOML definition is much more compact and readable.</p>
<h2>Particle System Actors</h2>
<p>From v.030 of IwGame the new particle system based actor is available. This actor is special in that it is optimised for creating, displaying and updating a complete system of sprites (kind of like its own sprite manager). The advantage of this actor is that it does not have to deal with each particle as a separate actor object. The CIwGameActorParticles actor supports both manual and auto generation of particles. Auto generation can be controlled using a number of a control parameters.</p>
<p>Particles have a number of properties that can be adjusted:</p>
<ul>
<li>Visual</li>
<li>Position</li>
<li>Velocity</li>
<li>Velocity Damping</li>
<li>Gravity</li>
<li>Scale</li>
<li>Scale Velocity</li>
<li>Scale Velocity Damping</li>
<li>Angle</li>
<li>Angle Velocity</li>
<li>Angle Velocity Damping</li>
<li>Colour</li>
<li>Colour Velocity</li>
<li>Colour Velocity Damping</li>
<li>Depth</li>
<li>Depth Velocity</li>
<li>Depth Velocity Damping</li>
<li>Active state</li>
<li>Visible state</li>
<li>Lifespan – Duration of particle in seconds</li>
<li>SpawnDelay – The amount of time to wait before spawning for the first time</li>
<li>Lives – Number of times the particle will re-spawn (-1 for infinite)</li>
</ul>
<p>The CIwGameActorParticles class contains two methods for generating random particles:</p>
<pre>void GenerateRandomParticles(int count, CIwRect&amp; src_rect, CIwFVec4&amp; colour, CIwFVec4&amp; colour_velocity, float duration, int repeat_count, float spawn_delay_change, float gravity)
void GenerateRandomParticles(int count, CIwGameActorParticle* particle, CIwRect&amp; src_rect, float duration, int repeat_count, float spawn_delay_change)</pre>
<p>Both of these methods will generate a number of particles based on a set of limits.</p>
<p>To determine which particle parameters are generated randomly the CIwGameActorParticles class supports the following methods:</p>
<pre>void	setPositionMode(eParticleMode mode)
void	setAngleMode(eParticleMode mode)
void	setScaleMode(eParticleMode mode)
void	setVelocityMode(eParticleMode mode)
void	setAngVelocityMode(eParticleMode mode)
void	setScaleVelocityMode(eParticleMode mode)
void	setDepthMode(eParticleMode mode)
void	setDepthVelocityMode(eParticleMode mode)</pre>
<p>By setting the mode to PAM_Random the specified parameters will be generated randomly.</p>
<p>When parameters are generated the following methods specify limits to the random formulas used to generate the parameters:</p>
<pre>void	setPositionRange(CIwFVec2&amp; range)
void	setAngleRange(CIwFVec2&amp; range)
void	setScaleRange(CIwFVec2&amp; range)
void	setDepthRange(CIwFVec2&amp; range)
void	setVelocityRange(CIwFVec4&amp; range)
void	setAngVelocityRange(CIwFVec2&amp; range)
void	setScaleVelocityRange(CIwFVec2&amp; range)
void	setDepthVelocityRange(CIwFVec2&amp; range)</pre>
<p>Lets take a look at some code that generates an explosion type particle system:</p>
<pre>CIwGameActorParticles* GameScene::AddExplosion(int num_particles, float x, float y, float scale, float depth, int layer, float gravity)
{
	<span style="color: #008000;">// Create explosion particle actor</span>
	CIwGameActorParticles* actor = new CIwGameActorParticles();
	addActor(actor);
	actor-&gt;Init(num_particles);
	actor-&gt;setImage((CIwGameImage*)ResourceManager-&gt;findResource("sprites1", CIwGameXomlNames::Image_Hash));
	actor-&gt;setPosition(x, y);

	<span style="color: #008000;">// Set random </span><span style="color: #008000;">parameters</span>
	actor-&gt;setScaleMode(CIwGameActorParticles::PAM_Random);
	actor-&gt;setAngVelocityMode(CIwGameActorParticles::PAM_Random);
	actor-&gt;setVelocityMode(CIwGameActorParticles::PAM_Random);

	<span style="color: #008000;">// Set paramater limits</span>
	CIwFVec2 scale_range(scale, scale + scale / 2);
	actor-&gt;setScaleRange(scale_range);
	CIwFVec2 angle_range(-5, 5);
	actor-&gt;setAngleRange(angle_range);
	CIwFVec4 vel_range(-5, 5, -5, 5);
	actor-&gt;setVelocityRange(vel_range);
	CIwRect src_rect(908, 440, 100, 100);
	CIwFVec4 colour(255, 255, 255, 255);
	CIwFVec4 colour_vel(0, 0, 0, -5);

	<span style="color: #008000;">// Generate the particles</span>
	actor-&gt;GenerateRandomParticles(num_particles, src_rect, colour, colour_vel, 2, 1, 0, gravity);

	return actor;
}</pre>
<p>Here we create a particle actor, set up the which parameters should be randomised then set the random limits. Finally we tell the actor to generate random particles</p>
<p>Now lets take a quick look at generating particles manually in code:</p>
<pre>CIwGameActorParticles* GameScene::AddStream(int num_particles, float x, float y, float scale, float depth, int layer, float gravity)
{
	<span style="color: #008000;">// Create stream particle actor</span>
	CIwGameActorParticles* actor = new CIwGameActorParticles();
	addActor(actor);
	actor-&gt;Init(num_particles);
	actor-&gt;setImage((CIwGameImage*)ResourceManager-&gt;findResource("sprites1", CIwGameXomlNames::Image_Hash));
	actor-&gt;setPosition(x, y);
	CIwRect src_rect(800, 291, 68, 65);
	CIwFVec4 colour(255, 255, 255, 128);
	CIwFVec4 colour_vel(0, 0, 0, -3);

	<span style="color: #008000;">// Create and add particles</span>
	float spawn_delay = 0;
	for (int t = 0; t &lt; num_particles; t++)
	{
		CIwGameActorParticle* p = new CIwGameActorParticle();
		p-&gt;LifeSpan = 1;
		p-&gt;Lives = -1;
		p-&gt;SpawnDelay = spawn_delay;
		p-&gt;Gravity = gravity;
		p-&gt;Colour = colour;
		p-&gt;ColourVelocity = colour_vel;
		p-&gt;DepthVelocity = -0.01f;

		actor-&gt;addParticle(p, src_rect);
		spawn_delay += (float)1.0f / num_particles;
	}

	return actor;
}</pre>
<p>This method creates a particle actor then manually creates a stream of particles that spawn at slightly different times to create a stream type particle system.</p>
<p>Particle actors can also be created in XOML. Lets take a quick look at an example:</p>
<pre>    &lt;<span style="color: #0000ff;">ActorParticles</span> Name="StreamParticles" Image="sprites1" Position="0, 0" Scale="1.0" Depth="1.0" Layer="1" VelAngMode="random" VelMode="random" AngMode="random" ScaleMode="random" PositionRange="100, 100" AngleRange="0, 360" AngVelRange="-5, 5" ScaleRange="0.25, 0.5" DepthRange="0.5, 1.0" VelRange="-2, 2, -2, 2" ScaleVelRange="0, -0.1" DepthVelRange="0, 0"&gt;
        &lt;<span style="color: #0000ff;">Particle</span> Count="10" Position="0, 0" VelocityDamping="0.95, 0.95"
		SrcRect="908, 440, 100, 100" ColourVelocity="0, 0, 0, -4" Duration="2"
		Repeat="-1" SpawnDelay="0" /&gt;
        &lt;<span style="color: #0000ff;">Particle</span> Position="0, 0" VelocityDamping="0.95, 0.95" SrcRect="908, 440, 100, 100"
		ColourVelocity="0, 0, 0, -4" Duration="2" Repeat="-1" SpawnDelay="0" /&gt;
        &lt;<span style="color: #0000ff;">Particle</span> Position="0, 0" VelocityDamping="0.95, 0.95" SrcRect="908, 440, 100, 100"
		ColourVelocity="0, 0, 0, -4" Duration="2" Repeat="-1" SpawnDelay="0.4" /&gt;
        &lt;<span style="color: #0000ff;">Particle</span> Position="0, 0" VelocityDamping="0.95, 0.95" SrcRect="908, 440, 100, 100"
		ColourVelocity="0, 0, 0, -4" Duration="2" Repeat="-1" SpawnDelay="0.8" /&gt;
        &lt;<span style="color: #0000ff;">Particle</span> Position="0, 0" VelocityDamping="0.95, 0.95" SrcRect="908, 440, 100, 100"
		ColourVelocity="0, 0, 0, -4" Duration="2" Repeat="-1" SpawnDelay="1.2" /&gt;
        &lt;<span style="color: #0000ff;">Particle</span> Position="0, 0" VelocityDamping="0.95, 0.95" SrcRect="908, 440, 100, 100"
		ColourVelocity="0, 0, 0, -4" Duration="2" Repeat="-1" SpawnDelay="1.6" /&gt;
    &lt;/<span style="color: #0000ff;">ActorParticles</span>&gt;</pre>
<p>The above XOML firstly generates 10 random particles at time 0, followed by 4 additional particles at times 0.4, 0.8, 1.2 and 1.6 seconds.</p>
<p>If you would like finer grained control over particle actors then you can simply derive your own version from CIwGameActorParticles</p>
<h2>Actor Lifetimes</h2>
<p>Actors will persist within the scene until a) the scene is deleted b) you explicitly remove them or the recommended method c) they remove themselves. An actor can easily remove and delete itself from the scene by returning false from its Update() method. Here&#8217;s an example:</p>
<pre>bool ActorPlayer::Update(float dt)
{
	<span style="color: #008000;">// If fade timer has timed out then delete this actor</span>
	if (FadeTimer.HasTimedOut())
	{
		return false;	<span style="color: #008000;">// returning false tells the scene that we no need to be removed</span>
	}

	<span style="color: #008000;">// Calculate our opacity from time left on fade timer</span>
	int opacity = FadeTimer.GetTimeLeft() / 2;
	if (opacity &gt; 255) opacity = 255;
	Colour.a = opacity;

	return CIwGameActorImage::Update(dt);
}</pre>
<h2>Actor Naming and Finding Actors</h2>
<p>As mention previously for scenes, actors also named objects, each instance of an object that you wish to query should have its own unique name (per scene) so that it can be located and modified at a later date.</p>
<p>You can find an actor in a particular scene using:</p>
<pre>	CIwGameActor* actor = scene-&gt;findActor(“Player1”);
	if (actor != NULL)
	{
		<span style="color: #008000;">// Do somethinig with the actor</span>
	}</pre>
<p>There are three ways to locate actors within a scene:</p>
<pre>	CIwGameActor*		findActor(const char* name);
	CIwGameActor*		findActor(unsigned int name_hash);
	CIwGameActor*		findActor(int type);</pre>
<p>These allow you to search for actor by string, hash or type. Note that searching by type will return the first and only the first instance of that particular actor type. This is very useful if you want to find a unique actor type, for example the player.</p>
<h2>Actor Types</h2>
<p>When developing games I find it incredibly useful to assign different types of actors different type ID&#8217;s, this allows me to optimise many area of my code such as collision checks. Carrying a type ID for each actor also comes in handy when you want to know the types of actor that you are interacting with.</p>
<p>You can set and get the actors type ID using:</p>
<pre>	void		setType(int type)
	int		getType() const</pre>
<h2>Moving, Rotating and Spinning Actors</h2>
<p>Actors come with a very basic physics system that allows movement via velocity and angular velocity, actors can also be scaled. CIwGameActor provides the following basic functionality to handle these features:</p>
<pre>	void				setPosition(float x, float y)
	CIwFVec2			getPosition()
	void				setAngle(float angle)
	float				getAngle()
	void				setVelocity(float x, float y)
	CIwFVec2			getVelocity()
 	void				setVelocityDamping(float x, float y)
	void				setAngularVelocity(float velocity)
	float				getAngularVelocity() const
	void				setAngularVelocityDamping(float damping)
	void				setScale(float scale)
	float				getScale() const</pre>
<p>Note that velocity and angular velocity damping is a reduction factor that is applied each game frame to slow down objects linear and angular velocities. Their default values are 1.0f which provides no damping, setting this value to less than 1.0f will dampen velocity whilst setting it to a value greater than 1.0f will enhance velocity.</p>
<p>Also note that changing position or angle will not effect velocity.</p>
<p>If the actor was created with Box2D physics enabled then you can also use the supplied force application methods.</p>
<h2>Attaching a Visual and an Animation Timeline</h2>
<p>For our actor to become visible on screen we need to assign it a visual component. If you are rolling your own actor and don&#8217;t go the CIwGameActorImage route then you will need to create and assign your own visual component to the actor.</p>
<p>To assign a visual to an actor you would call:</p>
<pre>	void		setVisual(CIwGameSprite* visual)</pre>
<p>Now when the scene renders the actor it will attenot to render the visual. I want to mention at this pont that as far as IwGame is concerned a visual is an object type that derived from a CIwGameSprite (we will cover this later), but for now we will just say that a sprite as far as IwGame is concerned is anything that can be displayed, be it a simple image or a complex piece of SVG.</p>
<p>And where you find visuals you will usually find some kind of animation. The actor class supports attachment of CIwGameAnimTimeline which is basically a collection of animations (we will cover this in more depth later). To assign a time line we call:</p>
<pre>	void		setTimeline(CIwGameAnimTimeline* timeline) { Timeline = timeline; }</pre>
<h2>Changing an Actors Colour</h2>
<p>Each actor has its own independent colour (including opacity). All actors are set to a default colour of white and full opacity. To change the colour of an actor you can call:</p>
<pre>	void		setColour(CIwColour&amp; colour)</pre>
<p>Note that an actors colour will be combined with its parents base colour.</p>
<h2>Obeying Scene Extents</h2>
<p>By default an actor would merrily travel across the game scene and beyond its extents into oblivion and out of range coordinates, this can cause a bit of a mess for the underlying math and rendering routines. To prevent actors from going off into oblivion we can tell them to wrap around to the other side of the scene if they hit its extents boundary. To force actors to wrap around at the boundaries of the scene we call setWrapPosition(true):</p>
<pre>	void		setWrapPosition(bool enable)
	bool		getWrapPosition() const					{</pre>
<h2>Actor Layering</h2>
<p>We touched on layering earlier when we talking about layering in scenes. All actors within a scene exist (visually) on a layer. The layer determines the order in which the actors are rendered with lower layers appearing below higher layers. The maximum layer that an actor can exist on is determined by the scene that it lives in. To change the layer that an actor appears on and to retrieve its current layer we use:</p>
<pre>	void		setLayer(int layer)
	int		getLayer() const</pre>
<h2>Scene Visibility and Active State</h2>
<p>You can query an actors visibility state and set its visibility state using:</p>
<pre>	void		setVisible(bool visible)
	bool		isVisible() const</pre>
<p>You can query an actors active state and set its active state using:</p>
<pre>	void		setActive(bool active)
	bool		isActive() const</pre>
<p>Note that when an actor is made inactive it will also become invisible. However making an actor invisible will not make it inactive.</p>
<h2>Resetting Actors</h2>
<p>Because actors can be part of an object pooling system and may not get re-initialised when re-used, we provide the functionality to reset them to a default state. This allows developers to re-use objects and not worry about the previous state of the object. Just remember to call the underlying CIwGameActor::Reset() method from your own Reset() method to ensure that the actor is completely reset.</p>
<h2>Collision Checking</h2>
<p>Right now IwGame does not carry out collision checks for you, instead it calls back each actor in the scene after the scene has been updated to give each possible colliding object a chance to check and respond to collisions. To take advantage of this functionality you need to implement the following handler in your derived actor class:</p>
<pre>	virtual void	ResolveCollisions() = 0;</pre>
<p>A basic actor to actor collision method is included in CIwGameActor to allow actors to test for overlap based on the size set by setCollisionRect();</p>
<p>When a collision does take place, actors can notify each other by calling:</p>
<pre>	virtual void	NotifyCollision(CIwGameActor* other) = 0;</pre>
<p>Here&#8217;s a quick example showing how to use the system:</p>
<pre>void ActorPlayer::ResolveCollisions()
{
	<span style="color: #008000;">// Walk the scenes actors</span>
	for (CIwGameScene::_Iterator it = Scene-&gt;begin(); it != Scene-&gt;end(); ++it)
	{
		<span style="color: #008000;">// Only test collision against ball type actors</span>
		if ((*it)-&gt;getType() == ActorType_Ball)
		{
			<span style="color: #008000;">// Check for physical collision</span>
			if (CheckCollision(*it))
			{
				<span style="color: #008000;">// Notify ourselves that we collided with ball actor</span>
				NotifyCollision(*it);
				<span style="color: #008000;">// Notify ball actor that we collided with it</span>
				(*it)-&gt;NotifyCollision(this);
			}
		}
	}
}</pre>
<pre>Note that if you are using integrated Box2D then you safely bypass this collision check system.</pre>
<h2>Creating an Actor from XOML</h2>
<p>Actors can be created declaratively using XOML mark-up, making actor creation much easier and more intuitive. Below shows an example of an actor declared using XOML:</p>
<pre>        &lt;<span style="color: #0000ff;">MyActor</span> Name="Player1" Position="0, 0" Size="100, 100" Angle="45" SrcRect="0, 0, 36, 40" Image="Sprites" Timeline="Player1Intro2" /&gt;</pre>
<p>The basic actor tag supports many different attributes that determine how an actor is created and how it behaves. A description of these tags are listed below:</p>
<ul>
<li>Name – Name of the scene (string)</li>
<li>Style – Style that should be applied to this actor. If a properties that exists in the style is added to the definition then it replaces the property found in the style</li>
<li>Type – A numerical type that can be used to identify the type of this actor (integer)</li>
<li>Position– Position in the scene (x, y 2d vector)</li>
<li>Origin– Origin in the scene, moves the point around which the actor will rotate and scale (x, y 2d vector)</li>
<li>Depth – Depth of the actor in 3D (float – larger values move the sprite further away)</li>
<li>Velocity – Initial velocity of the actor (x, y 2d vector)</li>
<li>VelocityDamping – The amount to dampen velocity each frame (x, y 2d vector)</li>
<li>Angle – The orientation of the actor (float)</li>
<li>AngularVelocity – The rate at which the orientation of the actor changes (float)</li>
<li>AngularVelocityDamping – The amount of rotational velocity damping to apply each frame (float)</li>
<li>Scale, ScaleX, ScaleY – The scale of the actor (float)</li>
<li>Colour – The initial colour of the actor (r, g, b, a colour)</li>
<li>Layer – The scenes visible layer that the actor should appear on (integer)</li>
<li>Active – Initial actor active state (boolean)</li>
<li>Visible – Initial actor visible state (boolean)</li>
<li>HitTest – If true then this actor will receive touch events</li>
<li>Collidable – Collidable state of actor (boolean)</li>
<li>CollisionSize – The circular size of the actor (float)</li>
<li>CollisionRect – The rectangular collision area that the actor covers (x, y, w, h rect)</li>
<li>WrapPosition – If true then the actor will wrap at the edges of the canvas (boolean)</li>
<li>Timeline – The time line that should be used to animate the actor</li>
<li>Box2dMaterial – Sets the physical material type used by the Box2D actor</li>
<li>Shape – Box2D fixture shape for the Box2D actor</li>
<li>COM – Centre of mass of Box2D body (x, y 2d vector)</li>
<li>Sensor – Can be used to set the Box2D actor as a sensor (boolean)</li>
<li>CollisionFlags – The Box2D body collision flags (category, mask and group)</li>
<li>OnTapped – Tapped event handler</li>
<li>OnBeginTouch – Event handler that specifies an actions list to call when the user begins to touch the actor</li>
<li>OnEndTouch – Event handler that specifies an actions list to call when the user stops to touching the actor</li>
<li>OnTapped – Event handler that specifies an actions list to call when the user taps the actor</li>
<li>OnCreate – Event handler that specifies an actions list to call when this actor is created</li>
<li>OnDestroy – Event handler that specifies an actions list to call when this actor is destroyed</li>
<li>LinkedTo – Name of actor that this actor links to (string)</li>
</ul>
<p>For actors that are derived from CIwGameActorImage we have the following additional properties:</p>
<ul>
<li>Image – The image that is to be used as the actors visual (string)</li>
<li>Size – The on screen visible size of the actor (x, y 2d vector)</li>
<li>SrcRect – The position and source of the source rectangle in the image atlas (x, y, w, h rect). Used for panning the portion of a sprite atlas shown allowing frame based animation.</li>
<li>FlipX – Horizontal flipped state (boolean)</li>
<li>FlipY – Vertical flipped state (boolean)</li>
</ul>
<p>For actors that are derived from CIwGameActorText we have the following additional properties:</p>
<ul>
<li>Font – Name of font to use to draw the text (string)</li>
<li>Rect – The area thuat the text should be drawn inside of (x, y, w, h rect)</li>
<li>Text – String to display (string)</li>
<li>AlignH – Horizontal alignment (centre, left and right)</li>
<li>AlignV – Verticalalignment (middle, top and bottom)</li>
<li>Wrap – If true then text is wrapped onto next line if to long (boolean)</li>
</ul>
<p>Note that unlike scenes you cannot create an Actor or ActorImage directly as their corresponding CIwGameActor and CIwGameActorImage classes are abstract, so you must derive your own actor class. More on this later.</p>
<p>In addition, actors must be declared inside a scene tag element as they must have a parent scene and cannot be declared as resources.</p>
<h2>Animating Actor Components</h2>
<p>Actors allow an animation time line to be attached to them that animates various properties of the actor. The following properties are currently supported:</p>
<ul>
<li>Position – Actors current position</li>
<li>Depth – Actors 3D depth</li>
<li>Origin – Actors transform origin</li>
<li>Velocity – Actors current velocity</li>
<li>Angle – Actors current angle</li>
<li>AngularVelocity – Actors current angular velocity</li>
<li>Scale, ScaleX, ScaleY – Actors current scale</li>
<li>Colour / Color – Scenes current colour</li>
<li>Layer – Actors current visible layer</li>
<li>Visible – Actors current visible state</li>
<li>HitTest – Determines if the actor can be tapped</li>
<li>Timeline – The currently playing timeline</li>
</ul>
<p>For actors that are derived from CIwGameActorImage we have the following additional properties:</p>
<ul>
<li>SrcRect – Actors currebt bitmapped visual source rectangle</li>
<li>Size – Actors visible size on screen</li>
</ul>
<p>Any of these properties can be set as an animation target</p>
<h2>Creating a Custom Actor</h2>
<p>Whilst CIwGameScene can be instantiated and used as-is, CIwGameActor and CIwGameActorImage are abstract and cannot. The actor system is designed this way as the developer is meant to create their own custom actor types that provide bespoke functionality that is specific to their game.</p>
<p>You begin the creation of a custom actor by deriving your own actor class from either CIwGameActor or CIwGameActorImage then overloading the following methods to provide implementation:</p>
<pre>	virtual void		Init();
	virtual bool		Update(float dt);
	virtual bool		UpdateVisual();
	virtual void		ResolveCollisions() = 0;
	virtual void		NotifyCollision(CIwGameActor* other) = 0;</pre>
<p>Here&#8217;s a quick example:</p>
<pre>class MyActor : public CIwGameActor
{
public:
	MyActor() : CIwGameActor() {}
	~MyActor() {}

	void		Init()
	{
		CIwGameActor::Init();
	}

	bool		Update(float dt)
	{
		if (!CIwGameActor::Update(dt))
			return false;

		<span style="color: #008000;">// Here we put our actor specific implementation</span>

		return true;
	}

	bool		UpdateVisual()
	{
		if (!CIwGameActor::UpdateVisual())
			return false;

		<span style="color: #008000;">// Here we put our actor specific rendering code (if any is needed)</span>

		return true;
	}

	void		ResolveCollisions() {}
	void		NotifyCollision(CIwGameActor* other) {}
};</pre>
<p>We have provided a very basic implementation of Init(), Update() and UpdateVisual() which call the base CIwGameActor class methods so we keep its functionality in-tact.</p>
<p>We also provide a none functional implementation of ResolveCollisions() and NotifyCollision() as these are required methods</p>
<p>You can take the implementation one step further by implementing both the IIwGameXomlResource and IIwGameAnimTarget interfaces to allow instantiation of your custom actor class from XOML and to allow your class to be a target for animation time lines.</p>
<p>Firstly lets take a look at XOML enabling your custom actor class. To get IwGame to recognise your class whilst parsing XOML files you need to do a few things:</p>
<ul>
<li>Derive your class from IIwGameXomlResource and implement the LoadFromXoml method</li>
<li>Create a class creator that creates an instance of your class then add this to the XOML engine</li>
</ul>
<p>Lets start by taking a look at step 1.</p>
<p>Because we have derived our class from CIwGameActor we already have the support for step 1. However we would like to insert our own custom attribute tags so we need to make a few changes.</p>
<p>Lets take a look at our new class with thiose changes:</p>
<pre>class MyActor : public CIwGameActor
{
public:
	<span style="color: #008000;">// Properties</span>
protected:
	int		NumberOfEyes;
public:
	void		setNumberOfEyes(int num_eyes)	{ NumberOfEyes = num_eyes; }
	float		getNumberOfEyes() const		{ return NumberOfEyes; }
	<span style="color: #008000;">// Properties End</span>
public:
	MyActor() : CIwGameActor() {}
	~MyActor() {}

	void		Init()
	{
		CIwGameActor::Init();
	}

	bool		Update(float dt)
	{
		if (!CIwGameActor::Update(dt))
			return false;

		<span style="color: #008000;">// Here we put our actor specific implementation</span>

		return true;
	}

	bool		UpdateVisual()
	{
		if (!CIwGameActor::UpdateVisual())
			return false;

		<span style="color: #008000;">// Here we put our actor specific rendering code (if any is needed)</span>

		return true;
	}

	void		ResolveCollisions() {}
	void		NotifyCollision(CIwGameActor* other) {}

	// Implementation of IIwGameXomlResource interface
	bool		LoadFromXoml(IIwGameXomlResource* parent, bool load_children, CIwGameXmlNode* node)
	{
		if (!CIwGameActor::LoadFromXoml(parent, load_children, node))
			return false;

		<span style="color: #008000;">// Add our own custom attribute parsing</span>
		for (CIwGameXmlNode::_AttribIterator it = node-&gt;attribs_begin(); it != node-&gt;attribs_end(); it++)
		{
			unsigned int name_hash = (*it)-&gt;getName().getHash();

			if (name_hash == CIwGameString::CalculateHash("NumberOfEyes"))
			{
				setNumberOfEyes((*it)-&gt;GetValueAsInt());
			}
		}

		return true;
	}
};</pre>
<p>Our new class now basically supports a new NumberOfEyes attribute that we will eventually be able to set in XOML using something like:</p>
<pre>    &lt;<span style="color: #0000ff;">MyActor</span> Name="AlienCritter" Position="100, 100" Size="100, 100" NumberOfYes="3" /&gt;</pre>
<p>However, before we can do that we need to let the XOML system know about our new type of class (MyActor), so it can be instantiated when the XOML parser comes across it. To do this we need to create a XOML class creator:</p>
<pre>class MyActorCreator : public IIwGameXomlClassCreator
{
public:
	MyActorCreator()
	{
		setClassName("MyActor");
	}
	IIwGameXomlResource* CreateInstance(IIwGameXomlResource* parent) { return new MyActor();	}
};</pre>
<p>The creator basically defines the tag name &#8220;MyActor&#8221; and returns an instance of the MyActor class when CreateInstance() is called.</p>
<p>To get the XOML system to recognise our new creator we need to add it to the XOML parsing system using:</p>
<pre>	// Add custom MyActor to XOML system
	IW_GAME_XOML-&gt;addClass(new MyActorCreator());</pre>
<p>Now XOML integration is out of the way, lets take a quick look at enabling our class as an animation target.</p>
<p>To enable a class as an animation target we derive it from IIwGameAnimTarget and implement the UpdateFromAnimation() method. Luckily we derived our MyActor class from the CIwGameActor class which already provides this functionality.</p>
<p>Lets take a quick look at how we extend the animation update method to account for animating our NumberOfEyes variable.</p>
<pre>	bool	UpdateFromAnimation(CIwGameAnimInstance *animation)
	{
		if (CIwGameActor::UpdateFromAnimation(animation))
			return true;

		<span style="color: #008000;">// Add our own custom animating property</span>
		unsigned int element_name = animation-&gt;getTargetPropertyHash();

		if (element_name == CIwGameString::CalculateHash("NumberOfEyes"))
		{
			CIwGameAnimFrameFloat* frame = (CIwGameAnimFrameFloat*)animation-&gt;getCurrentData();
			setNumberOfEyes((int)frame-&gt;data);
			return true;
		}

		return false;
	}</pre>
<p>We added the above code to our MyActor class definition. We begin by calling the base UpdateFromAnimation() method so we can keep the existing animation properties of the actor. We then add our own custom check for the NumberOfEyes variable. If the animation property matches NumberOfEyes then we set the number of eyes to the provided interpolated value.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drmop.com/index.php/2012/04/08/iwgame-engine-tutorial-actors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

