本文来自http://blog.csdn.net/runaying ,引用必须注明出处!
cocos2d-x节点(CCEventListenerAcceleration.h)API
温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记
监听加速
///cocos2d/cocos2d-x-3.0alpha0/cocos2dx/event_dispatcher
//监听加速
#ifndef __cocos2d_libs__CCAccelerometerListener__
#define __cocos2d_libs__CCAccelerometerListener__
#include "CCEventListener.h"
#include "ccTypes.h"
NS_CC_BEGIN
class EventListenerAcceleration : public EventListener
{
public:
static EventListenerAcceleration* create(std::function<void(Acceleration*, Event* event)> callback);
virtual ~EventListenerAcceleration();
/// Overrides
virtual EventListenerAcceleration* clone() override;
virtual bool checkAvaiable() override;
private:
EventListenerAcceleration();
bool init(std::function<void(Acceleration*, Event* event)> callback);
std::function<void(Acceleration*, Event*)> onAccelerationEvent;
};
NS_CC_END
#endif /* defined(__cocos2d_libs__CCAccelerometerListener__) */