mirror of https://github.com/axmolengine/axmol.git
debug
This commit is contained in:
parent
af3bbcbc7c
commit
2b23e0f6d5
|
@ -488,6 +488,10 @@
|
|||
RelativePath=".\include\ccTypes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CCUIAccelerometerDelegate.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CCXApplication.h"
|
||||
>
|
||||
|
@ -524,10 +528,6 @@
|
|||
RelativePath=".\include\cocos2d.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Cocos2dDefine.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\NSAutoreleasePool.h"
|
||||
>
|
||||
|
|
|
@ -29,6 +29,7 @@ THE SOFTWARE.
|
|||
#include "CCNode.h"
|
||||
#include "CCProtocols.h"
|
||||
#include "CCTouchDelegateProtocol.h"
|
||||
#include "CCUIAccelerometerDelegate.h"
|
||||
#include "ccxCommon.h"
|
||||
#include "CCXUIAccelerometer.h"
|
||||
namespace cocos2d {
|
||||
|
@ -58,6 +59,8 @@ public:
|
|||
virtual void keep(void);
|
||||
|
||||
virtual void didAccelerate(UIAcceleration* pAccelerationValue) {}
|
||||
virtual void AccelerometerDestroy(void);
|
||||
virtual void AccelerometerKeep(void);
|
||||
|
||||
/** If isTouchEnabled, this method is called onEnter. Override it to change the
|
||||
way CCLayer receives touch events.
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __UIACCELEROMETER_DELEGATE_H__
|
||||
#define __UIACCELEROMETER_DELEGATE_H__
|
||||
|
||||
#include "ccxCommon.h"
|
||||
|
||||
namespace cocos2d {
|
||||
/**
|
||||
@brief The device accelerometer reports values for each axis in units of g-force
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
|
||||
double timestamp;
|
||||
} UIAcceleration;
|
||||
|
||||
/**
|
||||
@brief
|
||||
The UIAccelerometerDelegate defines a single method for
|
||||
receiving acceleration-related data from the system.
|
||||
*/
|
||||
class CCX_DLL UIAccelerometerDelegate
|
||||
{
|
||||
public:
|
||||
virtual void didAccelerate(UIAcceleration* pAccelerationValue) {}
|
||||
|
||||
//! call the release() in child layer
|
||||
virtual void AccelerometerDestroy(void) {}
|
||||
//! call the retain() in child layer
|
||||
virtual void AccelerometerKeep(void) {}
|
||||
};
|
||||
|
||||
} //namespace cocos2d
|
||||
|
||||
#endif
|
|
@ -89,6 +89,16 @@ void CCLayer::keep(void)
|
|||
this->retain();
|
||||
}
|
||||
|
||||
void CCLayer::AccelerometerDestroy(void)
|
||||
{
|
||||
this->release();
|
||||
}
|
||||
|
||||
void CCLayer::AccelerometerKeep(void)
|
||||
{
|
||||
this->retain();
|
||||
}
|
||||
|
||||
|
||||
/// isTouchEnabled getter
|
||||
bool CCLayer::getIsTouchEnabled()
|
||||
|
|
|
@ -47,19 +47,19 @@ UIAccelerometerDelegate* UIAccelerometerHandler::getDelegate()
|
|||
|
||||
UIAccelerometerHandler::~UIAccelerometerHandler()
|
||||
{
|
||||
m_pDelegate->destroy();
|
||||
m_pDelegate->AccelerometerDestroy();
|
||||
}
|
||||
|
||||
void UIAccelerometerHandler::setDelegate(UIAccelerometerDelegate *pDelegate)
|
||||
{
|
||||
if (pDelegate)
|
||||
{
|
||||
pDelegate->keep();
|
||||
pDelegate->AccelerometerKeep();
|
||||
}
|
||||
|
||||
if (m_pDelegate)
|
||||
{
|
||||
m_pDelegate->destroy();
|
||||
m_pDelegate->AccelerometerDestroy();
|
||||
}
|
||||
m_pDelegate = pDelegate;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ bool UIAccelerometerHandler::initWithDelegate(UIAccelerometerDelegate *pDelegate
|
|||
assert(pDelegate != NULL);
|
||||
|
||||
m_pDelegate = pDelegate;
|
||||
pDelegate->keep();
|
||||
pDelegate->AccelerometerKeep();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ THE SOFTWARE.
|
|||
#ifndef __PLATFORM_UPHONE_UIACCELEROMETER_H__
|
||||
#define __PLATFORM_UPHONE_UIACCELEROMETER_H__
|
||||
|
||||
#include "CCUIAccelerometerDelegate.h"
|
||||
#include "TG3.h"
|
||||
#include "NSMutableArray.h"
|
||||
#include "ccxCommon.h"
|
||||
|
@ -32,34 +33,6 @@ THE SOFTWARE.
|
|||
|
||||
namespace cocos2d {
|
||||
|
||||
/**
|
||||
@brief The device accelerometer reports values for each axis in units of g-force
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
|
||||
double timestamp;
|
||||
} UIAcceleration;
|
||||
|
||||
/**
|
||||
@brief
|
||||
The UIAccelerometerDelegate defines a single method for
|
||||
receiving acceleration-related data from the system.
|
||||
*/
|
||||
class CCX_DLL UIAccelerometerDelegate
|
||||
{
|
||||
public:
|
||||
virtual void didAccelerate(UIAcceleration* pAccelerationValue) {}
|
||||
|
||||
//! call the release() in child layer
|
||||
virtual void destroy(void) {}
|
||||
//! call the retain() in child layer
|
||||
virtual void keep(void) {}
|
||||
};
|
||||
|
||||
/**
|
||||
@brief
|
||||
UIAccelerometerHandler
|
||||
|
|
Loading…
Reference in New Issue