event.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* -*- mode: c; tab-width: 4; indent-tabs-mode: t; -*- */
  2. /* SCE CONFIDENTIAL
  3. $PSLibId$
  4. *
  5. * Copyright (C) 2010 Sony Computer Entertainment Inc.
  6. * All Rights Reserved.
  7. *
  8. */
  9. #ifndef _SCE_TOUCH_SAMPLE_EVENT_H
  10. #define _SCE_TOUCH_SAMPLE_EVENT_H
  11. #include <scetypes.h>
  12. #include <touch.h>
  13. #if defined(__cplusplus)
  14. extern "C" {
  15. #endif
  16. /*E Maximum number of basic event */
  17. #define MAX_EVENT (SCE_TOUCH_MAX_REPORT * 2)
  18. /*E Default value of move threshold */
  19. #define MOVE_THRESHOLD 10
  20. /*E Type of basic event */
  21. typedef enum TouchEvent{
  22. TOUCH_EVENT_RELEASE = 0,
  23. TOUCH_EVENT_PRESS,
  24. TOUCH_EVENT_HOLD,
  25. TOUCH_EVENT_MOVE,
  26. TOUCH_EVENT_ABORT,
  27. TOUCH_EVENT_ABORT_AND_RELEASE,
  28. }TouchEvent;
  29. /*E Touch Event Element */
  30. typedef struct TouchEventElem{
  31. TouchEvent event; /*E Event Type */
  32. SceUInt8 id; /*E Touch ID */
  33. SceInt16 curX; /*E Current x position */
  34. SceInt16 curY; /*E Current y position */
  35. SceInt16 curF; /*E Current force */
  36. SceInt16 deltaX; /*E Delta x position */
  37. SceInt16 deltaY; /*E Delta y position */
  38. SceInt16 deltaF; /*E Delta force */
  39. SceUInt64 deltaT; /*E Delta time */
  40. SceUInt64 elapsedT; /*E Elapsed time */
  41. struct TouchEventElem* pNext;
  42. }TouchEventElem;
  43. /*E Basic Touch Event Information */
  44. typedef struct TouchEventInfo{
  45. SceUInt64 updateTime; /*E Last update time */
  46. SceUInt32 moveThreshold; /*E The threshold of "MOVE" state */
  47. TouchEventElem* pFree; /*E Free Resources */
  48. TouchEventElem* pPress; /*E "PRESS" state Touch. */
  49. TouchEventElem* pHold; /*E "HOLD" state Touch. */
  50. TouchEventElem* pMove; /*E "MOVE" state Touch. */
  51. TouchEventElem* pAbort; /*E "ABORT" state Touch. */
  52. TouchEventElem* pRelease; /*E "RELEASE" and "ABORT and RELEASE" state Touch. */
  53. TouchEventElem eventElem[MAX_EVENT];
  54. }TouchEventInfo;
  55. /*E Initialize the TouchEventInfo Structure. */
  56. int touchEventInit(TouchEventInfo* pEventInfo);
  57. /*E Set threshold to judge "MOVE" or "HOLD" event. (Default:10) */
  58. int touchEventSetMoveThreshold(TouchEventInfo* pEventInfo, SceUInt32 threshold);
  59. /*E Updates the event information. */
  60. int touchEventUpdate(const SceTouchData* pData, TouchEventInfo* pEventInfo);
  61. /*E Dump Event Element */
  62. void touchEventDumpElemQueue(TouchEventElem* pEventElem);
  63. #if defined(__cplusplus)
  64. }
  65. #endif
  66. #endif /* _SCE_TOUCH_SAMPLE_EVENT_H */