CCTouch

#ifndef __CC_TOUCH_H__

#define __CC_TOUCH_H__


#include "cocoa/CCObject.h"

#include "cocoa/CCGeometry.h"


NS_CC_BEGIN


/**

 * @addtogroup input

 * @{

 */


class CC_DLL CCTouch : public CCObject

{

public:

    CCTouch() 

        : m_nId(0),

        m_startPointCaptured(false)

    {}


    /** returns the current touch location in OpenGL coordinates */

    CCPoint getLocation() const;

    /** returns the previous touch location in OpenGL coordinates */

    CCPoint getPreviousLocation() const;

    /** returns the start touch location in OpenGL coordinates */

    CCPoint getStartLocation() const;

    /** returns the delta of 2 current touches locations in screen coordinates */

    CCPoint getDelta() const;

    /** returns the current touch location in screen coordinates */

    CCPoint getLocationInView() const;

    /** returns the previous touch location in screen coordinates */

    CCPoint getPreviousLocationInView() const;

    /** returns the start touch location in screen coordinates */

    CCPoint getStartLocationInView() const;

    

    void setTouchInfo(int id, float x, float y)

    {

        m_nId = id;

        m_prevPoint = m_point;

        m_point.x   = x;

        m_point.y   = y;

        if (!m_startPointCaptured)

        {

            m_startPoint = m_point;

            m_startPointCaptured = true;

        }

    }


    int getID() const

    {

        return m_nId;

    }


private:

    int m_nId;

    bool m_startPointCaptured;

    CCPoint m_startPoint;

    CCPoint m_point;

    CCPoint m_prevPoint;

};


class CC_DLL CCEvent : public CCObject

{

};


// end of input group

/// @}


NS_CC_END


#endif  // __PLATFORM_TOUCH_H__


posted @ 2014-05-22 21:03  sssssnian  阅读(134)  评论(0编辑  收藏  举报