In the previous recipe, you may have found the bit masking process a little crude. Apparently so did Sony, as they provided a helper method in the GameEngine2D
library named Input2
that makes dealing with input a bit smoother. In this recipe, we are going to demonstrate how that class works.
Open or duplicate the code you created in the previous recipe. Only the contents of the while
loop are going to change in this recipe. The full code for this recipe is available at Ch2_Example2
.
Open AppMain.cs
and change the contents to the following code:
while(!quitApp) { Director.Instance.Update(); string currentStatus = "Your DPad is current pointing at: x="; currentStatus += Input2.GamePad0.Dpad.X; currentStatus += " y="; currentStatus += Input2.GamePad0.Dpad.Y; label.Text = currentStatus; if(Input2.GamePad0.Cross.Press) quitApp = true; if(Input2.GamePad0.Circle...