Handling touch events
In this recipe we will look into how to deal with touch events.
Getting ready
In PSM Studio, create a new project and add a reference to Sce.PlayStation.GameEngine2D
and Sce.PlayStation.GameEngine2D.Base
. Then add an image file to your project (I will re-use the trusty F18
) and make sure its Build Action is set to Content. The full code for this recipe is available as Ch2_Example4
.
This example will run in the simulator; however, it does not currently support multitouch. To see multiple touches handled, you will need to run this code on an actual device.
How to do it...
Open AppMain.cs
and enter the following code:
using System; using System.Collections.Generic; using Sce.PlayStation.Core; using Sce.PlayStation.Core.Environment; ...
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.