<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://xnaessentials.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>XNA Essentials</title><link>http://xnaessentials.com/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>XNA Game Studio 3.0 Unleashed Source Code Released as Open Source</title><link>http://xnaessentials.com/archive/2012/03/30/XNA_2D00_Game_2D00_Studio_2D00_30_2D00_Unleashed_2D00_Source_2D00_Code_2D00_Released_2D00_as_2D00_Open_2D00_Source.aspx</link><pubDate>Fri, 30 Mar 2012 21:48:14 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:28803</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=28803</wfw:commentRss><comments>http://xnaessentials.com/archive/2012/03/30/XNA_2D00_Game_2D00_Studio_2D00_30_2D00_Unleashed_2D00_Source_2D00_Code_2D00_Released_2D00_as_2D00_Open_2D00_Source.aspx#comments</comments><description>&lt;p&gt;I’m pleased to announce that the XNA Game Studio 3.0 Unleashed book’s source code has been released under the Ms-PL license on CodePlex.&lt;/p&gt;  &lt;p&gt;So you can use Git and create a clone locally to start working with it or you can fork it and update it for XNA 4.0.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xnags30unleashed.codeplex.com/" target="_blank"&gt;Have fun with it!&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;-Chad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=28803" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/Book/default.aspx">Book</category><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/Download/default.aspx">Download</category><category domain="http://xnaessentials.com/archive/tags/CD/default.aspx">CD</category></item><item><title>Creating a Selection Wheel in XNA</title><link>http://xnaessentials.com/archive/2011/07/14/creating-a-selection-wheel-in-xna.aspx</link><pubDate>Thu, 14 Jul 2011 16:10:00 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:28770</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=28770</wfw:commentRss><comments>http://xnaessentials.com/archive/2011/07/14/creating-a-selection-wheel-in-xna.aspx#comments</comments><description>&lt;p&gt;This tutorial will describe the process where you create a selection wheel to be used with a Gamepad controller.&amp;#160; This will allow you to create conversation wheels, power wheels, weapon wheels, command wheels, etc in your games.&lt;/p&gt;  &lt;p&gt;Note this demo requires a Gamepad, so you will either need to have one hooked up to Windows or run this on the Xbox 360 (which requires an &lt;a href="http://create.msdn.com/en-us/home/membership" target="_blank"&gt;AppHub membership&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;Games such as &lt;a href="http://masseffect.bioware.com/" target="_blank"&gt;Mass Effect&lt;/a&gt;, &lt;a href="http://assassinscreed.ubi.com/" target="_blank"&gt;Assassins Creed&lt;/a&gt; and &lt;a href="http://dragonage.bioware.com/" target="_blank"&gt;Dragon Age&lt;/a&gt; all use selection wheels. I thought it was extremely clever the first time I saw it used in a game and I definitely enjoy games that utilize it.&lt;/p&gt;  &lt;p&gt;Here is an example of a selection wheel inside of BioWare’s Dragon Age: Origins:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/7245.image_5F00_5A5465DE.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="image" border="0" alt="image" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/8814.image_5F00_thumb_5F00_376F902F.png" width="549" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The wheel is populated with all of the valid choices but items that can’t be selected are dimmed.&amp;#160; From this wheel the player can select items which can either select that item or bring up new selections in the wheel.&amp;#160; For example, if the user selected the health item at the bottom (assuming it was enabled because the character was in combat) then it would immediately apply the health potion to the character and the wheel would disappear.&amp;#160; However, if the user selected the Potions selection on the left the items in the wheel would be replaced by the available potions the user had.&amp;#160; For Dragon Age, the gamer brings up this wheel by holding down the Left Trigger.&lt;/p&gt;  &lt;p&gt;Here is an example of a command wheel in BioWare’s&amp;#160; Mass Effect:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/8715.image_5F00_455E0DC5.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="image" border="0" alt="image" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/7750.image_5F00_thumb_5F00_0F388177.png" width="437" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This is a wheel that has a lot more options but the premise is the same.&amp;#160; Move the Gamepad controller around the edges to select the item.&amp;#160; In this case there is no “drill down” option and any selection is a final selection and the wheel closes. The gamer brings up this wheel by hitting the Right Bumper (RB) button.&lt;/p&gt;  &lt;p&gt;If the user presses the Left Bumper (LB) button then Mass Effect’s weapon wheel is brought up:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/2548.image10_5F00_5214044A.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="image" border="0" alt="image" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/7713.image10_5F00_thumb_5F00_3F4EE4C6.png" width="627" height="354" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Another example is one from Ubisoft’s Assassin’s Creed.&amp;#160; The example I’m showing here is from Assassin’s Creed 2:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/2626.image_5F00_663932A1.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="image" border="0" alt="image" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/5661.image_5F00_thumb_5F00_436482BF.png" width="634" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When an item isn’t available, they just hide that item from the wheel altogether (instead of showing a disabled icon).&amp;#160; This also simply selects what is desired and closes the wheel.&lt;/p&gt;  &lt;p&gt;The final examples I will show are the conversation wheels from BioWare’s Dragon Age 2 and Mass Effect:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/5270.image18_5F00_6890B2C4.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/2146.image18_5F00_thumb_5F00_5CEACFB8.png" width="244" height="114" /&gt;&lt;/a&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/0167.image24_5F00_61ED0D67.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/2630.image24_5F00_thumb_5F00_2042AB4E.png" width="244" height="114" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In these images only three items on the right are available.&amp;#160; When more conversation items are available they will show up on the left.&amp;#160; The point here is that you can utilize the same input mechanics in a wide variety of games.&amp;#160; I’ll attempt to explain how you can do so. &lt;/p&gt;  &lt;h2&gt;Let’s get to it already!&lt;/h2&gt;  &lt;p&gt;The example code I’ll be showing today doesn’t take into consideration any selection / disabled / non-visible items but it would be pretty easy to add that in.&amp;#160; Instead it focuses on the code to map the Left Thumb Stick’s X and Y coordinates to the selection wheel.&amp;#160; It will show how to convert the X and Y values from the thumbstick to an angle and then utilize that angle to point to the different items in our wheel.&amp;#160; The current item that is pointed to will be displayed beside the wheel.&amp;#160; &lt;/p&gt;  &lt;p&gt;To start out I create the actual wheel in Paint.NET.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/6330.image_5F00_28E0300F.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="image" border="0" alt="image" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/2022.image_5F00_thumb_5F00_20E88DAD.png" width="516" height="516" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And this is why I am a software engineer and not a graphic designer.&lt;/p&gt;  &lt;p&gt;The download at the bottom includes the actual wheel.pdn (Paint .NET file) with the different layers.&amp;#160; The actual content project will use two different files created from this original artwork.&amp;#160; The first is the selection wheel itself (selection.png).&amp;#160; The second is the arrow (selector.png).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/4375.image68_5F00_2544E8FD.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/1641.image68_5F00_thumb_5F00_4B3A9953.png" width="244" height="244" /&gt;&lt;/a&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/5850.image71_5F00_635E03AE.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/4377.image71_5F00_thumb_5F00_7B153B14.png" width="244" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Note for the blog, these have white backgrounds but in the download they are transparent. So make sure you grab the files from there and not by saving these images.&lt;/p&gt;  &lt;p&gt;After creating the artwork I then started on the code (which was much easier I must say).&amp;#160; A real artist would have had no problem lining up the inner circle to the outer circle but I struggled and still am not confident it is perfectly centered. Ah to really know the tools you use is beneficial and I don’t know any image editing software very well.&lt;/p&gt;  &lt;p&gt;So create a new Windows or Xbox 360 Game project in Visual Studio.&amp;#160; I called mine SelectionWheel.&amp;#160; Inside of the Content Project (i.e. SelectionWheelContent) add the artwork selection.png and selector.png.&amp;#160; Also add in a new SpriteFont called font.&amp;#160; (Right click on SelectionWheelContent and select Add New Item then select Sprite Font from the list. and change the name from spritefont1 to font) &lt;/p&gt;  &lt;p&gt;Open up the font xml file (font.spritefont) and change the size to 32.&amp;#160; That is all of the content we need for this tutorial.&lt;/p&gt;  &lt;p&gt;Now open up the Game1.cs file and add the following member fields to the class:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color:#2b91af;"&gt;Texture2D &lt;/span&gt;selection;
&lt;span style="color:#2b91af;"&gt;Texture2D &lt;/span&gt;selector;
&lt;span style="color:#2b91af;"&gt;SpriteFont &lt;/span&gt;font;&lt;/pre&gt;

&lt;p&gt;Now we are going to add the integer values we will be selecting on the wheel. Add the following constants to the class:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;const int &lt;/span&gt;ROUNDED = 0; &lt;span style="color:green;"&gt;//start with the selection on the right first 
&lt;/span&gt;&lt;span style="color:blue;"&gt;const int &lt;/span&gt;ELIPSE = 1; &lt;span style="color:green;"&gt;//work your way counter-clockwise 
&lt;/span&gt;&lt;span style="color:blue;"&gt;const int &lt;/span&gt;SQUARE = 2;
&lt;span style="color:blue;"&gt;const int &lt;/span&gt;STAR = 3;
&lt;span style="color:blue;"&gt;const int &lt;/span&gt;INFINITY = 4;
&lt;span style="color:blue;"&gt;const int &lt;/span&gt;ABSTRACT = 5;
&lt;span style="color:blue;"&gt;const int &lt;/span&gt;PLUS = 6;
&lt;span style="color:blue;"&gt;const int &lt;/span&gt;CLOUD = 7;&lt;/pre&gt;

&lt;br /&gt;We could modify this to have more items on the wheel.&amp;#160; Currently this is only 8 items for the main 8 directions of the thumbstick but we could add several more items and modify the math we will see a little later to accommodate the additional items. Notice how we start numbering them with the item on the right first.&amp;#160; The math involved starts with angle value of 0 on right. As you move counter-clockwise (moving up and to the left the radians / angle increases).&amp;#160; We will talk more about this a little later. 

&lt;p&gt;Next we need to create a member field to store the list of selections.&amp;#160; In this case we are just storing strings of the selection, but this could be any kind of object you desire. We will also add in a variable to store our radians and index of our selection.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:#2b91af;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;int&lt;/span&gt;, &lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;gt; selections = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;int&lt;/span&gt;, &lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;float &lt;/span&gt;radians = 0;
&lt;span style="color:blue;"&gt;int &lt;/span&gt;index;&lt;/pre&gt;

&lt;p&gt;Let’s initialize those selections by adding a new method InitializeSelections that we will call from the Initialize method in the game class:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;void &lt;/span&gt;InitializeSelections()
{
    selections = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;int&lt;/span&gt;, &lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;gt;();
    selections.Add(ROUNDED, &lt;span style="color:#a31515;"&gt;&amp;quot;ROUNDED&amp;quot;&lt;/span&gt;);
    selections.Add(ELIPSE, &lt;span style="color:#a31515;"&gt;&amp;quot;ELIPSE&amp;quot;&lt;/span&gt;);
    selections.Add(SQUARE, &lt;span style="color:#a31515;"&gt;&amp;quot;SQUARE&amp;quot;&lt;/span&gt;);
    selections.Add(STAR, &lt;span style="color:#a31515;"&gt;&amp;quot;STAR&amp;quot;&lt;/span&gt;);
    selections.Add(INFINITY, &lt;span style="color:#a31515;"&gt;&amp;quot;INFINITY&amp;quot;&lt;/span&gt;);
    selections.Add(ABSTRACT, &lt;span style="color:#a31515;"&gt;&amp;quot;ABSTRACT&amp;quot;&lt;/span&gt;);
    selections.Add(PLUS, &lt;span style="color:#a31515;"&gt;&amp;quot;PLUS&amp;quot;&lt;/span&gt;);
    selections.Add(CLOUD, &lt;span style="color:#a31515;"&gt;&amp;quot;CLOUD&amp;quot;&lt;/span&gt;);

    index = 0; &lt;span style="color:green;"&gt;// default to selecting the value on the right (ROUNDED)
&lt;/span&gt;}&lt;/pre&gt;

&lt;p&gt;Inside of our Game1 constructor we can set the preferred backbuffer width and height if we want.&amp;#160; My setup supports 1920x1080 so that is what I’m setting.&amp;#160; The XNA Framework will select the highest resolution supported by the output device if the resolution asked for isn’t supported.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:green;"&gt;//Will be scaled down if not supported
&lt;/span&gt;graphics.PreferredBackBufferWidth = 1920;
graphics.PreferredBackBufferHeight = 1080;

graphics.ApplyChanges();&lt;/pre&gt;

&lt;p&gt;Next we can actually load the content we created by adding the following code in the LoadContent method:&lt;/p&gt;

&lt;pre class="code"&gt;selection = Content.Load&amp;lt;&lt;span style="color:#2b91af;"&gt;Texture2D&lt;/span&gt;&amp;gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;selection&amp;quot;&lt;/span&gt;);
selector = Content.Load&amp;lt;&lt;span style="color:#2b91af;"&gt;Texture2D&lt;/span&gt;&amp;gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;selector&amp;quot;&lt;/span&gt;);

font = Content.Load&amp;lt;&lt;span style="color:#2b91af;"&gt;SpriteFont&lt;/span&gt;&amp;gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;font&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

&lt;p&gt;We will save the Update method for the last since that is where the bulk of our work will be done.&amp;#160; For now, let’s add the following code to our Draw method which will draw the actual selection wheel, &lt;/p&gt;

&lt;pre class="code"&gt;spriteBatch.Begin();
spriteBatch.DrawString(font, selections[index], &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Vector2&lt;/span&gt;(530, 0), &lt;span style="color:#2b91af;"&gt;Color&lt;/span&gt;.Red);
spriteBatch.Draw(selection, &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Rectangle&lt;/span&gt;(0, 0, 512, 512), &lt;span style="color:#2b91af;"&gt;Color&lt;/span&gt;.White);
spriteBatch.Draw(selector, &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Rectangle&lt;/span&gt;(256, 256, 512, 512), &lt;span style="color:blue;"&gt;null&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;Color&lt;/span&gt;.White,
                        -radians, &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Vector2&lt;/span&gt;(256,256), &lt;span style="color:#2b91af;"&gt;SpriteEffects&lt;/span&gt;.None, 0);
spriteBatch.End();&lt;/pre&gt;

&lt;p&gt;The selection is being drawn based on the current index selected (initialized to 0).&amp;#160; The selection wheel is drawn and the selector is drawn right on top of it. The selector is being rotated by the negative radians amount.&amp;#160; The radians value will be populated in the Update method next.&amp;#160; It is being drawn offset so it will be in the center of the selection wheel and the origin of the selector was set to half of the texture size (256,256) so it would rotate around the middle. The selector image could be trimmed and these values modified to save some room but for this example I wanted to keep it clear as to how it is working.&lt;/p&gt;

&lt;p&gt;Now we get to the real part of the tutorial.&amp;#160; Here comes the big complicated math to make this work.&amp;#160; It really isn’t complicated or I wouldn’t be able to do it – so don’t worry!&lt;/p&gt;

&lt;p&gt;Inside of the Update method let’s grab the state of our Gamepad:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:#2b91af;"&gt;GamePadState &lt;/span&gt;gp = &lt;span style="color:#2b91af;"&gt;GamePad&lt;/span&gt;.GetState(&lt;span style="color:#2b91af;"&gt;PlayerIndex&lt;/span&gt;.One);

&lt;span style="color:green;"&gt;// Allows the game to exit
&lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(gp.Buttons.Back == &lt;span style="color:#2b91af;"&gt;ButtonState&lt;/span&gt;.Pressed || &lt;span style="color:#2b91af;"&gt;Keyboard&lt;/span&gt;.GetState().IsKeyDown(&lt;span style="color:#2b91af;"&gt;Keys&lt;/span&gt;.Escape))
    &lt;span style="color:blue;"&gt;this&lt;/span&gt;.Exit();&lt;/pre&gt;

&lt;p&gt;The above code should replace the existing GamePad.GetState condition in the Update method.&lt;/p&gt;

&lt;p&gt;Next we need to calculate the index we are currently pointing to so the arrow.&amp;#160; In order to determine the index we first need to convert our Thumbstick’s X and Y values (which go from -1.0 to 1.0) to an angle value in radians.&amp;#160; Let’s start off calculating the radian value and then work our way up to determining the index.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:green;"&gt;//Get radians from thumbstick
&lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(gp.ThumbSticks.Left.Y != 0 || gp.ThumbSticks.Left.X != 0)
    radians = (&lt;span style="color:blue;"&gt;float&lt;/span&gt;)(&lt;span style="color:#2b91af;"&gt;Math&lt;/span&gt;.Atan2(gp.ThumbSticks.Left.Y, gp.ThumbSticks.Left.X));&lt;/pre&gt;

&lt;p&gt;First, we only want to change our radians value if the thumstick is off center.&amp;#160; If it is centered, but the X and Y values will return 0.&amp;#160; Assuming the stick is actually being pushed in a particular direction we want to determine the angle.&amp;#160; The MathHelper.Atan2 method is extremely helpful.&amp;#160; This is why I love the XNA Framework. There is no need to write code for the trigonometry behind this calculation we can simply use it.&amp;#160; A good explanation of the Atan2 function can be found in the &lt;a href="http://create.msdn.com/en-US/education/catalog/" target="_blank"&gt;AppHub’s educational catalog&lt;/a&gt;.&amp;#160; The &lt;a href="http://create.msdn.com/education/catalog/sample/aiming" target="_blank"&gt;Aiming example&lt;/a&gt; has a TurnToFace method which actually includes a diagram in source code :)&amp;#160; The help for the Atan2 method is also helpful: &lt;a title="http://msdn.microsoft.com/en-us/library/system.math.atan2.aspx" href="http://msdn.microsoft.com/en-us/library/system.math.atan2.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.math.atan2.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point we have our angle value (in radians).&amp;#160; You can totally just work with radians but most people (myself included) find it easier to work in degrees.&amp;#160; As a bonus, I’ll show how to work with radians at the end.&amp;#160; For now, to get the angle in degrees we need to add the following code to our Update method:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:green;"&gt;//convert to angle from radians to degrees
&lt;/span&gt;&lt;span style="color:blue;"&gt;float &lt;/span&gt;degrees = radians * 180.0f / (&lt;span style="color:blue;"&gt;float&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;Math&lt;/span&gt;.PI;

&lt;span style="color:green;"&gt;//changes -90 to 270
&lt;/span&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(degrees &amp;lt; 0) &lt;span style="color:green;"&gt;//Atan2 returns negative for quadrant 3 and 4 
    &lt;/span&gt;degrees += 360; &lt;span style="color:green;"&gt;//so make it positive by adding 360 to it (get values 270-360); 
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;To convert from radians to degrees we only need to multiply the radians value by 180 and then divide that by Pi (~3.14).&amp;#160; Atan2 returns negative values for quadrant 3 and 4. So basically 181-359 degrees comes out as -180 to -1. (Atan2 returns values from -Pi to Pi to give you a full circle basically&amp;#160; -180 to 0 to 180 instead of 0 to 360).&lt;/p&gt;

&lt;p&gt;We check to see if our degrees value is less than 0 and if so we add 360 to it.&amp;#160; This converts -179.99 to 180.01 and&amp;#160; -90 to 270 and -0.01 to 359.99. So we get a full 0 to 359.999 degrees in our circle.&lt;/p&gt;

&lt;p&gt;Now that we have a value in degrees we need to convert that to an index so we can determine which value in our list of selections is actually selected.&amp;#160; The selection item is simply a string but it could be desired to store another type of object complete with its own properties and methods. This object could contain a flag as to if it was enabled and/or visible. It could contain an image that would be displayed on the wheel instead of a static wheel like we currently have. For now, we are keeping the tutorial simple and are just storing a string value.&lt;/p&gt;

&lt;p&gt;Assuming our indices match up to our selections we can add the following code to our Update method:&lt;/p&gt;

&lt;pre class="code"&gt;index = (&lt;span style="color:blue;"&gt;int&lt;/span&gt;)((degrees + 22.5f) / 45);&lt;/pre&gt;

&lt;p&gt;So there are two things happening here.&amp;#160; The first is we are dividing by 45 degrees.&amp;#160; This is because we have 8 items in our wheel.&amp;#160; 8 goes into 360 45 times.&amp;#160; So each item takes up 45 degrees of the wheel.&amp;#160; This is all we would need if the selection of the first item (on the right) started at position 0.&amp;#160; However, position 0 is right in the middle of the first selection (ROUNDED in our case).&amp;#160; So in order to offset our angle we are adding an offset of 22.5 degrees before dividing by our 45 degrees.&amp;#160; 22.5 is half of 45.&amp;#160; Since 0 splits the ROUNDED item in half, we want half.&amp;#160; &lt;/p&gt;

&lt;p&gt;We could make this a little more dynamic if we wanted to.&amp;#160; Let’s say we had 12 items in our list instead of 8.&amp;#160; Assuming we added the constants and the new strings to our list and updated our image as well we could have the following code:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;float &lt;/span&gt;itemDegree = 360.0f/selections.Count;
&lt;span style="color:blue;"&gt;float &lt;/span&gt;offset = itemDegree / 2.0f;
index = (&lt;span style="color:blue;"&gt;int&lt;/span&gt;)((degrees + offset) / itemDegree);&lt;/pre&gt;

&lt;p&gt;So we determine how many degrees an item takes up (itemDegree) by dividing 360 by the number of selections we have (8, 12, etc). We then determine the offset (assuming we always start with index 0 is on the right) by dividing the number of degrees and item takes up (itemDegree) in half.&amp;#160; We then plug in the itemDegree and offset into the same formula above where we hard coded the values.&amp;#160; So this would be beneficial if you are reusing the selection wheel in your code for let’s say a weapon wheel and a conversation wheel.&amp;#160; You could pass in your weapons values or your conversations values and the code will figure out which index should be selected.&lt;/p&gt;

&lt;p&gt;There is one more thing we need to do to determine our index.&amp;#160; Since we added that offset value to our index we can get an invalid index value of 8 once we hit 337.5 (360-22.5) degrees or higher.&amp;#160; So we need to roll over our index back to 0 since we are on the bottom part of our first selection item (ROUNDED).&amp;#160; Add this to the Update method:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;if &lt;/span&gt;(index == selections.Count)
    index = 0; &lt;span style="color:green;"&gt;//since we are adding in 22.5, we will go over, so reset it&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Should you not like using a condition you can do a bit AND to accomplish the same task.&amp;#160; It is a little less readable but it isn’t too bad:&lt;/p&gt;

&lt;pre class="code"&gt;index = (&lt;span style="color:blue;"&gt;int&lt;/span&gt;)((degrees + 22.5f) / 45) &amp;amp; (selections.Count -1 );&lt;/pre&gt;

&lt;p&gt;This does a bit AND of 7 (we have 8 selections) so this will return 0 to 7 which is what we are after.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/6740.image_5F00_21E35155.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/2627.image_5F00_thumb_5F00_579896AF.png" width="644" height="378" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you run the game you should be able to select any point on the wheel with the gamepad and have the text update as you move the thumbstick.&lt;/p&gt;

&lt;h2&gt;Degrees are for wimps, I only use Radians!&lt;/h2&gt;

&lt;p&gt;If for some reason you enjoy working with radians and converting to degrees seems wrong to you then you could use the following:&lt;/p&gt;

&lt;pre class="code"&gt;index2 = (&lt;span style="color:blue;"&gt;int&lt;/span&gt;)((radians + &lt;span style="color:#2b91af;"&gt;MathHelper&lt;/span&gt;.TwoPi + (0.3926990816987241f)) / &lt;span style="color:#2b91af;"&gt;MathHelper&lt;/span&gt;.PiOver4) 
                                                                &amp;amp; (selections.Count - 1);&lt;/pre&gt;

&lt;p&gt;I just used the same formula we used for degrees but instead of adding 360 I added TwoPi.&amp;#160; This is ok since at the end I bit AND the value by my selection count - 1.&amp;#160; So it handles overflows just fine. MathHelper.PiOver4 (Pi/4) is 45 degrees.&amp;#160; The obnoxious number of ~0.392 is the offset of PiOver4 / 2.&lt;/p&gt;

&lt;p&gt;By the way, if converting radians to degrees is wrong, then I don’t want to be right. This is one of those micro optimizations that most likely isn’t worth it and you shouldn’t sacrifice readability unless you have an extreme situation. &lt;/p&gt;

&lt;h2&gt;Wrap Up&lt;/h2&gt;

&lt;p&gt;So grab the code and toy around with it.&amp;#160; Some things to try:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Embed this code inside a condition that checks if the Left Trigger or Left Bumper being pressed. &lt;/li&gt;

  &lt;li&gt;Add in the actual selection code of what happens when the user presses A. &lt;/li&gt;

  &lt;li&gt;Use actual objects and add an Enabled flag to determine if you want the user to be able to select that value. Either keep the arrow from moving to those locations and hide the selections or just dim them and don’t let the user select them. &lt;/li&gt;

  &lt;li&gt;Have fun with it! &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="http://xnaessentials.com/download.ashx?fileid=34"&gt;Download the Source Code and Assets&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

&lt;p&gt;-Chad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=28770" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/Education/default.aspx">Education</category><category domain="http://xnaessentials.com/archive/tags/Tutorial/default.aspx">Tutorial</category><category domain="http://xnaessentials.com/archive/tags/App+Hub/default.aspx">App Hub</category></item><item><title>Windows Phone 7 Developer Sweepstakes end June 30th, 2011</title><link>http://xnaessentials.com/archive/2011/06/28/Windows_2D00_Phone_2D00_7_2D00_Developer_2D00_Sweepstakes_2D00_end_2D00_June_2D00_30th_2D00_2011.aspx</link><pubDate>Tue, 28 Jun 2011 06:54:57 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:28761</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=28761</wfw:commentRss><comments>http://xnaessentials.com/archive/2011/06/28/Windows_2D00_Phone_2D00_7_2D00_Developer_2D00_Sweepstakes_2D00_end_2D00_June_2D00_30th_2D00_2011.aspx#comments</comments><description>&lt;p&gt;If you are almost done with your Windows Phone 7 App or Game, you may want to put a little extra effort into finishing it up and get it certified so you can beat the deadline.&lt;/p&gt;  &lt;p&gt;Microsoft’s fiscal year ends June 30th and so do this promotion:&lt;/p&gt;  &lt;p&gt;Use Code: &lt;strong&gt;5DXDN&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;URL: &lt;a href="http://bit.ly/WP7DevOffer"&gt;http://bit.ly/WP7DevOffer&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you have&lt;strong&gt; 1 app&lt;/strong&gt; in the marketplace you can win a Samsung Focus. (Details &amp;amp; Rules on the site)&lt;/p&gt;  &lt;p&gt;If you have &lt;strong&gt;2 apps&lt;/strong&gt; in the marketplace you get a refund on your Marketplace account fee. &lt;/p&gt;  &lt;p&gt;Register on this site for that: &lt;a href="http://phone.microsoftplatformready.com/Offers.aspx"&gt;http://phone.microsoftplatformready.com/Offers.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you have &lt;strong&gt;5 or more apps&lt;/strong&gt; you can get Free Advertising for one of your apps!&lt;/p&gt;  &lt;p&gt;Enter in the WP7 Sweepstakes (Code: 5DXDN; URL: &lt;a href="http://bit.ly/WP7DevOffer"&gt;http://bit.ly/WP7DevOffer&lt;/a&gt; )&amp;#160; &lt;/p&gt;  &lt;p&gt;If you publish(ed) 5 new apps between April 1 and June 30 you get FREE advertising for one of those apps or games.&lt;/p&gt;  &lt;p&gt;So if you are almost done – push through and get it done!&lt;/p&gt;  &lt;p&gt;Happy Coding!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=28761" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/WP7/default.aspx">WP7</category></item><item><title>Shake that Camera</title><link>http://xnaessentials.com/archive/2011/04/26/shake-that-camera.aspx</link><pubDate>Wed, 27 Apr 2011 03:40:59 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:28757</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=28757</wfw:commentRss><comments>http://xnaessentials.com/archive/2011/04/26/shake-that-camera.aspx#comments</comments><description>&lt;p&gt;I was browsing the educational catalog on the App Hub and I saw something that I had missed previously.&amp;#160; I wanted to point it out and also point out that if you haven’t been to the educational catalog section in a while, you should go browse it for some nice examples.&lt;/p&gt;  &lt;p&gt;The little demo I saw was one that &lt;a href="http://create.msdn.com/en-US/education/catalog/sample/camera_shake" target="_blank"&gt;shakes the camera&lt;/a&gt;.&amp;#160; It also vibrates the controller (or the Phone).&amp;#160; It was pretty easy to take the important pieces of code and modify the Camera object I used in the XELibrary (the library the book uses).&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Inside the Update method of the game class (i.e. Game1 inside of Game1.cs) you can add the following code:&lt;/p&gt;  &lt;div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;padding-bottom:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;padding-left:4px;width:97.5%;padding-right:4px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;padding-top:4px;" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; ((input.ButtonHandler.WasButtonPressed((&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt;)PlayerIndex.One, Buttons.A) || (input.KeyboardState.WasKeyPressed(Keys.Space))))&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;{&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;    camera.Shake(25f, 2f);&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Next, we need to actually create that method (Shake) on the camera.&amp;#160; Since we would want to use this on the FirstPersonCamera and the static Camera we will apply it to the base class Camera.&amp;#160; Add the following variables to Camera.cs:&lt;/p&gt;

&lt;div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;padding-bottom:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;padding-left:4px;width:97.5%;padding-right:4px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;padding-top:4px;" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;// We only need one Random object no matter how many Cameras we have&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;readonly&lt;/span&gt; Random random = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Random();&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;// Are we shaking?&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; shaking;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;// The maximum magnitude of our shake offset&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; shakeMagnitude;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;// The total duration of the current shake&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; shakeDuration;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;// A timer that determines how far into our shake we are&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; shakeTimer;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;// The shake offset vector&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; Vector3 shakeOffset;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Next, add the following two methods to the Camera.cs file:&lt;/p&gt;

&lt;div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;padding-bottom:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;padding-left:4px;width:97.5%;padding-right:4px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;padding-top:4px;" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Helper to generate a random float in the range of [-1, 1].&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; NextFloat()&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;{&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;float&lt;/span&gt;)random.NextDouble() * 2f - 1f;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;}&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Shakes the camera with a specific magnitude and duration.&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;magnitude&amp;quot;&amp;gt;The largest magnitude to apply to the shake.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;duration&amp;quot;&amp;gt;The length of time (in seconds) for which the shake should occur.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Shake(&lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; magnitude, &lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; duration)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;{&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;    &lt;span style="color:#008000;"&gt;// We&amp;#39;re now shaking&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;    shaking = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;    &lt;span style="color:#008000;"&gt;// Store our magnitude and duration&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;    shakeMagnitude = magnitude;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;    shakeDuration = duration;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;    &lt;span style="color:#008000;"&gt;// Reset our timer&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;    shakeTimer = 0f;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The first method is just a helper method we need soon.&amp;#160; The second method is the public Shake method on our camera that initializes the values so we can begin shaking the camera’s view.&lt;/p&gt;

&lt;p&gt;Finally, in the Update method of Camera.cs add replace the following code at the bottom of the method:&lt;/p&gt;

&lt;div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;padding-bottom:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;padding-left:4px;width:97.5%;padding-right:4px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;padding-top:4px;" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;Matrix.CreateLookAt(&lt;span style="color:#0000ff;"&gt;ref&lt;/span&gt; cameraPosition, &lt;span style="color:#0000ff;"&gt;ref&lt;/span&gt; cameraTarget, &lt;span style="color:#0000ff;"&gt;ref&lt;/span&gt; cameraUpVector,&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#0000ff;"&gt;out&lt;/span&gt; view);&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;With the following code:&lt;/p&gt;

&lt;div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;padding-bottom:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;padding-left:4px;width:97.5%;padding-right:4px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;padding-top:4px;" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;// If we&amp;#39;re shaking...&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (shaking)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;{&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#008000;"&gt;// Move our timer ahead based on the elapsed time&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   shakeTimer += (&lt;span style="color:#0000ff;"&gt;float&lt;/span&gt;)gameTime.ElapsedGameTime.TotalSeconds;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#008000;"&gt;// If we&amp;#39;re at the max duration, we&amp;#39;re not going to be shaking anymore&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (shakeTimer &amp;gt;= shakeDuration)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;       shaking = &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;       shakeTimer = shakeDuration;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#008000;"&gt;// Compute our progress in a [0, 1] range&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; progress = shakeTimer / shakeDuration;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#008000;"&gt;// Compute our magnitude based on our maximum value and our progress. This causes&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#008000;"&gt;// the shake to reduce in magnitude as time moves on, giving us a smooth transition&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#008000;"&gt;// back to being stationary. We use progress * progress to have a non-linear fall &lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#008000;"&gt;// off of our magnitude. We could switch that with just progress if we want a linear &lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#008000;"&gt;// fall off.&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; magnitude = shakeMagnitude * (1f - (progress * progress));&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#008000;"&gt;// Generate a new offset vector with three random values and our magnitude&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   shakeOffset = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Vector3(NextFloat(), NextFloat(), NextFloat()) * magnitude;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#008000;"&gt;// If we&amp;#39;re shaking, add our offset to our position and target&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   cameraPosition += shakeOffset;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   cameraTarget += shakeOffset;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;}&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;Matrix.CreateLookAt(&lt;span style="color:#0000ff;"&gt;ref&lt;/span&gt; cameraPosition, &lt;span style="color:#0000ff;"&gt;ref&lt;/span&gt; cameraTarget, &lt;span style="color:#0000ff;"&gt;ref&lt;/span&gt; cameraUpVector,&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   &lt;span style="color:#0000ff;"&gt;out&lt;/span&gt; view);&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;So whe the main game class calls camera.Shake, the flag shaking becomes true and the shaeMagnitude, shakeDuration and shakeTimer are set.&amp;#160; This way when the camera game component has its Update method called, it sees that it needs to shake the camera and adds the game’s total seconds to the shakeTimer and if it has already been shaking too long it sets it to false and resets the shakeTimer.&amp;#160; Assuming it hasn’t been shaking long enough (or even started)&amp;#160; it computes the progress and determines the magnitude of the shaking from that value.&amp;#160; It then uses that magnitude to create an offset with some randomness.&amp;#160; The cameraPosition and cameraTarget then has the offset added to it.&amp;#160; This is what makes the camera shake.&amp;#160; When the view is calculated again it has new values for the camera position and target.&lt;/p&gt;

&lt;p&gt;So just a little bit of code allows us to create a cool shaking effect in our games.&amp;#160; Nice.&lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

&lt;p&gt;-Chad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=28757" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/Tutorial/default.aspx">Tutorial</category><category domain="http://xnaessentials.com/archive/tags/WP7/default.aspx">WP7</category><category domain="http://xnaessentials.com/archive/tags/App+Hub/default.aspx">App Hub</category></item><item><title>Columbia Enterprise Developers Guild talk on HLSL</title><link>http://xnaessentials.com/archive/2011/03/10/columbia-enterprise-developers-guild-talk-on-hlsl.aspx</link><pubDate>Thu, 10 Mar 2011 11:25:00 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:28756</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=28756</wfw:commentRss><comments>http://xnaessentials.com/archive/2011/03/10/columbia-enterprise-developers-guild-talk-on-hlsl.aspx#comments</comments><description>&lt;p&gt;On March 9th I was able to give a talk down in Columbia, SC at the &lt;a href="http://columbiadevelopers.org/" target="_blank"&gt;Columbia Enterprise Developers Guild&lt;/a&gt;.&amp;#160; We discussed XNA in general and showed a couple of demos and then dove in and talked about vertex and pixel shaders.&amp;#160; We also discussed how pixel shaders could be used in Silverlight and WPF applications.&amp;#160; We talked briefly about the built in effects in XNA Game Studio 4.0.&amp;#160; &lt;a href="http://create.msdn.com/" target="_blank"&gt;AppHub&lt;/a&gt; has a &lt;a href="http://create.msdn.com/en-US/education/catalog/sample/reach_graphics_demo" target="_blank"&gt;great demo&lt;/a&gt; on those built-in effects.&lt;/p&gt;  &lt;p&gt;Feel free to &lt;a href="http://xnaessentials.com/download.ashx?fileid=33" target="_blank"&gt;download the presentation slides&lt;/a&gt; from the event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=28756" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category></item><item><title>Windows Phone 7 Hands On Lab–Tombstoning</title><link>http://xnaessentials.com/archive/2011/02/17/windows-phone-7-hands-on-lab-tombstoning.aspx</link><pubDate>Fri, 18 Feb 2011 04:21:00 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:28755</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=28755</wfw:commentRss><comments>http://xnaessentials.com/archive/2011/02/17/windows-phone-7-hands-on-lab-tombstoning.aspx#comments</comments><description>&lt;p&gt;At my local .NET User Group, &lt;a href="http://triaddev.org/" target="_blank"&gt;Triad Developers Guild&lt;/a&gt;, I was able to give a talk on WP7.&amp;#160; Usually the sessions are lecture style, but I tried to do a hands on lab.&amp;#160; Unfortunately, not many folks brought their laptops so for some it was still basically a lecture style session with me doing the lab in front of everyone.&amp;#160; The labs are very good, I’d encourage you to download them and go through them.&amp;#160; The lab we did on Tuesday, February 15th was the Tombstoning, Launcher and Chooser, and then some with XNA Framework.&lt;/p&gt;  &lt;p&gt;You can download lab here:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&amp;amp;FamilyID=ca23285f-bab8-47fa-b364-11553e076a9a"&gt;http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&amp;amp;FamilyID=ca23285f-bab8-47fa-b364-11553e076a9a&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The files are as follows:&lt;/p&gt;  &lt;p&gt;WP7TrainingKitOffline_RTM1.Setup.exe is the full download (both Silverlight and XNA)&lt;/p&gt;  &lt;p&gt;WP7SLTrainingKitOffline_RTM.Setup.exe is only the Silverlight labs&lt;/p&gt;  &lt;p&gt;WP7XNATrainingKitOffline_RTM.Setup.exe is only the XNA labs&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Also, Microsoft is running a contest and if you use the following code when you submit your app or game to the Marketplace you could win a Windows Phone 7! &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Use code: 5DXDN&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Check out &lt;a href="http://www.WindowsPhone7Event.com/contest/"&gt;http://www.WindowsPhone7Event.com/contest/&lt;/a&gt; for more information!&lt;/p&gt;  &lt;p&gt;Happy Programming!&lt;/p&gt;  &lt;p&gt;-Chad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=28755" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/User+Group/default.aspx">User Group</category><category domain="http://xnaessentials.com/archive/tags/WP7/default.aspx">WP7</category></item><item><title>Using the Built In Dual Texture Effect in Game Studio 4.0</title><link>http://xnaessentials.com/archive/2011/01/27/using-the-built-in-dual-texture-effect-in-game-studio-4-0.aspx</link><pubDate>Thu, 27 Jan 2011 07:10:00 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:28754</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=28754</wfw:commentRss><comments>http://xnaessentials.com/archive/2011/01/27/using-the-built-in-dual-texture-effect-in-game-studio-4-0.aspx#comments</comments><description>&lt;p&gt;Since XNA Game Studio Express 1.0 (later the Express was removed from the name) we have had the built-in BasicEffect.&amp;#160; This has allowed developers to create games without actually needing to learn HLSL.&amp;#160; HLSL is awesome, so I’d highly encourage you to learn it.&amp;#160; It is not only beneficial in XNA but also in Silverlight and WPF.&amp;#160; Regardless, if someone is just getting started learning HLSL can slow down the process of getting something on the screen.&amp;#160; Microsoft decided to create the BasicEffect to handle scenarios where creating custom shaders in HLSL is not needed or maybe just not wanted to begin with.&lt;/p&gt;  &lt;p&gt;In XNA Game Studio 4.0 Microsoft has added new built in effects.&amp;#160; Currently, Windows Phone 7 does not provide support for custom shaders.&amp;#160; The team found that many scenarios can be handled with the built in effects they built.&amp;#160; They are: BasicEffect, DualTextureEffect, AlphaTestEffect, EnvironmentMapEffect, SkinnedEffect.&lt;/p&gt;  &lt;p&gt;This post will discuss the DualTextureEffect.&amp;#160; BasicEffect allows you to use a single texture.&amp;#160; As expected the DualTextureEffect allows you to use two.&amp;#160; It allows you to blend 2 textures together.&amp;#160; A typical purpose for using this texture is to use Light Maps.&amp;#160; The idea behind light maps is to basically figure out your lighting at build time and store those to a texture.&amp;#160; Then apply that light texture to the scene to make it look like you have complex lighting even though none exists.&lt;/p&gt;  &lt;p&gt;To actually use the effect is very straightforward.&amp;#160; Simply instantiate the effect and set the camera up normally, set the Texture and Texture2 properties on the effect and apply the effect to the model.&amp;#160; Texture will most likely be your color map (colored texture for your model) and Texture2 will most likely be your light map.&amp;#160; If your second texture was all black, then the resulting image that will be applied to the model will be all black.&amp;#160; If the second texture is all white, then it will use the color as it exists from the other texture.&amp;#160; Any other color will blend – 50% gray will have the color unchanged, &amp;gt;&amp;#160; 50% gray and the color becomes brighter, &amp;lt; 50% gray and the color becomes darker.&amp;#160; &lt;a href="http://blogs.msdn.com/b/shawnhar/archive/2010/08/04/dualtextureeffect.aspx" target="_blank"&gt;Shawn Hargreaves has a great article on this topic&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;To see Microsoft’s HLSL code in how they created these effects, take a look at the stock effects sample:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://create.msdn.com/en-US/education/catalog/sample/stock_effects" href="http://create.msdn.com/en-US/education/catalog/sample/stock_effects"&gt;http://create.msdn.com/en-US/education/catalog/sample/stock_effects&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=28754" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/Tutorial/default.aspx">Tutorial</category></item><item><title>Running a Game in Full Screen in Windows Phone 7</title><link>http://xnaessentials.com/archive/2010/12/14/running-a-game-in-full-screen-in-windows-phone-7.aspx</link><pubDate>Wed, 15 Dec 2010 02:41:00 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:28753</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=28753</wfw:commentRss><comments>http://xnaessentials.com/archive/2010/12/14/running-a-game-in-full-screen-in-windows-phone-7.aspx#comments</comments><description>&lt;p&gt;If you create a game in Windows Phone 7 using XNA you may not want the Application Bar to be displayed.&amp;#160; You can hide that status bar in Windows Phone 7 by setting the GraphicsDeviceManager.IsFullScreen property to true.&amp;#160; The default is false.&lt;/p&gt;  &lt;div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;padding-bottom:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;padding-left:4px;width:97.5%;padding-right:4px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;padding-top:4px;" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Game1() &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;{ &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:white;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   graphics = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; GraphicsDeviceManager(&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;); &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;border-left-style:none;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;border-right-style:none;font-size:8pt;overflow:visible;padding-top:0px;"&gt;   graphics.IsFullScreen = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;; &lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=28753" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/Tutorial/default.aspx">Tutorial</category><category domain="http://xnaessentials.com/archive/tags/WP7/default.aspx">WP7</category></item><item><title>SIEGECon Talk on Xbox 360 Programming with XNA</title><link>http://xnaessentials.com/archive/2010/10/06/siegecon-talk-on-xbox-360-programming-with-xna.aspx</link><pubDate>Wed, 06 Oct 2010 10:32:00 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:5369</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=5369</wfw:commentRss><comments>http://xnaessentials.com/archive/2010/10/06/siegecon-talk-on-xbox-360-programming-with-xna.aspx#comments</comments><description>&lt;p&gt;I’ll be blogging about the SIEGE Conference on my &lt;a href="http://kewlniss.com/" target="_blank"&gt;personal blog&lt;/a&gt; soon, but I did want to at least put up my PowerPoint presentation of the talk I gave this past Saturday. I received a lot of good feedback. It was a challenge getting to demo the 360 since it has to be connected to the internet. Overcoming Hotel WiFi restrictions is always fun.&lt;/p&gt;  &lt;p&gt;In general, this conference was really good. I had a great time networking and talking to folks. I met a professor and some of his students who are using my book in their class this year. That was really cool. Also meeting the co-founder of Atari, Nolan Bushnell and chatting with him was pretty awesome. If you are interested in any of that, make sure you check out my personal blog where I put non XNA related content.&lt;/p&gt;  &lt;p&gt;Feel free to &lt;a href="http://xnaessentials.com/download.ashx?fileid=32" target="_blank"&gt;download the presentation slides&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=5369" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/Download/default.aspx">Download</category><category domain="http://xnaessentials.com/archive/tags/XBLIG/default.aspx">XBLIG</category><category domain="http://xnaessentials.com/archive/tags/Code+Camp/default.aspx">Code Camp</category></item><item><title>XNA Game Studio 4.0</title><link>http://xnaessentials.com/archive/2010/09/13/xna-game-studio-4-0.aspx</link><pubDate>Mon, 13 Sep 2010 14:22:18 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:227</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=227</wfw:commentRss><comments>http://xnaessentials.com/archive/2010/09/13/xna-game-studio-4-0.aspx#comments</comments><description>&lt;p&gt;On September 16th, the XNA Framework team will be &lt;a href="http://blogs.msdn.com/b/xna/archive/2010/09/08/what-about-xna-game-studio-4-0.aspx" target="_blank"&gt;releasing XNA Game Studio 4.0.&lt;/a&gt;&amp;#160; While games created for the Xbox 360 will still be based on XNA Game Studio 3.1 for the near future, the team is also releasing a beta version of the new Connect tool (that allows you to connect your development machine to your Xbox 360 to transfer your XNA games) on the same day.&lt;/p&gt;  &lt;p&gt;September 16th is when the &lt;a href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/08/23/a-developer-s-roadmap-to-windows-phone-7-launch-timing.aspx" target="_blank"&gt;Windows Phone 7 tools will be launched&lt;/a&gt; as well.&amp;#160; The timing isn’t coincidental since the Windows Phone 7 will allow developers to create games and apps using either Silverlight or XNA Game Studio.&amp;#160; The tools have been in beta for a while now.&amp;#160; The actual Windows Phone 7 Series devices will be released sometime this holiday season.&lt;/p&gt;  &lt;p&gt;XNA Game Studio 4.0 has breaking code changes. The XNA Framework team went with the mantra of &lt;a href="http://blogs.msdn.com/b/shawnhar/archive/2010/03/16/breaking-changes-in-xna-game-studio-4-0.aspx" target="_blank"&gt;“If you break it, break it good.”&lt;/a&gt; They went with a&amp;#160; new approach of &lt;a href="http://blogs.msdn.com/b/shawnhar/archive/2010/03/12/reach-vs-hidef.aspx" target="_blank"&gt;Reach vs. HiDef.&lt;/a&gt;&amp;#160; Reach is being able to write the same code for all supported platforms – Windows, Xbox 360, Windows Phone 7. HiDef is targeting a particular platform and the specific features it has available.&amp;#160; This was a great move and while it causes discomfort in updating any existing code it makes a stronger base for bringing in even more platforms in the future.&lt;/p&gt;  &lt;p&gt;Make sure you grab the tools as soon as they are available in a couple of days!&lt;/p&gt;  &lt;p&gt;I certainly hope that all of my readers read &lt;a href="http://blogs.msdn.com/shawnhar/" target="_blank"&gt;Shawn Hargreaves blog&lt;/a&gt; regularly. I’ve only linked to a couple of his posts here about XNA Game Studio 4.0, but he has a wealth of information that you will find beneficial. So make sure to catch up on &lt;a href="http://www.talula.demon.co.uk/blogindex.html" target="_blank"&gt;his blog posts&lt;/a&gt; if you haven’t already.&lt;/p&gt;  &lt;p&gt;Happy Programming!&lt;/p&gt;  &lt;p&gt;-Chad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=227" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/WP7/default.aspx">WP7</category></item><item><title>CodeStock 2010 Presentations</title><link>http://xnaessentials.com/archive/2010/07/07/codestock-2010-presentations.aspx</link><pubDate>Wed, 07 Jul 2010 10:18:19 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:182</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=182</wfw:commentRss><comments>http://xnaessentials.com/archive/2010/07/07/codestock-2010-presentations.aspx#comments</comments><description>&lt;p&gt;This was the first year I had attended CodeStock. It was an excellent conference.&lt;/p&gt;  &lt;p&gt;I had two sessions – &lt;a href="http://xnaessentials.com/download.ashx?fileid=30" target="_blank"&gt;XNA Crash Course&lt;/a&gt; and &lt;a href="http://xnaessentials.com/download.ashx?fileid=31" target="_blank"&gt;Artificial Intelligence&lt;/a&gt;. Hit the links to download the slides. As with most of my talks there isn’t a lot to the slides as most of the time is spent in either demos or me talking about the points. Still, I’ve included them here just in case they help anyone.&lt;/p&gt;  &lt;p&gt;I had detailed my experience at CodeStock but determined this was not the right blog for that sort of post.&amp;#160; I’ve been wanting to create another blog that covers general development and other ramblings I may have.&amp;#160; I will launch that soon and post the link here in case anyone cares about my non XNA adventures.&lt;/p&gt;  &lt;p&gt;I will sum up my experience by saying that &lt;strong&gt;the .NET Developer community is awesome.&lt;/strong&gt;&amp;#160; If you aren’t involved – get involved. You will not regret getting to know other folks that get excited by the same technology that you do.&lt;/p&gt;  &lt;p&gt;Happy Networking!&lt;/p&gt;  &lt;p&gt;-Chad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=182" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/User+Group/default.aspx">User Group</category><category domain="http://xnaessentials.com/archive/tags/Code+Camp/default.aspx">Code Camp</category></item><item><title>CodeStock 2010 for Developers, IT Pros and Entrepreneurs</title><link>http://xnaessentials.com/archive/2010/06/22/codestock-2010-for-developers-it-pros-and-entrepreneurs.aspx</link><pubDate>Tue, 22 Jun 2010 15:17:26 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:165</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=165</wfw:commentRss><comments>http://xnaessentials.com/archive/2010/06/22/codestock-2010-for-developers-it-pros-and-entrepreneurs.aspx#comments</comments><description>&lt;p&gt;I’ll be speaking at CodeStock in Knoxville, TN on June 25th and 26th.&amp;#160; I have two sessions I’ll be presenting: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://codestock.org/Sessions/xna-crash-course.aspx" target="_blank"&gt;XNA Crash Course&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://codestock.org/Sessions/artificial-intelligence.aspx" target="_blank"&gt;Artificial Intelligence&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I was pleased and very surprised to see that my &lt;a href="http://codestock.org/Sessions/artificial-intelligence.aspx" target="_blank"&gt;Artificial Intelligence&lt;/a&gt; talk was &lt;a href="http://codestock.org/News/2010/04/25/codestock-2010-voting-results.aspx" target="_blank"&gt;voted as number 3&lt;/a&gt; of sessions the folks wanted to attend.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://codestock.org"&gt;&lt;img style="border-right-width:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;" border="0" alt="Join me at CodeStock" src="http://codestock.org/Marketing/blog_badge.png" width="140" height="150" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you haven’t registered yet, you should.&amp;#160; &lt;a href="http://rachelappel.com/" target="_blank"&gt;Rachel Appel&lt;/a&gt;, now a Microsoft employee, will be giving the keynote.&amp;#160; I’ve always enjoyed hearing Rachel’s talks.&amp;#160; If you are interested you can even view my &lt;a href="http://codestock.org/ViewSchedule.aspx?id=135" target="_blank"&gt;current schedule&lt;/a&gt; for the two day event.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/3301.nerdetteskull_5F00_2010_5F00_lowres_5F00_74F6749D.png"&gt;&lt;img style="border-right-width:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;" title="nerdetteskull_2010_lowres" border="0" alt="nerdetteskull_2010_lowres" src="http://xnaessentials.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xe.metablogapi/4442.nerdetteskull_5F00_2010_5F00_lowres_5F00_thumb_5F00_3B0731B1.png" width="182" height="200" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Direct from CodeStock’s Marketing Department: &lt;/p&gt;  &lt;div style="margin-left:50px;margin-right:50px;"&gt;   &lt;p&gt;The theme for &lt;a href="http://codestock.org" target="_blank"&gt;CodeStock&lt;/a&gt; 2010 is about connections.&amp;#160; Connecting with peers and building a professional network.&amp;#160; Connecting with IT roles outside of your own.&amp;#160; Connecting with the people who can help make your ideas reality.&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;Keynote by Microsoft Developer Evangelist Rachel Appel &lt;/li&gt;      &lt;li&gt;Sessions for Developers, IT Professionals, and Entrepreneurs &lt;/li&gt;      &lt;li&gt;100+ break out sessions + Open Spaces (self-organizing sessions) &lt;/li&gt;      &lt;li&gt;Panel discussions and live podcasts &lt;/li&gt;      &lt;li&gt;CodeStock Social Event to meet and make connections &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;Space is limited so register today at &lt;a href="http://codestock.org" target="_blank"&gt;&lt;b&gt;CodeStock.org&lt;/b&gt;&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;So if you are within driving range, you really should register.&amp;#160; I’ve never been to CodeStock but I know the organizer personally and I understand the food is great on both days.&amp;#160; I also know a lot of work has gone into this event and it has grown exponentially every year.&amp;#160; So &lt;a href="http://codestock.org/Pages/Register.aspx" target="_blank"&gt;buy a ticket&lt;/a&gt; and come join the fun!&lt;/p&gt;  &lt;p&gt;Happy Learning!&lt;/p&gt;  &lt;p&gt;-Chad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=165" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/User+Group/default.aspx">User Group</category></item><item><title>Getting Started with XNA Game Studio 3 Hands On Lab</title><link>http://xnaessentials.com/archive/2009/10/12/getting-started-with-xna-game-studio-3-hands-on-lab.aspx</link><pubDate>Mon, 12 Oct 2009 12:00:00 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:113</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=113</wfw:commentRss><comments>http://xnaessentials.com/archive/2009/10/12/getting-started-with-xna-game-studio-3-hands-on-lab.aspx#comments</comments><description>&lt;p&gt;This is a lab I originally created for the &lt;a href="http://xnaessentials.com/archive/2009/10/07/carolina-code-camp-10-10-09.aspx"&gt;Carolina Code Camp&lt;/a&gt;. The lab covers two main items:&lt;/p&gt;  &lt;p&gt;Platformer Starter Kit&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Creating the Platformer Starter Kit &lt;/li&gt;    &lt;li&gt;Compiling and Running Platformer &lt;/li&gt;    &lt;li&gt;Modifying Level 1 &lt;/li&gt; &lt;/ul&gt;  &lt;blockquote&gt;&lt;/blockquote&gt;  &lt;p&gt;Indeterminate Progress Bar&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;XNA Framework 2D Basics &lt;/li&gt;    &lt;li&gt;Creating an Indeterminate Progress Bar Demo &lt;/li&gt;    &lt;li&gt;Drawing 2D Text &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The lab is adapted from my &lt;a href="http://xnaessentials.com/unleashed/"&gt;Microsoft XNA Game Studio 3.0 Unleashed book&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xnaessentials.com/download.ashx?fileid=29"&gt;Download the lab&lt;/a&gt; and give it try. It takes about an hour to complete.&lt;/p&gt;  &lt;p&gt;Happy Programming!&lt;/p&gt;  &lt;p&gt;-Chad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=113" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/Book/default.aspx">Book</category><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/Tutorial/default.aspx">Tutorial</category><category domain="http://xnaessentials.com/archive/tags/Code+Camp/default.aspx">Code Camp</category></item><item><title>Making Money by Making Games with XNA</title><link>http://xnaessentials.com/archive/2009/10/12/making-money-by-making-games-with-xna.aspx</link><pubDate>Mon, 12 Oct 2009 11:00:00 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:111</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=111</wfw:commentRss><comments>http://xnaessentials.com/archive/2009/10/12/making-money-by-making-games-with-xna.aspx#comments</comments><description>&lt;p&gt;I’ve done this presentation a couple of times so far. The PowerPoint presentation without the actual talk doesn’t mean too much by itself, but I have included it as is for folks to refer back to that attended the talks.&lt;/p&gt;  &lt;p&gt;Everyone can &lt;a href="http://xnaessentials.com/download.ashx?fileid=28"&gt;feel free to download it&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The core of the talk is about best practices when developing games for the Xbox 360 to be sold on Xbox LIVE Marketplace as an Xbox LIVE Indie Game (XBLIG). The slides also mention some ways to use the same code written for the XNA Framework to then be repurposed for a Silverlight game thanks to &lt;a href="http://silversprite.codeplex.com/" target="_blank"&gt;SilverSprite&lt;/a&gt; and even for the iPhone thanks to &lt;a href="http://xnatouch.codeplex.com/" target="_blank"&gt;XNATouch&lt;/a&gt; and &lt;a href="http://monotouch.net/" target="_blank"&gt;MonoTouch&lt;/a&gt; and &lt;a href="http://www.mono-project.com/" target="_blank"&gt;Mono&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The best practices section was taken from the chapter in my book “Best Practices for Creating an Xbox LIVE Community Game”.&lt;/p&gt;  &lt;p&gt;The last section (bonus!) talks about developing games for the Zune HD. For more information, check out my &lt;a href="http://xnaessentials.com/archive/2009/09/20/zune-hd-scribble-test-source-code.aspx"&gt;original blog post&lt;/a&gt; where the code can be downloaded.&lt;/p&gt;  &lt;p&gt;Happy Programming!&lt;/p&gt;  &lt;p&gt;-Chad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=111" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/XBLCG/default.aspx">XBLCG</category><category domain="http://xnaessentials.com/archive/tags/XBLIG/default.aspx">XBLIG</category><category domain="http://xnaessentials.com/archive/tags/User+Group/default.aspx">User Group</category><category domain="http://xnaessentials.com/archive/tags/Code+Camp/default.aspx">Code Camp</category></item><item><title>The Kewlniss Func</title><link>http://xnaessentials.com/archive/2009/10/08/the-kewlniss-func.aspx</link><pubDate>Fri, 09 Oct 2009 01:20:00 GMT</pubDate><guid isPermaLink="false">279341f4-7231-4875-9074-bc7c0d67b16f:115</guid><dc:creator>Chad Carter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://xnaessentials.com/rsscomments.aspx?PostID=115</wfw:commentRss><comments>http://xnaessentials.com/archive/2009/10/08/the-kewlniss-func.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.vinull.com/" target="_blank"&gt;Michael Neel&lt;/a&gt; (aka &lt;a href="http://twitter.com/ViNull" target="_blank"&gt;@ViNull&lt;/a&gt;) &lt;a href="http://feelthefunc.com/2009/09/27/EP23TheKewlnissFunc.aspx" target="_blank"&gt;interviewed me&lt;/a&gt; at the &lt;a href="http://xnaessentials.com/archive/2009/09/16/raleigh-code-camp-2009-9-19-09.aspx"&gt;Raleigh Code Camp&lt;/a&gt; back in September for his &lt;a href="http://feelthefunc.com/" target="_blank"&gt;Feel The Func podcast&lt;/a&gt;. He edited a little bit, but it is still almost 2 hours in length.&lt;/p&gt;  &lt;p&gt;If you are interested in listening to us chat about the game he is making, my book, the XNA Community in general some games we play as well as some XNA topics such as Rich Presence feel free to listen.&amp;#160; I’m sure he’d love you to subscribe.&lt;/p&gt;  &lt;p&gt;Also, a much better interview is the one he did with &lt;a href="http://skasoftware.wordpress.com/" target="_blank"&gt;Jame Silva&lt;/a&gt; of &lt;a href="http://www.xbox.com/en-US/games/d/dishwasherdsxboxlivearcade/" target="_blank"&gt;The Dishwasher: Dead Samurai&lt;/a&gt; fame. So make sure to check &lt;a href="http://feelthefunc.com/2009/08/30/EP19IMAEDAPODCASTW1THZ0MB1ED3VS1N1T1.aspx" target="_blank"&gt;his interview&lt;/a&gt; out too.&lt;/p&gt;  &lt;p&gt;Happy Listening!&lt;/p&gt;  &lt;p&gt;-Chad&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://xnaessentials.com/aggbug.aspx?PostID=115" width="1" height="1"&gt;</description><category domain="http://xnaessentials.com/archive/tags/Book/default.aspx">Book</category><category domain="http://xnaessentials.com/archive/tags/XNA/default.aspx">XNA</category><category domain="http://xnaessentials.com/archive/tags/Code+Camp/default.aspx">Code Camp</category></item></channel></rss>
