<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>XNA</title>
        <link>http://geekswithblogs.net/davenet/category/7095.aspx</link>
        <description>All the stuffi know about XNA..</description>
        <language>en-US</language>
        <copyright>Dave Redding</copyright>
        <managingEditor>DavidARedding@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Hot Damn!!</title>
            <link>http://geekswithblogs.net/davenet/archive/2008/05/12/122075.aspx</link>
            <description>&lt;p&gt;I know a WMDODN (West Michigan Day of .Net) Post is in order, but that can wait.  check this out!&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;a href="http://blogs.msdn.com/xna/archive/2008/05/07/announcing-xna-game-studio-3-0-community-technical-preview-ctp.aspx"&gt;http://blogs.msdn.com/xna/archive/2008/05/07/announcing-xna-game-studio-3-0-community-technical-preview-ctp.aspx&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Finally, we can start building games for our zunes! WOOT!  I expect to create a talk on the topic very soon&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=122075"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=122075" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/davenet/aggbug/122075.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Dave Redding</dc:creator>
            <guid>http://geekswithblogs.net/davenet/archive/2008/05/12/122075.aspx</guid>
            <pubDate>Mon, 12 May 2008 14:14:12 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/davenet/comments/122075.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/davenet/archive/2008/05/12/122075.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/davenet/comments/commentRss/122075.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/davenet/services/trackbacks/122075.aspx</trackback:ping>
        </item>
        <item>
            <title>On the road again...</title>
            <link>http://geekswithblogs.net/davenet/archive/2007/11/13/116827.aspx</link>
            <description>    Hey everybody (&lt;span style="FONT-STYLE: italic"&gt;Hi Dr. Dave&lt;/span&gt;).  I'm confirmed for two speaking engagements this month! &lt;a target="_blank" href="http://www.wmdotnet.org/"&gt;&lt;img style="FLOAT: right" alt="West Mi .Net user Group" src="http://www.wmdotnet.org/Portals/0/Skins/WMDotNet/images/GRDotNetLogo.gif" /&gt;&lt;/a&gt;Woot!  Apparently my XNA talk grew legs and is ready to walk.  Next week (&lt;span style="FONT-STYLE: italic"&gt;Nov. 20th&lt;/span&gt;) I'll be out at the &lt;a target="_blank" href="http://www.wmdotnet.org/"&gt;West Michigan .Net user group&lt;/a&gt; and then I'll be heading down to Detroit for the &lt;a href="http://www.igda.org/smichigan/"&gt;IDGA user group&lt;/a&gt; (&lt;span style="FONT-STYLE: italic"&gt;a indy, game developer user group...very cool!&lt;/span&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.igda.org/smichigan/"&gt;&lt;/a&gt;    I'll be giving talks similar to the one I gave at DoDN, but this time, i've prepared a special demo.  this demo works kinda like the web game Collapse, except it takes advantage of the GHII controller.  It's a simple game in principal, and still relies on all the basic XNA stuff (&lt;span style="FONT-STYLE: italic"&gt;Spritebatches, controller input etc etc&lt;/span&gt;)  And it should be a little more interesting than the Pong demo.  Not that beer pong is un-cool by any stretch of the imagination.&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116827"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116827" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/davenet/aggbug/116827.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Dave Redding</dc:creator>
            <guid>http://geekswithblogs.net/davenet/archive/2007/11/13/116827.aspx</guid>
            <pubDate>Tue, 13 Nov 2007 17:12:23 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/davenet/comments/116827.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/davenet/archive/2007/11/13/116827.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/davenet/comments/commentRss/116827.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/davenet/services/trackbacks/116827.aspx</trackback:ping>
        </item>
        <item>
            <title>Workin' the corner at DoDN</title>
            <link>http://geekswithblogs.net/davenet/archive/2007/10/22/116247.aspx</link>
            <description>&lt;p&gt;&lt;img style="FLOAT: left" alt="" src="http://www.dayofdotnet.org/AnnArbor/Fall2007/images/DoDNBadge2Fall2007.png" /&gt;       So I survived my first presentation experience!! WooT!!.  The Fall DoDN this year was amazing.  There was alot of amazing talent present.  If you have the opprtunity to catch &lt;a title="Josh Holmes Blog" target="_blank" href="http://www.joshholmes.com"&gt;Josh Holmes&lt;/a&gt; giving his "Distilling the DLR" Talk, I would highly recomend it.  Lots o' good sheet.  &lt;/p&gt;
&lt;p&gt;       My talk started out as expected.  I could'nt figure out how to work my comptuer so there was, all around my laptop, Jason Follas, John Hopkins, myself and a hand full of other onlookers.  We finally figured out that ... Oh, Dave needs to "Clone" his desktop, not extend it ;).  That was my only run in with the projetor, so i guess i made out a little more fortunate than others in the past &lt;em&gt;(*Ahem*&lt;/em&gt;&lt;a target="_blank" href="http://keithelder.net/blog/archive/2007/05/06/Day-of-.Net-Ann-Arbor--I-killed-the-projector.aspx"&gt;&lt;em&gt;keithelder&lt;/em&gt;&lt;/a&gt;&lt;em&gt;*Ahem*)  &lt;/em&gt;After that I managed to straggle through my demos and most of the sldes.  I was so nervous, i was showing the demos a little to quick.  I was orriginally copying and pasting code from one instance of C# Express to another when I asked the crowd "Who just wants to see the code without the copy paste crap?" And i got a resounding "ME" from several individuals in the room.  I should add that i had the better part of 40+ people in the room.  There were folks standing in the back!&lt;/p&gt;
&lt;p&gt;    At the end of the talk, i got some positive feed back.  &lt;a href="http://www.jeffblankenburg.com/index.html"&gt;Jeff Blankenburg &lt;/a&gt;was kind enough to tell me that for my &lt;a href="http://www.jeffblankenburg.com/2007/10/xna-101.html"&gt;first time presenting, it was good.&lt;/a&gt;  So all things said and done. I'm totally stoaked to have gotten a speakers badge, and I look forward to refining the talk and giving it again.&lt;/p&gt;
&lt;p&gt;    Now... the afterparty....different story.  Apparently &lt;a title="Jay Wrens Blog" target="_blank" href="http://little.xmtp.net/blog/"&gt;Jay Wren&lt;/a&gt; and I were considered the drunks of the evening.  I believe thats only because Keith Elder wasn't there.  And if he would have been there, he could defend himself right now. All i can say about the rest of the night is, that untill contested, the four of us (&lt;em&gt;&lt;a title="Jay Wrens Blog" target="_blank" href="http://little.xmtp.net/blog/"&gt;Jay Wren&lt;/a&gt;, Scott Zischerk, David Peas and I&lt;/em&gt;) out vulgered Mark Miller and were orphaned to the kiddie table.&lt;/p&gt;
&lt;p&gt;    Thats gonna be my entry for DoDN at the time, untill Lawyers tell me that it's ok to post anything else ;)  In other news, i've got a few groups interested in hearing my talk within the next few months, so keep an eye out for XNA 101 near you!&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116247"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116247" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/davenet/aggbug/116247.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Dave Redding</dc:creator>
            <guid>http://geekswithblogs.net/davenet/archive/2007/10/22/116247.aspx</guid>
            <pubDate>Mon, 22 Oct 2007 17:32:32 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/davenet/comments/116247.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/davenet/archive/2007/10/22/116247.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/davenet/comments/commentRss/116247.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/davenet/services/trackbacks/116247.aspx</trackback:ping>
        </item>
        <item>
            <title>XNA Key Repeat is like a Jack russell Frickin' Terrier</title>
            <link>http://geekswithblogs.net/davenet/archive/2007/09/23/115549.aspx</link>
            <description>&lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;    Ok, so, we have to take a step away from the event driven architecture that were used to in "Normal" .net Apps.   For instance, you would expect a keyboard key press to be presented as such in your standard form.  But not in XNA...oh no.. event driven items are for sissies when it comes to writing for the XBox or XNA PC.  But who cares right? I mean, all we have to do is check if a button or thumbstick or whatever is down during the update method right?  Well that’s where it gets tricky.  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;    From what I’ve seen, the update method fires once about ever 16 milliseconds.  And everything I’ve read shows the update method polling the different input (&lt;em&gt;&lt;span style="font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;If you do it different, I’d love to see some alternatives&lt;/span&gt;&lt;/em&gt;).  Now, for allot of game inputs, that’s fine.  Anything you would essentially say "While this button is pushed: x+=1" to there is no trouble.  But what if you need to handle some kind of state changed on button press like "When this button is  pressed &lt;a href="http://geekswithblogs.net/davenet/archive/2006/12/21/101831.aspx"&gt;&lt;font color="#800080"&gt;ask your wife for a beer&lt;/font&gt;&lt;/a&gt;".  I don't know about you, but if I ask my wife for a beer once every 16 milliseconds, I’m likely to just get whacked upside the head with one...every 16 milliseconds.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;    The solution?  Keep track of when the button was pressed.  One method I’ve implemented goes something like this&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;blockquote style="margin-right: 0px;" dir="ltr"&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; color: rgb(43, 145, 175); font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;ButtonState&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; _prevstate;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; color: blue; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;protected&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; CheckGamepadInput(&lt;span style="color: rgb(43, 145, 175);"&gt;GameTime&lt;/span&gt; time)&lt;br /&gt;
{&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; color: blue; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;if&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; (_prevstate != &lt;span style="color: rgb(43, 145, 175);"&gt;ButtonState&lt;/span&gt;.Pressed)&lt;br /&gt;
{&lt;br /&gt;
      &lt;span style="color: rgb(51, 102, 255);"&gt;Beer&lt;/span&gt; b = GetBeerFromWife&amp;lt;&lt;span style="color: rgb(51, 102, 255);"&gt;SamAdams&lt;/span&gt;&amp;gt;();&lt;br /&gt;
      Me.Drink&amp;lt;&lt;span style="color: rgb(51, 102, 255);"&gt;Beer&lt;/span&gt;&amp;gt;(b);&lt;br /&gt;
&lt;span style="color: black;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; color: blue; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;if&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;GamePad&lt;/span&gt;.GetState(&lt;span style="color: rgb(43, 145, 175);"&gt;PlayerIndex&lt;/span&gt;.One).Buttons.Start == &lt;span style="color: rgb(43, 145, 175);"&gt;ButtonState&lt;/span&gt;.Pressed)&lt;br /&gt;
_currentPhase = &lt;span style="color: rgb(43, 145, 175);"&gt;eTurnPhases&lt;/span&gt;.RobotsMove;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;}&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; color: rgb(43, 145, 175); font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;GamePadState&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; s = &lt;span style="color: rgb(43, 145, 175);"&gt;GamePad&lt;/span&gt;.GetState(&lt;span style="color: rgb(43, 145, 175);"&gt;PlayerIndex&lt;/span&gt;.One);&lt;br /&gt;
&lt;span style="color: blue;"&gt;if&lt;/span&gt;(s.Buttons.A == &lt;span style="color: rgb(43, 145, 175);"&gt;ButtonState&lt;/span&gt;.Pressed ||&lt;br /&gt;
   s.Buttons.B == &lt;span style="color: rgb(43, 145, 175);"&gt;ButtonState&lt;/span&gt;.Pressed ||&lt;br /&gt;
   s.Buttons.X == &lt;span style="color: rgb(43, 145, 175);"&gt;ButtonState&lt;/span&gt;.Pressed ||&lt;br /&gt;
   s.Buttons.Y == &lt;span style="color: rgb(43, 145, 175);"&gt;ButtonState&lt;/span&gt;.Pressed)&lt;br /&gt;
{              &lt;br /&gt;
      _prevstate = &lt;span style="color: rgb(43, 145, 175);"&gt;ButtonState&lt;/span&gt;.Pressed;&lt;br /&gt;
}&lt;br /&gt;
&lt;span style="color: blue;"&gt;else&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: black;"&gt;{&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;br /&gt;
      &lt;/span&gt;_prevstate = &lt;span style="color: rgb(43, 145, 175);"&gt;ButtonState&lt;/span&gt;.Released;&lt;br /&gt;
}&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;    Well, that’s one way to do it for the game pad.  But you’re going to have the same trouble with the keyboard.  One suggestion would be to use the above method, but against the keys your using for input.  But what if you’re using like...2 billion key combinations, like maybe you have many many different beers available to you and you have these crazy key combos.  Well, in that situation we could (&lt;em&gt;&lt;span style="font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;totally shooting from the hip here&lt;/span&gt;&lt;/em&gt;) do something like this.&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;blockquote style="margin-right: 0px;" dir="ltr"&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; color: blue; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;long&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; totalTime = 0;&lt;br /&gt;
&lt;span style="color: blue;"&gt;int&lt;/span&gt; keyrepeateFrequency = 100;&lt;br /&gt;
&lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;KeyLastPressed&lt;/span&gt;&amp;gt; lastPressed = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;KeyLastPressed&lt;/span&gt;&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; color: blue; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;protected&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; CheckKeyboardInput(&lt;span style="color: rgb(43, 145, 175);"&gt;GameTime&lt;/span&gt; time)&lt;br /&gt;
{&lt;br /&gt;
&lt;span style="color: rgb(43, 145, 175);"&gt;      KeyboardState&lt;/span&gt; ks = &lt;span style="color: rgb(43, 145, 175);"&gt;Keyboard&lt;/span&gt;.GetState();&lt;br /&gt;
&lt;span style="color: rgb(43, 145, 175);"&gt;      Keys&lt;/span&gt;[] k = ks.GetPressedKeys();&lt;br /&gt;
      totalTime += time.ElapsedGameTime.Milliseconds;&lt;br /&gt;
&lt;span style="color: green;"&gt;      //flush the collection of combos that have served &lt;br /&gt;
      //their time and are ready for pushing again&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue;"&gt;      long&lt;/span&gt; difference = keyrepeateFrequency + 1;&lt;br /&gt;
&lt;span style="color: blue;"&gt;      while&lt;/span&gt; (difference &amp;gt;= keyrepeateFrequency &amp;amp;&amp;amp; lastPressed.Count&amp;gt;0)&lt;br /&gt;
      {&lt;br /&gt;
          difference = totalTime - lastPressed[0].timePressed;&lt;br /&gt;
&lt;span style="color: blue;"&gt;          if&lt;/span&gt; (difference &amp;gt;= keyrepeateFrequency)&lt;br /&gt;
          lastPressed.Remove(lastPressed[0]);&lt;br /&gt;
      }&lt;br /&gt;
&lt;span style="color: green;"&gt;      //Now we have to check to see if the keys were&lt;br /&gt;
      //pressing have been pressed less than keyrepeateFrequence ago&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue;"&gt;      bool&lt;/span&gt; hasBeenPressedRecently = &lt;span style="color: blue;"&gt;false&lt;/span&gt;;&lt;br /&gt;
&lt;span style="color: blue;"&gt;      foreach&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;KeyLastPressed&lt;/span&gt; klp &lt;span style="color: blue;"&gt;in&lt;/span&gt; lastPressed)&lt;br /&gt;
      {&lt;br /&gt;
&lt;span style="color: green;"&gt;         //could benifit from a better checking algorithim, like hashing&lt;br /&gt;
         //plus were not "really" checking for key combos&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue;"&gt;         if&lt;/span&gt; (klp.pressedKeys.Length == k.Length)&lt;br /&gt;
         {&lt;br /&gt;
&lt;span style="color: blue;"&gt;             foreach&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;Keys&lt;/span&gt; keyin &lt;span style="color: blue;"&gt;in&lt;/span&gt; k)&lt;br /&gt;
             {&lt;br /&gt;
&lt;span style="color: blue;"&gt;                 foreach&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;Keys&lt;/span&gt; keyprev &lt;span style="color: blue;"&gt;in&lt;/span&gt; klp.pressedKeys)&lt;br /&gt;
                 {&lt;br /&gt;
&lt;span style="color: blue;"&gt;                     if&lt;/span&gt; (keyin == keyprev)&lt;br /&gt;
                     {&lt;br /&gt;
                         hasBeenPressedRecently = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;br /&gt;
&lt;span style="color: blue;"&gt;                         break&lt;/span&gt;;&lt;br /&gt;
                     }&lt;br /&gt;
                 }&lt;br /&gt;
&lt;span style="color: blue;"&gt;                 if&lt;/span&gt; (hasBeenPressedRecently)&lt;br /&gt;
&lt;span style="color: blue;"&gt;                     break&lt;/span&gt;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
&lt;span style="color: green;"&gt;      //so has it been pressed recently?&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue;"&gt;      if&lt;/span&gt; (!hasBeenPressedRecently &amp;amp;&amp;amp; k.Length&amp;gt;0)&lt;br /&gt;
      {&lt;br /&gt;
&lt;span style="color: green;"&gt;      //nope it hasnt, so add it to our collection&lt;br /&gt;
&lt;/span&gt;      lastPressed.Add(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;KeyLastPressed&lt;/span&gt;(k, totalTime));&lt;br /&gt;
&lt;span style="color: green;"&gt;      //Now do game key press shenanigans.&lt;br /&gt;
      //DoGameStuffWithKeys(k);&lt;br /&gt;
&lt;/span&gt;      }&lt;br /&gt;
&lt;span style="color: blue;"&gt;           if&lt;/span&gt; (ks.IsKeyDown(&lt;span style="color: rgb(43, 145, 175);"&gt;Keys&lt;/span&gt;.Escape))&lt;br /&gt;
&lt;span style="color: blue;"&gt;              this&lt;/span&gt;.Quit();&lt;br /&gt;
}&lt;br /&gt;
&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;struct&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;KeyLastPressed&lt;br /&gt;
&lt;/span&gt;{&lt;br /&gt;
&lt;span style="color: blue;"&gt;      public&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Keys&lt;/span&gt;[] pressedKeys;&lt;br /&gt;
&lt;span style="color: blue;"&gt;      public&lt;/span&gt; &lt;span style="color: blue;"&gt;long&lt;/span&gt; timePressed;&lt;br /&gt;
&lt;span style="color: blue;"&gt;      public&lt;/span&gt; KeyLastPressed(&lt;span style="color: rgb(43, 145, 175);"&gt;Keys&lt;/span&gt;[] pk, &lt;span style="color: blue;"&gt;long&lt;/span&gt; tp)&lt;br /&gt;
      {&lt;br /&gt;
         pressedKeys = pk;&lt;br /&gt;
         timePressed = tp;&lt;br /&gt;
      }&lt;br /&gt;
}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;    So it's something to get you started.  Now, optimize the shit out of that and tell me what you come up with.  This code is very similar to what I'm using in a current little project I’m playing with, so if you, gentle reader, have a solution that you've developed, please share! &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;    Remember, I’ll be speaking at the &lt;a href="http://www.dodn.org/"&gt;Day of .Net&lt;/a&gt; this year (&lt;em&gt;&lt;span style="font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;the second one, on October 20th&lt;/span&gt;&lt;/em&gt;) on XNA, so if you like the code here, come get some more, if you hate it, come publicly ridicule me.  Either way, see you there!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 10pt;" class="MsoNormal"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=115549"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=115549" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/davenet/aggbug/115549.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Dave Redding</dc:creator>
            <guid>http://geekswithblogs.net/davenet/archive/2007/09/23/115549.aspx</guid>
            <pubDate>Sun, 23 Sep 2007 18:07:18 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/davenet/comments/115549.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/davenet/archive/2007/09/23/115549.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/davenet/comments/commentRss/115549.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/davenet/services/trackbacks/115549.aspx</trackback:ping>
        </item>
    </channel>
</rss>