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__


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值