XNA Essentials

Game Programming for Xbox 360, PC + Windows Phone

NAVIGATION - SEARCH

Chapter 7 - Pg 136 - Reference to ButtonType

Hi Chad,


Great book, I love it and have recommended it to others - I have another, but it didn't explain things like this book does ( Professional XNA Programming by Benjamin Nitschke ).


Anyways I think I found an error in the book, on page 136 in the  Update Method it states:



if (gamePadHandler.WasButtonPressed(0, ButtonType.Back))


  Game.Exit();



Should ButtonType.Back be: Buttons.Back? I've changed it to that and it seems to work (don't have an XBOX to test), but ButtonType is not a known type.


Thanks,


 


Shawn B.

slooksterpsv - Wednesday, March 3, 2010 @ 2:07 AM

Re: Chapter 7 - Pg 136 - Reference to ButtonType

First, thanks for the compliment on the book.  I'm glad you are liking it.  I hope it helps.


Second, sorry for taking so long to respond.


Third, you are exactly right.  It should be Buttons.Back.  I'll update the errata to have the same text I have for Chapter 9 put into Chapter 7:


With the change from XNA Game Studio 1.0 Refresh to XNA Game Studio 3.0, Microsoft included a enumeration type for buttons. In the original book we created our own type InputHandler.ButtonType. The built in enum type is simply Buttons. The code should reference Buttons instead of InputHandler.ButtonType.


Thanks for bringing this to my attention!


Chad

Chad Carter - Friday, March 5, 2010 @ 10:51 PM