Handling the controller's d-pad and buttons
In this recipe, we will look at how to read the device's gamepad's d-pad and button states. The code remains the same regardless of whether it is a physical device or if the controls are emulated.
Getting ready
Load up PlayStation Mobile Studio and create a new project. Add a reference to Sce.PlayStation.GameEngine2D
and Sce.PlayStation.GameEngine2D.Base
. The complete source for this example can be found in Ch2_Example1
.
How to do it...
In the AppMain.cs
file of your newly created project, enter the following code:
using System; using System.Collections.Generic; using Sce.PlayStation.Core; using Sce.PlayStation.Core.Environment; using Sce.PlayStation.Core.Graphics; using Sce.PlayStation.Core.Input; using ...
Get PlayStation®Mobile Development Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.