# HTouchManager

## Functions

| `HTouchManager`
| `~HTouchManager`
HTouchInfo * | `AddTouch`
void | `ClearTouchActivity`
void | `ClearTouches`
bool | `RemoveTouch`
int | `GetActiveTouchCount`
int | `GetTouchCount`
int | `GetTouches`
HTouchInfo * | `GetTouch`

## Detailed Description

class HTouchManager

  The HTouchManager class stores and manages touch input.

  HTouchManager manages touch input usually coming from a multi-touch enabled device.

  Public Functions

  HTouchManager()

    Constructs an HTouchManager object.

  ~HTouchManager()

    Destructor for HTouchManager

  HTouchInfo *AddTouch(float x, float y, float timestamp, int taps, unsigned long ident)

    This method creates a HTouchInfo object and adds this object to the currently list of touch objects

    Parameters

      - x – The X coordinate of the touch event, in window space.

      - y – The Y coordinate of the touch event, in window space.

      - timestamp – The time when the touch has occured

      - taps – Number of “taps” (one or more consecutive touches interpreted as one touch)

      - ident – Unique identifier

    Returns

      A new or preexisting TouchInfo object constructed from the provided input

  void ClearTouchActivity()

    Clears the activity flag on all touches. Depending on the platform touches might be marked as “active” if they are referenced as part of a touch event. As an example a touch sequnce might start and end with 3 simultaneous touches but might consist of only one or two touches in between.

  void ClearTouches()
  bool RemoveTouch(unsigned long ident)

    This method removes a touch object from the current list of touches.

    Parameters

      ident – Unique identifier of touch

    Returns

      True if touch was found

  inline int GetActiveTouchCount()
    Returns

      Numher of active touches.

  int GetTouchCount()
    Returns

      Numher of total touches.

  int GetTouches(HTouchInfo *touches[], int maxtouches, bool activeOnly = false)

    This method retrieves an array of touches

    Parameters

      - touches – Array of pointers to HTouchInfo Objects. Returned to caller. Passed by reference always.

      - maxtouches – Maximum number of touches returned in “touches”

      - activeOnly – Only return active touches

    Returns

      Number of touches

  HTouchInfo *GetTouch(int index, bool activeOnly = false)

    This method retrieves a single touch object

    Parameters

      - index – Zero based index less than GetTouchCount() or GetActiveTouchCount()

      - activeOnly – Only return active touches

    Returns

      HTouchInfo or NULL