天天看点

CCTouch

#ifndef __CC_TOUCH_H__

#define __CC_TOUCH_H__

#include "cocoa/CCObject.h"

#include "cocoa/CCGeometry.h"

NS_CC_BEGIN

class CC_DLL CCTouch : public CCObject

{

public:

    CCTouch() 

        : m_nId(0),

        m_startPointCaptured(false)

    {}

    CCPoint getLocation() const;

    CCPoint getPreviousLocation() const;

    CCPoint getStartLocation() const;

    CCPoint getDelta() const;

    CCPoint getLocationInView() const;

    CCPoint getPreviousLocationInView() const;

    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__

转载于:https://www.cnblogs.com/sssssnian/p/3748607.html