Harmonic Flow Framework (libhffwk)
Cross platform C++ 2D Game Engine Framework
Classes | Public Member Functions | Protected Attributes | List of all members
HFCore::Touch Class Reference

Interface for input type Touch. More...

#include <Touch.h>

Inheritance diagram for HFCore::Touch:
Inheritance graph
[legend]

Classes

struct  TouchInfo
 A structure that contains Touch event information. More...
 

Public Member Functions

 Touch (int32_hf id)
 Constructor. More...
 
virtual ~Touch ()
 Destructor.
 
const Vector2getPosition ()
 Get Touch position. More...
 
void setPosition (const Vector2 &pos)
 Set Touch position. More...
 
int32_hf getId ()
 Get Touch ID. More...
 
void addListener (TouchListener *listener)
 Add a new listener class to receive TouchListener callbacks. More...
 
void removeListener (TouchListener *listener)
 Remove a listener class from receiving further TouchListener callbacks. More...
 
void fireDownEvent (TouchInfo touch)
 Called internally when a Touch down event occurs. It calls TouchListener::touchDown(). More...
 
void fireUpEvent (TouchInfo touch)
 Called internally when a Touch up event occurs. It calls TouchListener::touchUp(). More...
 
void fireMoveEvent (TouchInfo touch)
 Called internally when a Touch move/drag event occurs. It calls TouchListener::touchMove(). More...
 
virtual void setConnected (bool connected)
 Set controller connected or disconnected. More...
 
virtual void setEnabled (bool enabled)
 Set controller enabled or disabled. More...
 
- Public Member Functions inherited from HFCore::Controller
 Controller ()
 Constructor.
 
virtual ~Controller ()
 Destructor.
 
virtual bool isEnabled ()
 Check whether controller is enabled. More...
 
virtual bool isConnected ()
 Check whether controller is connected. More...
 

Protected Attributes

TouchListenerVector mListeners
 Vector holding TouchListener classes.
 
Vector2 mPosition
 Vector2 holding touch position.
 
int32_hf mId
 Touch ID.
 

Detailed Description

Interface for input type Touch.

See TouchListener for methods available as callbacks for registered listeners.

Definition at line 44 of file Touch.h.

Constructor & Destructor Documentation

◆ Touch()

Touch::Touch ( int32_hf  id)

Constructor.

Parameters
idTouch ID.

Definition at line 34 of file Touch.cpp.

Member Function Documentation

◆ addListener()

void Touch::addListener ( TouchListener listener)

Add a new listener class to receive TouchListener callbacks.

Parameters
listenerClass to add as listener.
See also
removeListener()

Definition at line 53 of file Touch.cpp.

◆ fireDownEvent()

void Touch::fireDownEvent ( TouchInfo  touch)

Called internally when a Touch down event occurs. It calls TouchListener::touchDown().

Parameters
touchTouchInfo structure.

Definition at line 69 of file Touch.cpp.

◆ fireMoveEvent()

void Touch::fireMoveEvent ( TouchInfo  touch)

Called internally when a Touch move/drag event occurs. It calls TouchListener::touchMove().

Parameters
touchTouchInfo structure.

Definition at line 107 of file Touch.cpp.

◆ fireUpEvent()

void Touch::fireUpEvent ( TouchInfo  touch)

Called internally when a Touch up event occurs. It calls TouchListener::touchUp().

Parameters
touchTouchInfo structure.

Definition at line 88 of file Touch.cpp.

◆ getId()

int32_hf HFCore::Touch::getId ( )
inline

Get Touch ID.

Returns
Touch ID.

Definition at line 98 of file Touch.h.

◆ getPosition()

const Vector2 & Touch::getPosition ( )

Get Touch position.

Returns
Vector2 position.
See also
setPosition()

Definition at line 43 of file Touch.cpp.

◆ removeListener()

void Touch::removeListener ( TouchListener listener)

Remove a listener class from receiving further TouchListener callbacks.

Parameters
listenerClass to remove as listener.
See also
addListener()

Definition at line 61 of file Touch.cpp.

◆ setConnected()

void Touch::setConnected ( bool  connected)
virtual

Set controller connected or disconnected.

Parameters
connectedtrue if connected, else false.
See also
isConnected()

Reimplemented from HFCore::Controller.

Definition at line 126 of file Touch.cpp.

◆ setEnabled()

void Touch::setEnabled ( bool  enabled)
virtual

Set controller enabled or disabled.

Parameters
enabledtrue to enable, else false.
See also
isEnabled()

Reimplemented from HFCore::Controller.

Definition at line 148 of file Touch.cpp.

◆ setPosition()

void Touch::setPosition ( const Vector2 pos)

Set Touch position.

Parameters
posVector2 position to set.
See also
getPosition()

Definition at line 48 of file Touch.cpp.


The documentation for this class was generated from the following files: