<?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>CodeCube.NET &#187; XNA</title>
	<atom:link href="http://codecube.net/category/xna/feed/" rel="self" type="application/rss+xml" />
	<link>http://codecube.net</link>
	<description>Joel Martinez' weblog</description>
	<lastBuildDate>Fri, 03 Feb 2012 04:14:21 +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>Udder Chaos for Windows Phone</title>
		<link>http://codecube.net/2011/07/udder-chaos-for-windows-phone/</link>
		<comments>http://codecube.net/2011/07/udder-chaos-for-windows-phone/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 13:42:07 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=486</guid>
		<description><![CDATA[Now available on the Windows Phone marketplace, Udder Chaos! &#8220;Protect your cows from Alien hordes as they try to abduct your precious livestock. Alien hordes too hard? Upgrade your weapons and gain smart bombs to blow them out of the sky. Includes global leaderboards, endless mode, easier kid-mode, and option to remove ads.&#8221; The trial [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://goo.gl/yw0Ii"><img title="Udder Chaos for WP7" src="http://www.windowsphoneapplist.com/marketplace/images/udder_chaos27179.png" alt="" width="200" height="200" /></a></p>
<p>Now available on the Windows Phone marketplace, <a href="http://goo.gl/yw0Ii">Udder Chaos</a>!</p>
<blockquote><p>&#8220;Protect your cows from Alien hordes as they try to abduct your precious livestock. Alien hordes too hard? Upgrade your weapons and gain smart bombs to blow them out of the sky.</p>
<p>Includes global leaderboards, endless mode, easier kid-mode, and option to remove ads.&#8221;</p></blockquote>
<p>The trial is completely fully featured and ad-supported &#8230; and if you purchase the game, all ads are removed.</p>
<p><a href="zune://navigate?phoneAppID=1d15dc55-2ca0-e011-986b-78e7d1fa76f8"><img class="alignnone" title="Download Udder Chaos for your Windows Phone" src="http://www.windowsphoneapplist.com/forum/styles/monsmntheme/theme/images/download.png" alt="" width="160" height="50" /></a></p>
<p><em>If you&#8217;ve got an XBox 360, you can also <a href="http://goo.gl/g0DfL">download Udder Chaos on the XBox Live Indie Games</a> channel!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2011/07/udder-chaos-for-windows-phone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Udder Chaos in Peer Review</title>
		<link>http://codecube.net/2011/04/udder-chaos-in-peer-review/</link>
		<comments>http://codecube.net/2011/04/udder-chaos-in-peer-review/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 13:36:31 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=457</guid>
		<description><![CDATA[Udder Chaos for 360 has been published to peer review! http://forums.create.msdn.com/forums/t/80247.aspx If you&#8217;ve got an AppHub account, please take a moment and give us a review.]]></description>
			<content:encoded><![CDATA[<p>Udder Chaos for 360 has been published to peer review!</p>
<p><a href="http://forums.create.msdn.com/forums/t/80247.aspx">http://forums.create.msdn.com/forums/t/80247.aspx</a></p>
<p>If you&#8217;ve got an AppHub account, please take a moment and give us a review.</p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2011/04/udder-chaos-in-peer-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Udder Chaos for XBox Live Indie Games in PlayTest</title>
		<link>http://codecube.net/2011/03/udder-chaos-for-xbox-live-indie-games-in-playtest/</link>
		<comments>http://codecube.net/2011/03/udder-chaos-for-xbox-live-indie-games-in-playtest/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 04:51:29 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=427</guid>
		<description><![CDATA[Big milestone for the FlatRedBall team, Udder Chaos has been submitted for play test on XBox Live Indie Games! AppHub members can download the game for play test here, and give us feedback on the game&#8217;s forum thread here. I came onto this project rather recently, the game was mostly done.  So I&#8217;ve been working [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://codecube.net/wp-content/uploads/2011/03/ucicon.png"><img class="alignleft size-full wp-image-445" style="padding: 0 5 5 0;" title="Udder Chaos for XBox" src="http://codecube.net/wp-content/uploads/2011/03/ucicon.png" alt="" width="64" height="64" /></a>Big milestone for the <a href="http://flatredball.com">FlatRedBall team</a>, Udder Chaos has been submitted for play test on XBox Live Indie Games! <img src='http://codecube.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>AppHub members can download the game for play test <a href="http://catalog.create.msdn.com/en-US/GameDetails.aspx?catalogEntryId=468b2219-f768-48f6-bc01-845bbfa8542d&amp;type=1">here</a>, and give us feedback on the game&#8217;s forum thread <a href="http://forums.create.msdn.com/forums/t/79323.aspx">here</a>.</p>
<p><object width="480" height="390"><param name="movie" value="http://www.youtube.com/v/DcjaG7YgCj4?fs=1&amp;hl=en_US" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed type="application/x-shockwave-flash" width="480" height="390" src="http://www.youtube.com/v/DcjaG7YgCj4?fs=1&amp;hl=en_US" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>I came onto this project rather recently, the game was mostly done.  So I&#8217;ve been working for the last few weeks on the leaderboards implementation and other polish tasks and bugs along with a great team: Vic, Dave, Pablo, and Taylor (not to mention the other guys on the credits that worked on the game before I got involved).</p>
<p>One interesting part of this project has been the cross platform development. It&#8217;s a topic that I&#8217;d like to go into more detail another day, but the game builds and runs simultaneously on windows, xbox, and windows phone. There are some definite challenges to this kind of development, especially when you have to consider different input mechanisms and screen/menu layouts on the different platforms. It&#8217;s been a great experience so far, and it&#8217;s fueling some thoughts about how to structure code to facilitate cross-platform dev.</p>
<p>We plan on getting the windows phone build out after the xbox version ships. Can&#8217;t wait to see the feedback we get in playtest, and hopefully we&#8217;ll ship it soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2011/03/udder-chaos-for-xbox-live-indie-games-in-playtest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Game Hack Day</title>
		<link>http://codecube.net/2011/02/game-hack-day/</link>
		<comments>http://codecube.net/2011/02/game-hack-day/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 05:11:00 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=419</guid>
		<description><![CDATA[If you&#8217;re a game developer or artist in or near NYC, sign up for Game Hack Day: http://gamehackday.org/71fdk]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re a game developer or artist in or near NYC, sign up for Game Hack Day: <a href="http://gamehackday.org/71fdk">http://gamehackday.org/71fdk</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2011/02/game-hack-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XNA for the EveryDay Developer</title>
		<link>http://codecube.net/2010/08/xna-for-the-everyday-developer/</link>
		<comments>http://codecube.net/2010/08/xna-for-the-everyday-developer/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 13:36:30 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=373</guid>
		<description><![CDATA[I attended my first NYC Dot Net User Group last night. Nick Landry of Infusion development gave an intro talk on XNA with windows phone. It was quite amusing to listen to the organizers talk about attendee behavior because it reminded me very much of the experiences I had running the Orlando .NET user group. I [...]]]></description>
			<content:encoded><![CDATA[<p>I attended my first NYC Dot Net User Group last night. <a href="http://xnamentor.com/blogs/shapeshifter/">Nick Landry</a> of <a href="http://www.infusion.com/">Infusion development</a> gave an intro talk on XNA with windows phone.</p>
<p><img class="aligncenter" title="Nick Landry" src="http://c0013464.cdn1.cloudfiles.rackspacecloud.com/x2_2635a16" alt="" width="360" height="270" /></p>
<p>It was quite amusing to listen to the organizers talk about attendee behavior because it reminded me very much of the experiences I had running the <a href="http://onetug.org">Orlando .NET user group</a>. I guess people don&#8217;t really change, regardless of geographic location <img src='http://codecube.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Even though I&#8217;ve been living and breathing XNA for the last few years &#8230; I was reminded last night of how alien a concept game development is to many very competent developers. The concepts which seemed to need the most explaining were the mathematical aspects, and state management.</p>
<p>>In a world of pre-packaged controls, and silverlight behaviors for animation, it seemed that a lot of people had trouble grasping the concept of storing the state, which occurs separately from update, which occurs separately from the drawing. So I started thinking about how one might explain these concepts to your average day to day business application or systems developer.</p>
<p>MVC!</p>
<p>Yep, I said it &#8230; I think Model View Controller is a valid analogy that can be used to explain the way a real time game application works. Think about it:</p>
<ul>
<li>Model: In XNA demos, the &#8220;model&#8221; data usually goes into private class level fields of the Game class. This data is usually textures, 3d models, effects, audio, and position data (Matrices, Vectors). The next step that most game developers take is to abstract all that stuff out into sprite, actor, or entity classes.</li>
<li>Controller: The Update method acts as the controller. It takes user input, or in-game &#8220;events&#8221; such as collision and facilitates the calculation of the new state based on that information. This is classic &#8220;controller&#8221; responsibility.</li>
<li>View: The Draw method is clearly a &#8220;view&#8221; upon the current state of the model. In a well factored game, there are no calculations in the view. If you&#8217;re drawing 2d, you iterate over your models, request their texture and position information, and draw it with the SpriteBatch. If 3d, iterate over the models (in the MVC sense), ask them for their Models and draw that.</li>
</ul>
<p>Although the exact expression of &#8220;MVC&#8221; is not often used in the games industry, in the strictest sense, it is still a variation on the pattern. The concept could be very helpful to speakers and trainers who are teaching XNA to the uninitiated. If they can get the crowd over that initial impedance mismatch, then they can move on to more advanced topics faster, which would surely please the group.</p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/08/xna-for-the-everyday-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smooth Control with Touch</title>
		<link>http://codecube.net/2010/04/smooth-control-with-touch/</link>
		<comments>http://codecube.net/2010/04/smooth-control-with-touch/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 13:01:17 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[multitouch]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=338</guid>
		<description><![CDATA[The new touch capabilities that are present in XNA 4.0/windows phone 7 present new opportunities for letting the user take control of the games that we can write. Unlike the input from the xbox 360 gamepad, or the mouse though, the user is not restricted to incremental analog adjustments (ie. moving the mouse by 5 [...]]]></description>
			<content:encoded><![CDATA[<p>The new touch capabilities that are present in XNA 4.0/windows phone 7 present new opportunities for letting the user take control of the games that we can write. Unlike the input from the xbox 360 gamepad, or the mouse though, the user is not restricted to incremental analog adjustments (ie. moving the mouse by 5 pixels per frame, or having the left stick pushed up to a value of .5). So it is completely possible for the user to press his finger in the bottom left of the screen, drag it 20 pixels, lift for 5 seconds, and then press it down somewhere in the upper right of the screen.</p>
<p>In a naive implementation of handling touch input, you could just take the touch point as fact, and the entity would snap directly over to the user&#8217;s finger in the scenario described above. This may be visually jarring, which of course may be ok for your game. However, if you want your entity to have more of a realistic presence in the game world, to feel more &#8220;real&#8221;, the you probably don&#8217;t want it teleporting around the screen; At the same time, you want the user&#8217;s input not to feel laggy or non-responsive.</p>
<p>So how do we handle this fundamental difference in user input techniques?</p>
<p>The problem of incomplete or inconsistent input reminded me of the network prediction sample, which is available on the XNA Creator&#8217;s Club site (<a href="http://creators.xna.com/en-US/sample/networkprediction">http://creators.xna.com/en-US/sample/networkprediction</a>). In that sample, they present two solutions to deal with the issues brought on by network latency. Particularly, I was interested in their smoothing solution because it solves my problem.</p>
<blockquote><p>Smoothing is a simple concept. When a network packet is received, rather than teleporting immediately to the new position, we can interpolate gradually from the previous position toward this new location, giving the illusion of continuous motion &#8230;</p></blockquote>
<p>I took that smoothing concept and applied it here so that when the user re-touches in another location, the onscreen entity will smoothly accelerate towards his current touch point. And because it&#8217;s using interpolation, it will always catch up to the current location after half a second regardless of where the user is moving his finger.</p>
<ul>
<li>Required: Windows Phone CTP</li>
<li>Download: <a href="http://codecube.net/bloguploads/XNATouchSmoothing.zip">XNATouchSmoothing.zip</a></li>
</ul>
<p>The entity class from the project is listed below. The important bits are the &#8220;isCatchingUp&#8221; and &#8220;currentSmoothing&#8221; variables. When the input handling code realizes that it needs to catch up, it starts to decay the &#8220;currentSmoothing&#8221; variable, which is then used in the interpolation to smoothly transition to the current location (via Vector2.Lerp).</p>
<blockquote>
<pre>class Entity
{
    private Vector2 lastKnownPosition;
    private Vector2 touchPosition;
    private float currentSmoothing;

    public Vector2 Position;
    public Texture2D Texture;

    public void Update()
    {
        var touches = TouchPanel.GetState();
        float decay = 1f / 15f;

        bool isTouching = touches.Count &gt; 0;
        bool isCatchingUp = currentSmoothing &gt; 0;

        if (isTouching)
        {
            if (isCatchingUp)
            {
                currentSmoothing -= decay;
            }

            foreach (var touch in touches)
            {
                touchPosition = touch.Position;
            }
        }
        else if (!isCatchingUp)
        {
            currentSmoothing = 1;
        }

        if (!isCatchingUp)
        {
            lastKnownPosition = touchPosition;
        }

        Vector2 positionToDraw = lastKnownPosition;
        if (isCatchingUp)
        {
            Vector2.Lerp(
                ref touchPosition,
                ref lastKnownPosition,
                currentSmoothing,
                out positionToDraw);
        }

        this.Position = new Vector2(
            positionToDraw.X - Texture.Width / 2,
            positionToDraw.Y - Texture.Height / 2);
    }
}</pre>
</blockquote>
<p>Little touches like this add an extra level of polish that players will appreciate &#8230; and yes, I intended the pun <img src='http://codecube.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/04/smooth-control-with-touch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XNA Slides from Orlando CodeCamp 2010</title>
		<link>http://codecube.net/2010/03/xna-slides-from-orlando-codecamp-2010/</link>
		<comments>http://codecube.net/2010/03/xna-slides-from-orlando-codecamp-2010/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 20:54:41 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[codecamp]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=328</guid>
		<description><![CDATA[The 2010 Orlando CodeCamp has now come to an end. It was a great event, and I&#8217;m glad I was a part of it. Many congratulations go out to Esteban, Will, and the rest of the board and volunteers that put it together. With almost 600 .NET developers in attendance, it shows that the central [...]]]></description>
			<content:encoded><![CDATA[<p>The 2010 Orlando CodeCamp has now come to an end. It was a great event, and I&#8217;m glad I was a part of it. Many congratulations go out to Esteban, Will, and the rest of the board and volunteers that put it together. With almost 600 .NET developers in attendance, it shows that the central florida area is brimming with talent.</p>
<p>I&#8217;ve uploaded the slides to my presentation which was titled, &#8220;<em>How to Finish a Game with XNA</em>&#8220;. You can download them here:<br />
<a href="http://codecube.net/wp-content/uploads/2010/03/XNA_CodeCamp_2010_Slides.ppt">XNA_CodeCamp_2010_Slides</a></p>
<p>If you attended the meeting, please don&#8217;t hesitate to contact me if you have a question about XNA, Windows Phone, or any other topic that we spoke about <img src='http://codecube.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/03/xna-slides-from-orlando-codecamp-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7 Game Archetypes</title>
		<link>http://codecube.net/2010/03/windows-phone-7-game-archetypes/</link>
		<comments>http://codecube.net/2010/03/windows-phone-7-game-archetypes/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 23:00:11 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[gamedev]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=316</guid>
		<description><![CDATA[Now that the .NET landscape has a new &#8220;screen&#8221; to design for in the form of Windows Phone 7 (WM6.x doesn&#8217;t count ), we need to start thinking about how to provide users with consistent metaphors and input mechanisms. Microsoft&#8217;s patterns and practices group wrote the book on web and desktop application architectures (literally). One [...]]]></description>
			<content:encoded><![CDATA[<p>Now that the .NET landscape has a new &#8220;screen&#8221; to design for in the form of Windows Phone 7 (WM6.x doesn&#8217;t count <img src='http://codecube.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ), we need to start thinking about how to provide users with consistent metaphors and input mechanisms.</p>
<p>Microsoft&#8217;s patterns and practices group wrote the book on web and desktop application architectures (<a href="http://apparchguide.codeplex.com/">literally</a>). One of the sections in that book is application archetypes which describes the types of applications that you can build. This is useful because an ecosystem can spring up around each archetype (controls, usability studies, tutorials) which can provide a lot of feedback and guidance for new projects to follow.</p>
<p>To that end I wanted to start a list of the different archetypes that might be available to choose from when designing a game for windows phone 7. Don&#8217;t confuse this with a discussion about game genres &#8230; those are already well known and documented. This list covers types of applications, game mechanics, and input styles that you can use to directly affect your game&#8217;s design in a fundamental way.</p>
<ul>
<li><strong>The Mini-Console</strong><br />
If you already have a game that you&#8217;ve written (using XNA for example) and you want to do a direct port to the phone, then you are writing a Mini-Console game. Games like this will generally be played in landscape mode, which gives the developer enough room to provide a virtual d-pad and button(s) on the bottom left/right of the screen. The idea here is that the user will feel like they are playing a handheld console like the DS or PSP.</li>
<li><strong>The ARG</strong><br />
Alternate Reality Games are growing in popularity. They typified by involving real world elements in one way or another. This can involve using the player&#8217;s real world lat-lon location to have in-game effects (using the <a href="http://msdn.microsoft.com/en-us/library/system.device.location%28v=VS.92%29.aspx">System.Device.Location namespace</a>), or using the device&#8217;s camera as an input mechanism. I don&#8217;t see much of these, but it&#8217;s an interesting space which I hope more people will investigate.</li>
<li><strong>The Physical</strong><br />
These types of games involve the user physically manipulating either the screen, or the device itself to affect the game play. Games like this have to take this analog data and approximate the user&#8217;s intent in making that motion or touch. I often see games which should be mini-consoles try to use this type of physical input just because they can &#8230; and it sometimes results in awkward gameplay. More research and testing needs to be done in this space to figure out what works and what doesn&#8217;t. For an example of the types of things we should be thinking about, check out my article on <a href="http://codecube.net/2010/03/approximating-touch-points/">approximating touch points</a>.</li>
<li><strong>The Casual</strong><br />
Casual Games are tearing their way through the game industry. Read this report from the recent game developer&#8217;s conference for some of that commentary (<a rel="nofollow" href="http://www.designer-notes.com/?p=195" target="_blank">http://www.designer-notes.com/?p=195</a>). Regardless of which side of that divide you land on, I think one thing everyone can agree on is that casual games are here to stay. WP7&#8242;s push notifications and <a href="http://www.ozymandias.com/asynchronous-games-future-of-casual-gaming">asynchronous game</a> features will be very useful for games like these.</li>
</ul>
<p>I&#8217;d love to keep updating this post with links to more resources on each archetype &#8230; if you find something please don&#8217;t hesitate to post it as a comment and I will update the post as time goes on <img src='http://codecube.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/03/windows-phone-7-game-archetypes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Approximating Touch Points</title>
		<link>http://codecube.net/2010/03/approximating-touch-points/</link>
		<comments>http://codecube.net/2010/03/approximating-touch-points/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 23:00:27 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[multitouch]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=310</guid>
		<description><![CDATA[The Windows Phone 7 Phone UI Guidelines calls out that the minimum touch target size should be about 9mm (34px) and I started to think about what it would take to implement this in an XNA game. Of course the first thing that comes to mind is that I can define a simple bounding box [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-thumbnail wp-image-313" title="phone7" src="http://codecube.net/wp-content/uploads/2010/03/phone7-150x150.jpg" alt="" width="150" height="150" /> The <a href="http://go2.wordpress.com/?id=725X1342&amp;site=designingagile.wordpress.com&amp;url=http%3A%2F%2Fbit.ly%2FbHGWOF">Windows Phone 7 Phone UI Guidelines</a> calls out that the minimum touch target size should be about 9mm (34px) and I started to think about what it would take to implement this in an XNA game. Of course the first thing that comes to mind is that I can define a simple bounding box for each entity that wishes to be touched. This box would have to be of the correct size, and would have to be kept in sync with the entity&#8217;s position on the screen. Easy enough I guess.</p>
<p>One of the things that I&#8217;ve been thinking a lot about recently is writing software that, instead of strictly defining things can infer a user&#8217;s intent. As I pondered the solution above, it occurred to me that defining a bounding box exactly 34 pixels in size was doing just that &#8230; limiting the ability for the software to infer the user&#8217;s intent in touching the screen. What if his touch point is 35 pixels away from his intended target?</p>
<p>Instead, what if you compare the user&#8217;s touch point against the entity positions and simply select the closest one (regardless of whether it&#8217;s 35 or 36 pixels away)?</p>
<p>The method below does just that given an array of entities and a touch location:</p>
<blockquote>
<pre>private static Entity FindNearestEntity(Entity[] entities, ref TouchLocation touch)
{
    Entity selectedEntity = null;
    float currentDistance = 0;

    // The entity with the nearest
    for (int i = 0; i &lt; entities.Length; i++)
    {
        var entity = entities[i];

        float distance = Vector2.DistanceSquared(touch.Position, entity.Position);
        if (distance &lt; currentDistance)
        {
            selectedEntity = entity;
            currentDistance = distance;
        }
    }
    return selectedEntity;
}</pre>
</blockquote>
<p>This assumes single finger data entry, meaning that it&#8217;s probably best served for things like menus and options.</p>
<p>It&#8217;s pretty exciting now that XNA has these touch APIs available to it. I am looking forward to doing more research in this space, and playing around with different &#8220;natural user interfaces&#8221;.</p>
<p>For some great additional resources, be sure to drop by the natural user interface group on the web at: <a href="http://nuigroup.com/">http://nuigroup.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/03/approximating-touch-points/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7 Flashlight</title>
		<link>http://codecube.net/2010/03/windows-phone-7-flashlight/</link>
		<comments>http://codecube.net/2010/03/windows-phone-7-flashlight/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 21:09:51 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=307</guid>
		<description><![CDATA[Now that the developer tools for Windows Phone 7 are out in the wild, I wondered how long before we see the ubiquitous &#8220;flashlight&#8221; app. I decided to grab the bull by the horns and put it out there myself. So find below the steps required to make your own flashlight app Create a new [...]]]></description>
			<content:encoded><![CDATA[<p>Now that the developer tools for Windows Phone 7 are <a href="http://developer.windowsphone.com">out in the wild</a>, I wondered how long before we see the ubiquitous &#8220;flashlight&#8221; app. I decided to grab the bull by the horns and put it out there myself. So find below the steps required to make your own flashlight app</p>
<ol>
<li>Create a new XNA Game Project for the phone</li>
<li>Add this line of code to the Draw method:</li>
</ol>
<pre>graphics.GraphicsDevice.<strong>Clear</strong>(Color.White);
</pre>
<p>And BAM! that&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/03/windows-phone-7-flashlight/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

