mirror of https://github.com/axmolengine/axmol.git
fixed #1142: fix TouchesTest crashed on Android and iOS
This commit is contained in:
parent
ba37e0e42f
commit
3fbfeeb7e8
|
@ -8,4 +8,4 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-9
|
||||
target=android-10
|
||||
|
|
|
@ -78,6 +78,12 @@ void Paddle::ccTouchMoved(CCTouch* touch, CCEvent* event)
|
|||
setPosition( CCPointMake(touchPoint.x, getPosition().y) );
|
||||
}
|
||||
|
||||
CCObject* Paddle::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
this->retain();
|
||||
return this;
|
||||
}
|
||||
|
||||
void Paddle::ccTouchEnded(CCTouch* touch, CCEvent* event)
|
||||
{
|
||||
CCAssert(m_state == kPaddleStateGrabbed, L"Paddle - Unexpected state!");
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef _PADDLE_H_
|
||||
#define _PADDLE_H_
|
||||
#ifndef _PADDLE_H_
|
||||
#define _PADDLE_H_
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
typedef enum tagPaddleState
|
||||
{
|
||||
kPaddleStateGrabbed,
|
||||
kPaddleStateUngrabbed
|
||||
typedef enum tagPaddleState
|
||||
{
|
||||
kPaddleStateGrabbed,
|
||||
kPaddleStateUngrabbed
|
||||
} PaddleState;
|
||||
|
||||
class Paddle : public CCSprite, public CCTargetedTouchDelegate
|
||||
|
@ -20,18 +20,19 @@ public:
|
|||
virtual ~Paddle(void);
|
||||
|
||||
CCRect rect();
|
||||
bool initWithTexture(CCTexture2D* aTexture);
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
bool containsTouchLocation(CCTouch* touch);
|
||||
virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
|
||||
virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
|
||||
virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
|
||||
|
||||
virtual void touchDelegateRetain();
|
||||
virtual void touchDelegateRelease();
|
||||
bool initWithTexture(CCTexture2D* aTexture);
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
bool containsTouchLocation(CCTouch* touch);
|
||||
virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
|
||||
virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
|
||||
virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
|
||||
static Paddle* paddleWithTexture(CCTexture2D* aTexture);
|
||||
virtual void touchDelegateRetain();
|
||||
virtual void touchDelegateRelease();
|
||||
|
||||
static Paddle* paddleWithTexture(CCTexture2D* aTexture);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,7 +24,6 @@ enum
|
|||
//
|
||||
//------------------------------------------------------------------
|
||||
PongScene::PongScene()
|
||||
:TestScene(true)
|
||||
{
|
||||
PongLayer *pongLayer = new PongLayer();//PongLayer::node();
|
||||
addChild(pongLayer);
|
||||
|
@ -33,7 +32,6 @@ PongScene::PongScene()
|
|||
|
||||
void PongScene::MainMenuCallback(CCObject* pSender)
|
||||
{
|
||||
CCDirector::sharedDirector()->setDeviceOrientation(CCDeviceOrientationPortrait);
|
||||
TestScene::MainMenuCallback(pSender);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue