mirror of https://github.com/axmolengine/axmol.git
Merge branch 'gles20' of https://github.com/cocos2d/cocos2d-x into gles20
This commit is contained in:
commit
95cabd7e42
|
@ -98,7 +98,7 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Allocates and initializes the action
|
/** Allocates and initializes the action
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use create() instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCAction* action();
|
CC_DEPRECATED_ATTRIBUTE static CCAction* action();
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** creates the action
|
/** creates the action
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use create(CCActionInterval* float) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCSpeed* actionWithAction(CCActionInterval *pAction, float fSpeed);
|
CC_DEPRECATED_ATTRIBUTE static CCSpeed* actionWithAction(CCActionInterval *pAction, float fSpeed);
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ public:
|
||||||
public:
|
public:
|
||||||
/** creates the action with a set boundary,
|
/** creates the action with a set boundary,
|
||||||
It will work with no boundary if @param rect is equal to CCRectZero.
|
It will work with no boundary if @param rect is equal to CCRectZero.
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use create(CCNode*, const CCRect&) intead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCFollow* actionWithTarget(CCNode *pFollowedNode, const CCRect& rect = CCRectZero);
|
CC_DEPRECATED_ATTRIBUTE static CCFollow* actionWithTarget(CCNode *pFollowedNode, const CCRect& rect = CCRectZero);
|
||||||
/** creates the action with a set boundary,
|
/** creates the action with a set boundary,
|
||||||
|
|
|
@ -299,9 +299,19 @@ CCObject* CCArray::lastObject()
|
||||||
|
|
||||||
CCObject* CCArray::randomObject()
|
CCObject* CCArray::randomObject()
|
||||||
{
|
{
|
||||||
if(data->num==0) return NULL;
|
if (data->num==0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return data->arr[(int)(data->num*CCRANDOM_0_1())];
|
float r = CCRANDOM_0_1();
|
||||||
|
|
||||||
|
if (r == 1) // to prevent from accessing data-arr[data->num], out of range.
|
||||||
|
{
|
||||||
|
r = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data->arr[(int)(data->num * r)];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCArray::containsObject(CCObject* object)
|
bool CCArray::containsObject(CCObject* object)
|
||||||
|
|
|
@ -116,37 +116,37 @@ public:
|
||||||
|
|
||||||
/* static functions */
|
/* static functions */
|
||||||
/** Create an array
|
/** Create an array
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use create() instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCArray* array();
|
CC_DEPRECATED_ATTRIBUTE static CCArray* array();
|
||||||
/** Create an array with one object
|
/** Create an array with one object
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithObject(CCObject*) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithObject(CCObject* pObject);
|
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithObject(CCObject* pObject);
|
||||||
/** Create an array with some objects
|
/** Create an array with some objects
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use create(CCObject*, ...) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithObjects(CCObject* pObject, ...);
|
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithObjects(CCObject* pObject, ...);
|
||||||
/** Create an array with capacity
|
/** Create an array with capacity
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithCapacity(unsigned int) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithCapacity(unsigned int capacity);
|
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithCapacity(unsigned int capacity);
|
||||||
/** Create an array with an existing array
|
/** Create an array with an existing array
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithArray(CCArray*) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithArray(CCArray* otherArray);
|
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithArray(CCArray* otherArray);
|
||||||
/**
|
/**
|
||||||
@brief Generate a CCArray pointer by file
|
@brief Generate a CCArray pointer by file
|
||||||
@param pFileName The file name of *.plist file
|
@param pFileName The file name of *.plist file
|
||||||
@return The CCArray pointer generated from the file
|
@return The CCArray pointer generated from the file
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithContentsOfFile(const char*) intead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithContentsOfFile(const char* pFileName);
|
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithContentsOfFile(const char* pFileName);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@brief The same meaning as arrayWithContentsOfFile(), but it doesn't call autorelease, so the
|
@brief The same meaning as arrayWithContentsOfFile(), but it doesn't call autorelease, so the
|
||||||
invoker should call release().
|
invoker should call release().
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithContentsOfFileThreadSafe(const char*) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithContentsOfFileThreadSafe(const char* pFileName);
|
CC_DEPRECATED_ATTRIBUTE static CCArray* arrayWithContentsOfFileThreadSafe(const char* pFileName);
|
||||||
|
|
||||||
|
|
|
@ -141,23 +141,24 @@ public:
|
||||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
/* static functions */
|
/* static functions */
|
||||||
//@deprecated: This interface will be deprecated sooner or later.
|
//@deprecated: Please use create() instead. This interface will be deprecated sooner or later.
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCDictionary* dictionary();
|
CC_DEPRECATED_ATTRIBUTE static CCDictionary* dictionary();
|
||||||
|
|
||||||
//@deprecated: This interface will be deprecated sooner or later.
|
//@deprecated: Please use createWithDictionary(CCDictionary*) instead. This interface will be deprecated sooner or later.
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCDictionary* dictionaryWithDictionary(CCDictionary* srcDict);
|
CC_DEPRECATED_ATTRIBUTE static CCDictionary* dictionaryWithDictionary(CCDictionary* srcDict);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Generate a CCDictionary pointer by file
|
@brief Generate a CCDictionary pointer by file
|
||||||
@param pFileName The file name of *.plist file
|
@param pFileName The file name of *.plist file
|
||||||
@return The CCDictionary pointer generated from the file
|
@return The CCDictionary pointer generated from the file
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithContentsOfFile(const char*) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCDictionary* dictionaryWithContentsOfFile(const char *pFileName);
|
CC_DEPRECATED_ATTRIBUTE static CCDictionary* dictionaryWithContentsOfFile(const char *pFileName);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@brief The same meaning as dictionaryWithContentsOfFile(), but it doesn't call autorelease, so the
|
@brief The same meaning as dictionaryWithContentsOfFile(), but it doesn't call autorelease, so the
|
||||||
invoker should call release().
|
invoker should call release().
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithContentsOfFileThreadSafe(const char*) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCDictionary* dictionaryWithContentsOfFileThreadSafe(const char *pFileName);
|
CC_DEPRECATED_ATTRIBUTE static CCDictionary* dictionaryWithContentsOfFileThreadSafe(const char *pFileName);
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,8 @@ static void removeUsedIndexBit(int index)
|
||||||
|
|
||||||
CCEGLViewProtocol::CCEGLViewProtocol()
|
CCEGLViewProtocol::CCEGLViewProtocol()
|
||||||
: m_pDelegate(NULL)
|
: m_pDelegate(NULL)
|
||||||
, m_fScreenScaleFactor(1.0f)
|
, m_fScaleY(1.0f)
|
||||||
, m_fYScale(1.0f)
|
, m_fScaleX(1.0f)
|
||||||
, m_fXScale(1.0f)
|
|
||||||
, m_bIsRetinaEnabled(false)
|
, m_bIsRetinaEnabled(false)
|
||||||
, m_eResolutionPolicy(kResolutionUnKnown)
|
, m_eResolutionPolicy(kResolutionUnKnown)
|
||||||
{
|
{
|
||||||
|
@ -69,22 +68,22 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height, Resol
|
||||||
|
|
||||||
m_obDesignResolutionSize.setSize(width, height);
|
m_obDesignResolutionSize.setSize(width, height);
|
||||||
|
|
||||||
m_fXScale = (float)m_obScreenSize.width / m_obDesignResolutionSize.width;
|
m_fScaleX = (float)m_obScreenSize.width / m_obDesignResolutionSize.width;
|
||||||
m_fYScale = (float)m_obScreenSize.height / m_obDesignResolutionSize.height;
|
m_fScaleY = (float)m_obScreenSize.height / m_obDesignResolutionSize.height;
|
||||||
|
|
||||||
if (resolutionPolicy == kCCResolutionNoBorder)
|
if (resolutionPolicy == kCCResolutionNoBorder)
|
||||||
{
|
{
|
||||||
m_fXScale = m_fYScale = MAX(m_fXScale, m_fYScale);
|
m_fScaleX = m_fScaleY = MAX(m_fScaleX, m_fScaleY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolutionPolicy == kCCResolutionShowAll)
|
if (resolutionPolicy == kCCResolutionShowAll)
|
||||||
{
|
{
|
||||||
m_fXScale = m_fYScale = MIN(m_fXScale, m_fYScale);
|
m_fScaleX = m_fScaleY = MIN(m_fScaleX, m_fScaleY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate the rect of viewport
|
// calculate the rect of viewport
|
||||||
float viewPortW = m_obDesignResolutionSize.width * m_fXScale;
|
float viewPortW = m_obDesignResolutionSize.width * m_fScaleX;
|
||||||
float viewPortH = m_obDesignResolutionSize.height * m_fYScale;
|
float viewPortH = m_obDesignResolutionSize.height * m_fScaleY;
|
||||||
|
|
||||||
m_obViewPortRect.setRect((m_obScreenSize.width - viewPortW) / 2, (m_obScreenSize.height - viewPortH) / 2, viewPortW, viewPortH);
|
m_obViewPortRect.setRect((m_obScreenSize.width - viewPortW) / 2, (m_obScreenSize.height - viewPortH) / 2, viewPortW, viewPortH);
|
||||||
|
|
||||||
|
@ -103,21 +102,26 @@ bool CCEGLViewProtocol::enableRetina()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCSize CCEGLViewProtocol::getSize()
|
const CCSize& CCEGLViewProtocol::getSize() const
|
||||||
{
|
{
|
||||||
return m_obDesignResolutionSize;
|
return m_obDesignResolutionSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEGLViewProtocol::setSize(float width, float height)
|
const CCSize& CCEGLViewProtocol::getFrameSize() const
|
||||||
|
{
|
||||||
|
return m_obScreenSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEGLViewProtocol::setFrameSize(float width, float height)
|
||||||
{
|
{
|
||||||
m_obDesignResolutionSize = m_obScreenSize = CCSizeMake(width, height);
|
m_obDesignResolutionSize = m_obScreenSize = CCSizeMake(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCSize CCEGLViewProtocol::getVisibleSize()
|
CCSize CCEGLViewProtocol::getVisibleSize() const
|
||||||
{
|
{
|
||||||
if (m_eResolutionPolicy == kCCResolutionNoBorder)
|
if (m_eResolutionPolicy == kCCResolutionNoBorder)
|
||||||
{
|
{
|
||||||
return CCSizeMake(m_obScreenSize.width/m_fXScale, m_obScreenSize.height/m_fYScale);
|
return CCSizeMake(m_obScreenSize.width/m_fScaleX, m_obScreenSize.height/m_fScaleY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -125,12 +129,12 @@ CCSize CCEGLViewProtocol::getVisibleSize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CCPoint CCEGLViewProtocol::getVisibleOrigin()
|
CCPoint CCEGLViewProtocol::getVisibleOrigin() const
|
||||||
{
|
{
|
||||||
if (m_eResolutionPolicy == kCCResolutionNoBorder)
|
if (m_eResolutionPolicy == kCCResolutionNoBorder)
|
||||||
{
|
{
|
||||||
return CCPointMake((m_obDesignResolutionSize.width - m_obScreenSize.width/m_fXScale)/2,
|
return CCPointMake((m_obDesignResolutionSize.width - m_obScreenSize.width/m_fScaleX)/2,
|
||||||
(m_obDesignResolutionSize.height - m_obScreenSize.height/m_fYScale)/2);
|
(m_obDesignResolutionSize.height - m_obScreenSize.height/m_fScaleY)/2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -143,11 +147,6 @@ void CCEGLViewProtocol::setTouchDelegate(EGLTouchDelegate * pDelegate)
|
||||||
m_pDelegate = pDelegate;
|
m_pDelegate = pDelegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CCEGLViewProtocol::getScreenScaleFactor()
|
|
||||||
{
|
|
||||||
return m_fScreenScaleFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CCEGLViewProtocol::setContentScaleFactor(float contentScaleFactor)
|
bool CCEGLViewProtocol::setContentScaleFactor(float contentScaleFactor)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -155,18 +154,18 @@ bool CCEGLViewProtocol::setContentScaleFactor(float contentScaleFactor)
|
||||||
|
|
||||||
void CCEGLViewProtocol::setViewPortInPoints(float x , float y , float w , float h)
|
void CCEGLViewProtocol::setViewPortInPoints(float x , float y , float w , float h)
|
||||||
{
|
{
|
||||||
glViewport((GLint)(x * m_fXScale + m_obViewPortRect.origin.x),
|
glViewport((GLint)(x * m_fScaleX + m_obViewPortRect.origin.x),
|
||||||
(GLint)(y * m_fYScale + m_obViewPortRect.origin.y),
|
(GLint)(y * m_fScaleY + m_obViewPortRect.origin.y),
|
||||||
(GLsizei)(w * m_fXScale),
|
(GLsizei)(w * m_fScaleX),
|
||||||
(GLsizei)(h * m_fYScale));
|
(GLsizei)(h * m_fScaleY));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEGLViewProtocol::setScissorInPoints(float x , float y , float w , float h)
|
void CCEGLViewProtocol::setScissorInPoints(float x , float y , float w , float h)
|
||||||
{
|
{
|
||||||
glScissor((GLint)(x * m_fXScale + m_obViewPortRect.origin.x),
|
glScissor((GLint)(x * m_fScaleX + m_obViewPortRect.origin.x),
|
||||||
(GLint)(y * m_fYScale + m_obViewPortRect.origin.y),
|
(GLint)(y * m_fScaleY + m_obViewPortRect.origin.y),
|
||||||
(GLsizei)(w * m_fXScale),
|
(GLsizei)(w * m_fScaleX),
|
||||||
(GLsizei)(h * m_fYScale));
|
(GLsizei)(h * m_fScaleY));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float ys[])
|
void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float ys[])
|
||||||
|
@ -202,8 +201,8 @@ void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pTouch->setTouchInfo(nUnusedIndex, (x - m_obViewPortRect.origin.x) / m_fXScale,
|
pTouch->setTouchInfo(nUnusedIndex, (x - m_obViewPortRect.origin.x) / m_fScaleX,
|
||||||
(y - m_obViewPortRect.origin.y) / m_fYScale);
|
(y - m_obViewPortRect.origin.y) / m_fScaleY);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCLOG("x = %f y = %f", pTouch->getLocationInView().x, pTouch->getLocationInView().y);
|
CCLOG("x = %f y = %f", pTouch->getLocationInView().x, pTouch->getLocationInView().y);
|
||||||
|
@ -250,8 +249,8 @@ void CCEGLViewProtocol::handleTouchesMove(int num, int ids[], float xs[], float
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pTouch->setTouchInfo(pIndex->getValue(), (x - m_obViewPortRect.origin.x) / m_fXScale,
|
pTouch->setTouchInfo(pIndex->getValue(), (x - m_obViewPortRect.origin.x) / m_fScaleX,
|
||||||
(y - m_obViewPortRect.origin.y) / m_fYScale);
|
(y - m_obViewPortRect.origin.y) / m_fScaleY);
|
||||||
}
|
}
|
||||||
|
|
||||||
set.addObject(pTouch);
|
set.addObject(pTouch);
|
||||||
|
@ -300,8 +299,8 @@ void CCEGLViewProtocol::getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pTouch->setTouchInfo(pIndex->getValue(), (x - m_obViewPortRect.origin.x) / m_fXScale,
|
pTouch->setTouchInfo(pIndex->getValue(), (x - m_obViewPortRect.origin.x) / m_fScaleX,
|
||||||
(y - m_obViewPortRect.origin.y) / m_fYScale);
|
(y - m_obViewPortRect.origin.y) / m_fScaleY);
|
||||||
}
|
}
|
||||||
|
|
||||||
set.addObject(pTouch);
|
set.addObject(pTouch);
|
||||||
|
@ -343,4 +342,24 @@ void CCEGLViewProtocol::handleTouchesCancel(int num, int ids[], float xs[], floa
|
||||||
m_pDelegate->touchesCancelled(&set, NULL);
|
m_pDelegate->touchesCancelled(&set, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CCRect& CCEGLViewProtocol::getViewPortRect() const
|
||||||
|
{
|
||||||
|
return m_obViewPortRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CCEGLViewProtocol::getScaleX() const
|
||||||
|
{
|
||||||
|
return m_fScaleX;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CCEGLViewProtocol::getScaleY() const
|
||||||
|
{
|
||||||
|
return m_fScaleY;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCEGLViewProtocol::isRetinaEnabled() const
|
||||||
|
{
|
||||||
|
return m_bIsRetinaEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -36,21 +36,81 @@ public:
|
||||||
CCEGLViewProtocol();
|
CCEGLViewProtocol();
|
||||||
virtual ~CCEGLViewProtocol();
|
virtual ~CCEGLViewProtocol();
|
||||||
|
|
||||||
|
/** Force destorying EGL view, subclass must implement this method. */
|
||||||
virtual void end() = 0;
|
virtual void end() = 0;
|
||||||
|
|
||||||
|
/** Get whether opengl render system is ready, subclass must implement this method. */
|
||||||
virtual bool isOpenGLReady() = 0;
|
virtual bool isOpenGLReady() = 0;
|
||||||
|
|
||||||
|
/** Exchanges the front and back buffers, subclass must implement this method. */
|
||||||
virtual void swapBuffers() = 0;
|
virtual void swapBuffers() = 0;
|
||||||
|
|
||||||
|
/** Open or close IME keyboard , subclass must implement this method. */
|
||||||
virtual void setIMEKeyboardState(bool bOpen) = 0;
|
virtual void setIMEKeyboardState(bool bOpen) = 0;
|
||||||
|
|
||||||
virtual CCSize getSize();
|
/**
|
||||||
virtual void setSize(float width, float height);
|
* Get design resolution size.
|
||||||
virtual CCSize getVisibleSize();
|
* If setDesignResolutionSize wasn't invoked, the result of this function return is the same as 'getFrameSize'
|
||||||
virtual CCPoint getVisibleOrigin();
|
*/
|
||||||
|
|
||||||
|
virtual const CCSize& getSize() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the frame size of EGL view.
|
||||||
|
* In general, it returns the screen size since the EGL view is a fullscreen view.
|
||||||
|
*/
|
||||||
|
virtual const CCSize& getFrameSize() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the frame size of EGL view.
|
||||||
|
*/
|
||||||
|
virtual void setFrameSize(float width, float height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the visible area size of opengl viewport.
|
||||||
|
*/
|
||||||
|
virtual CCSize getVisibleSize() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the visible origin point of opengl viewport.
|
||||||
|
*/
|
||||||
|
virtual CCPoint getVisibleOrigin() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the design resolutin size.
|
||||||
|
* You can't use it with enableRetina together.
|
||||||
|
* @param width Design resolution width.
|
||||||
|
* @param height Design resolution height.
|
||||||
|
* @param resolutionPolicy The resolution policy you need, there are:
|
||||||
|
* [1] kCCResolutionExactFit Fill screen, if the design resolution ratio of width and height is different from the screen resolution ratio, your game view will be stretched.
|
||||||
|
* [2] kCCResolutionNoBorder Full screen without black border, if the design resolution ratio of width and height is different from the screen resolution ratio, two areas of your game view will be cut.
|
||||||
|
* [3] kCCResolutionShowAll Full screen with black border, if the design resolution ratio of width and height is different from the screen resolution ratio, two black border will be shown on the screen;
|
||||||
|
*/
|
||||||
virtual void setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy);
|
virtual void setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy);
|
||||||
|
|
||||||
|
/** Set touch delegate */
|
||||||
virtual void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
virtual void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
||||||
virtual float getScreenScaleFactor();
|
|
||||||
|
/**
|
||||||
|
* Set content scale factor.
|
||||||
|
* @return If return true, it means the plaform supports retina display.
|
||||||
|
*/
|
||||||
virtual bool setContentScaleFactor(float contentScaleFactor);
|
virtual bool setContentScaleFactor(float contentScaleFactor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set opengl view port rectangle with points.
|
||||||
|
*/
|
||||||
virtual void setViewPortInPoints(float x , float y , float w , float h);
|
virtual void setViewPortInPoints(float x , float y , float w , float h);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Scissor rectangle with points.
|
||||||
|
*/
|
||||||
virtual void setScissorInPoints(float x , float y , float w , float h);
|
virtual void setScissorInPoints(float x , float y , float w , float h);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable retina mode.
|
||||||
|
* You can't use it with setDesignResolutionSize
|
||||||
|
*/
|
||||||
virtual bool enableRetina();
|
virtual bool enableRetina();
|
||||||
|
|
||||||
/** handle touch events by default, if you want to custom your handles, please override these functions */
|
/** handle touch events by default, if you want to custom your handles, please override these functions */
|
||||||
|
@ -59,20 +119,43 @@ public:
|
||||||
virtual void handleTouchesEnd(int num, int ids[], float xs[], float ys[]);
|
virtual void handleTouchesEnd(int num, int ids[], float xs[], float ys[]);
|
||||||
virtual void handleTouchesCancel(int num, int ids[], float xs[], float ys[]);
|
virtual void handleTouchesCancel(int num, int ids[], float xs[], float ys[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get opengl view port rectangle.
|
||||||
|
*/
|
||||||
|
const CCRect& getViewPortRect() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the scale factor of horizontal direction.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
float getScaleX() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the scale factor of vertical direction.
|
||||||
|
*/
|
||||||
|
float getScaleY() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get whether the retina mode is enabled.
|
||||||
|
*/
|
||||||
|
bool isRetinaEnabled() const;
|
||||||
private:
|
private:
|
||||||
void getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[], float xs[], float ys[]);
|
void getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[], float xs[], float ys[]);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EGLTouchDelegate* m_pDelegate;
|
EGLTouchDelegate* m_pDelegate;
|
||||||
float m_fScreenScaleFactor;
|
|
||||||
// real size of screen
|
// real size of screen
|
||||||
CCSize m_obScreenSize;
|
CCSize m_obScreenSize;
|
||||||
// resolution size, it is the size the app resources designed for
|
// resolution size, it is the size the app resources designed for
|
||||||
CCSize m_obDesignResolutionSize;
|
CCSize m_obDesignResolutionSize;
|
||||||
// the view port size
|
// the view port size
|
||||||
CCRect m_obViewPortRect;
|
CCRect m_obViewPortRect;
|
||||||
|
// the view name
|
||||||
char m_szViewName[50];
|
char m_szViewName[50];
|
||||||
float m_fXScale;
|
|
||||||
float m_fYScale;
|
float m_fScaleX;
|
||||||
|
float m_fScaleY;
|
||||||
ResolutionPolicy m_eResolutionPolicy;
|
ResolutionPolicy m_eResolutionPolicy;
|
||||||
bool m_bIsRetinaEnabled;
|
bool m_bIsRetinaEnabled;
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,13 +77,13 @@ public:
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Set the ResourcePath,we will find resource relative to this path
|
@brief Set the resource directory,we will find resource relative to this directory
|
||||||
@param pszResourcePath Relative path to root
|
@param pszDirectoryName Relative path to root
|
||||||
*/
|
*/
|
||||||
void setResourceDirectory(const char *pszDirectoryName);
|
void setResourceDirectory(const char *pszDirectoryName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Get the ResourcePath
|
@brief Get the resource directory
|
||||||
*/
|
*/
|
||||||
const char* getResourceDirectory();
|
const char* getResourceDirectory();
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ bool CCEGLView::setContentScaleFactor(float contentScaleFactor)
|
||||||
view.contentScaleFactor = contentScaleFactor;
|
view.contentScaleFactor = contentScaleFactor;
|
||||||
[view setNeedsLayout];
|
[view setNeedsLayout];
|
||||||
|
|
||||||
m_fXScale = m_fYScale = contentScaleFactor;
|
m_fScaleX = m_fScaleY = contentScaleFactor;
|
||||||
m_bIsRetinaEnabled = true;
|
m_bIsRetinaEnabled = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -99,12 +99,6 @@ void CCEGLView::swapBuffers()
|
||||||
[[EAGLView sharedEGLView] swapBuffers];
|
[[EAGLView sharedEGLView] swapBuffers];
|
||||||
}
|
}
|
||||||
|
|
||||||
CCSize CCEGLView::getFrameSize()
|
|
||||||
{
|
|
||||||
assert(false);
|
|
||||||
return CCSizeMake(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCEGLView::setIMEKeyboardState(bool bOpen)
|
void CCEGLView::setIMEKeyboardState(bool bOpen)
|
||||||
{
|
{
|
||||||
if (bOpen)
|
if (bOpen)
|
||||||
|
|
|
@ -171,6 +171,15 @@ void CCFileUtils::purgeCachedEntries()
|
||||||
void CCFileUtils::setResourceDirectory(const char *pszDirectoryName)
|
void CCFileUtils::setResourceDirectory(const char *pszDirectoryName)
|
||||||
{
|
{
|
||||||
m_obDirectory = pszDirectoryName;
|
m_obDirectory = pszDirectoryName;
|
||||||
|
if (m_obDirectory.size() > 0 && m_obDirectory[m_obDirectory.size() - 1] != '/')
|
||||||
|
{
|
||||||
|
m_obDirectory.append("/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CCFileUtils::getResourceDirectory()
|
||||||
|
{
|
||||||
|
return m_obDirectory.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
|
const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
|
||||||
|
|
|
@ -92,9 +92,13 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
//fsaa addition
|
//fsaa addition
|
||||||
BOOL multisampling_;
|
BOOL multisampling_;
|
||||||
unsigned int requestedSamples_;
|
unsigned int requestedSamples_;
|
||||||
|
BOOL isUseUITextField;
|
||||||
@private
|
@private
|
||||||
NSString * markedText_;
|
NSString * markedText_;
|
||||||
CGRect caretRect_;
|
CGRect caretRect_;
|
||||||
|
CGRect originalRect_;
|
||||||
|
NSNotification* keyboardShowNotification_;
|
||||||
|
BOOL isKeyboardShown_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property(nonatomic, readonly) UITextPosition *beginningOfDocument;
|
@property(nonatomic, readonly) UITextPosition *beginningOfDocument;
|
||||||
|
@ -104,7 +108,8 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
@property (nonatomic, copy) NSDictionary *markedTextStyle;
|
@property (nonatomic, copy) NSDictionary *markedTextStyle;
|
||||||
@property(readwrite, copy) UITextRange *selectedTextRange;
|
@property(readwrite, copy) UITextRange *selectedTextRange;
|
||||||
@property(nonatomic, readonly) id<UITextInputTokenizer> tokenizer;
|
@property(nonatomic, readonly) id<UITextInputTokenizer> tokenizer;
|
||||||
|
@property(nonatomic, readonly, getter = isKeyboardShown) BOOL isKeyboardShown;
|
||||||
|
@property(nonatomic, retain) NSNotification* keyboardShowNotification;
|
||||||
/** creates an initializes an EAGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer */
|
/** creates an initializes an EAGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer */
|
||||||
+ (id) viewWithFrame:(CGRect)frame;
|
+ (id) viewWithFrame:(CGRect)frame;
|
||||||
/** creates an initializes an EAGLView with a frame, a color buffer format, and 0-bit depth buffer */
|
/** creates an initializes an EAGLView with a frame, a color buffer format, and 0-bit depth buffer */
|
||||||
|
@ -147,4 +152,6 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
-(int) getWidth;
|
-(int) getWidth;
|
||||||
-(int) getHeight;
|
-(int) getHeight;
|
||||||
|
|
||||||
|
-(void) doAnimationWhenKeyboardMoveWithDuration:(float) duration distance:(float) dis;
|
||||||
|
-(void) doAnimationWhenAnotherEditBeClicked;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -70,7 +70,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
#import "CCTouch.h"
|
#import "CCTouch.h"
|
||||||
#import "CCIMEDispatcher.h"
|
#import "CCIMEDispatcher.h"
|
||||||
#import "OpenGL_Internal.h"
|
#import "OpenGL_Internal.h"
|
||||||
|
#import "CCEGLView.h"
|
||||||
//CLASS IMPLEMENTATIONS:
|
//CLASS IMPLEMENTATIONS:
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +87,8 @@ static EAGLView *view = 0;
|
||||||
@synthesize pixelFormat=pixelformat_, depthFormat=depthFormat_;
|
@synthesize pixelFormat=pixelformat_, depthFormat=depthFormat_;
|
||||||
@synthesize context=context_;
|
@synthesize context=context_;
|
||||||
@synthesize multiSampling=multiSampling_;
|
@synthesize multiSampling=multiSampling_;
|
||||||
|
@synthesize isKeyboardShown=isKeyboardShown_;
|
||||||
|
@synthesize keyboardShowNotification = keyboardShowNotification_;
|
||||||
+ (Class) layerClass
|
+ (Class) layerClass
|
||||||
{
|
{
|
||||||
return [CAEAGLLayer class];
|
return [CAEAGLLayer class];
|
||||||
|
@ -132,6 +133,7 @@ static EAGLView *view = 0;
|
||||||
{
|
{
|
||||||
if((self = [super initWithFrame:frame]))
|
if((self = [super initWithFrame:frame]))
|
||||||
{
|
{
|
||||||
|
isUseUITextField = YES;
|
||||||
pixelformat_ = format;
|
pixelformat_ = format;
|
||||||
depthFormat_ = depth;
|
depthFormat_ = depth;
|
||||||
multiSampling_ = sampling;
|
multiSampling_ = sampling;
|
||||||
|
@ -145,6 +147,9 @@ static EAGLView *view = 0;
|
||||||
|
|
||||||
|
|
||||||
view = self;
|
view = self;
|
||||||
|
|
||||||
|
originalRect_ = self.frame;
|
||||||
|
self.keyboardShowNotification = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -237,6 +242,7 @@ static EAGLView *view = 0;
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[renderer_ release];
|
[renderer_ release];
|
||||||
|
[self.keyboardShowNotification release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,11 +365,34 @@ static EAGLView *view = 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-(void) handleTouchesAfterKeyboardShow
|
||||||
|
{
|
||||||
|
NSArray *subviews = self.subviews;
|
||||||
|
|
||||||
|
for(UIView* view in subviews)
|
||||||
|
{
|
||||||
|
if([view isKindOfClass:NSClassFromString(@"CustomUITextField")])
|
||||||
|
{
|
||||||
|
if ([view isFirstResponder])
|
||||||
|
{
|
||||||
|
[view resignFirstResponder];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Pass the touches to the superview
|
// Pass the touches to the superview
|
||||||
#pragma mark EAGLView - Touch Delegate
|
#pragma mark EAGLView - Touch Delegate
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||||
{
|
{
|
||||||
|
if (isKeyboardShown_)
|
||||||
|
{
|
||||||
|
[self handleTouchesAfterKeyboardShow];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int ids[CC_MAX_TOUCHES] = {0};
|
int ids[CC_MAX_TOUCHES] = {0};
|
||||||
float xs[CC_MAX_TOUCHES] = {0.0f};
|
float xs[CC_MAX_TOUCHES] = {0.0f};
|
||||||
float ys[CC_MAX_TOUCHES] = {0.0f};
|
float ys[CC_MAX_TOUCHES] = {0.0f};
|
||||||
|
@ -435,12 +464,29 @@ static EAGLView *view = 0;
|
||||||
[markedText_ release];
|
[markedText_ release];
|
||||||
}
|
}
|
||||||
markedText_ = nil;
|
markedText_ = nil;
|
||||||
|
if (isUseUITextField)
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)becomeFirstResponder
|
||||||
|
{
|
||||||
|
isUseUITextField = NO;
|
||||||
|
return [super becomeFirstResponder];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)resignFirstResponder
|
||||||
|
{
|
||||||
|
isUseUITextField = YES;
|
||||||
|
return [super resignFirstResponder];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark UIKeyInput protocol
|
#pragma mark UIKeyInput protocol
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)hasText
|
- (BOOL)hasText
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -724,6 +770,7 @@ static EAGLView *view = 0;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cocos2d::CCIMEKeyboardNotificationInfo notiInfo;
|
cocos2d::CCIMEKeyboardNotificationInfo notiInfo;
|
||||||
notiInfo.begin = cocos2d::CCRect(begin.origin.x,
|
notiInfo.begin = cocos2d::CCRect(begin.origin.x,
|
||||||
begin.origin.y,
|
begin.origin.y,
|
||||||
|
@ -734,9 +781,36 @@ static EAGLView *view = 0;
|
||||||
end.size.width,
|
end.size.width,
|
||||||
end.size.height);
|
end.size.height);
|
||||||
notiInfo.duration = (float)aniDuration;
|
notiInfo.duration = (float)aniDuration;
|
||||||
|
|
||||||
|
float offestY = cocos2d::CCEGLView::sharedOpenGLView().getViewPortRect().origin.y;
|
||||||
|
|
||||||
|
if (offestY > 0.0f)
|
||||||
|
{
|
||||||
|
notiInfo.begin.origin.y += offestY;
|
||||||
|
notiInfo.begin.size.height -= offestY;
|
||||||
|
notiInfo.end.size.height -= offestY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cocos2d::CCEGLView::sharedOpenGLView().isRetinaEnabled())
|
||||||
|
{
|
||||||
|
float scaleX = cocos2d::CCEGLView::sharedOpenGLView().getScaleX();
|
||||||
|
float scaleY = cocos2d::CCEGLView::sharedOpenGLView().getScaleY();
|
||||||
|
|
||||||
|
notiInfo.begin.origin.x /= scaleX;
|
||||||
|
notiInfo.begin.origin.y /= scaleY;
|
||||||
|
notiInfo.begin.size.width /= scaleX;
|
||||||
|
notiInfo.begin.size.height /= scaleY;
|
||||||
|
|
||||||
|
notiInfo.end.origin.x /= scaleX;
|
||||||
|
notiInfo.end.origin.y /= scaleY;
|
||||||
|
notiInfo.end.size.width /= scaleX;
|
||||||
|
notiInfo.end.size.height /= scaleY;
|
||||||
|
}
|
||||||
|
|
||||||
cocos2d::CCIMEDispatcher* dispatcher = cocos2d::CCIMEDispatcher::sharedDispatcher();
|
cocos2d::CCIMEDispatcher* dispatcher = cocos2d::CCIMEDispatcher::sharedDispatcher();
|
||||||
if (UIKeyboardWillShowNotification == type)
|
if (UIKeyboardWillShowNotification == type)
|
||||||
{
|
{
|
||||||
|
self.keyboardShowNotification = [notif copy];
|
||||||
dispatcher->dispatchKeyboardWillShow(notiInfo);
|
dispatcher->dispatchKeyboardWillShow(notiInfo);
|
||||||
}
|
}
|
||||||
else if (UIKeyboardDidShowNotification == type)
|
else if (UIKeyboardDidShowNotification == type)
|
||||||
|
@ -746,6 +820,7 @@ static EAGLView *view = 0;
|
||||||
caretRect_ = end;
|
caretRect_ = end;
|
||||||
caretRect_.origin.y = viewSize.height - (caretRect_.origin.y + caretRect_.size.height + [UIFont smallSystemFontSize]);
|
caretRect_.origin.y = viewSize.height - (caretRect_.origin.y + caretRect_.size.height + [UIFont smallSystemFontSize]);
|
||||||
caretRect_.size.height = 0;
|
caretRect_.size.height = 0;
|
||||||
|
isKeyboardShown_ = YES;
|
||||||
}
|
}
|
||||||
else if (UIKeyboardWillHideNotification == type)
|
else if (UIKeyboardWillHideNotification == type)
|
||||||
{
|
{
|
||||||
|
@ -755,6 +830,58 @@ static EAGLView *view = 0;
|
||||||
{
|
{
|
||||||
caretRect_ = CGRectZero;
|
caretRect_ = CGRectZero;
|
||||||
dispatcher->dispatchKeyboardDidHide(notiInfo);
|
dispatcher->dispatchKeyboardDidHide(notiInfo);
|
||||||
|
isKeyboardShown_ = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)dis
|
||||||
|
{
|
||||||
|
[UIView beginAnimations:nil context:NULL];
|
||||||
|
[UIView setAnimationDelegate:self];
|
||||||
|
[UIView setAnimationDuration:duration];
|
||||||
|
[UIView setAnimationBeginsFromCurrentState:YES];
|
||||||
|
|
||||||
|
NSLog(@"[animation] dis = %f\n", dis);
|
||||||
|
|
||||||
|
if (dis < 0.0f) dis = 0.0f;
|
||||||
|
|
||||||
|
if (!cocos2d::CCEGLView::sharedOpenGLView().isRetinaEnabled())
|
||||||
|
{
|
||||||
|
dis *= cocos2d::CCEGLView::sharedOpenGLView().getScaleY();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ([[UIApplication sharedApplication] statusBarOrientation])
|
||||||
|
{
|
||||||
|
case UIInterfaceOrientationPortrait:
|
||||||
|
self.frame = CGRectMake(originalRect_.origin.x, originalRect_.origin.y - dis, originalRect_.size.width, originalRect_.size.height);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UIInterfaceOrientationPortraitUpsideDown:
|
||||||
|
self.frame = CGRectMake(originalRect_.origin.x, originalRect_.origin.y + dis, originalRect_.size.width, originalRect_.size.height);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UIInterfaceOrientationLandscapeLeft:
|
||||||
|
self.frame = CGRectMake(originalRect_.origin.x - dis, originalRect_.origin.y , originalRect_.size.width, originalRect_.size.height);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UIInterfaceOrientationLandscapeRight:
|
||||||
|
self.frame = CGRectMake(originalRect_.origin.x + dis, originalRect_.origin.y , originalRect_.size.width, originalRect_.size.height);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
[UIView commitAnimations];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-(void) doAnimationWhenAnotherEditBeClicked
|
||||||
|
{
|
||||||
|
if (self.keyboardShowNotification != nil)
|
||||||
|
{
|
||||||
|
[[NSNotificationCenter defaultCenter]postNotification:self.keyboardShowNotification];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -397,10 +397,10 @@ void CCEGLView::resize(int width, int height)
|
||||||
rcClient.bottom - rcClient.top, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
rcClient.bottom - rcClient.top, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEGLView::setSize(float width, float height)
|
void CCEGLView::setFrameSize(float width, float height)
|
||||||
{
|
{
|
||||||
Create((LPCTSTR)m_szViewName, (int)width, (int)height);
|
Create((LPCTSTR)m_szViewName, (int)width, (int)height);
|
||||||
CCEGLViewProtocol::setSize(width, height);
|
CCEGLViewProtocol::setFrameSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEGLView::centerWindow()
|
void CCEGLView::centerWindow()
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
virtual void end();
|
virtual void end();
|
||||||
virtual void swapBuffers();
|
virtual void swapBuffers();
|
||||||
virtual bool setContentScaleFactor(float contentScaleFactor);
|
virtual bool setContentScaleFactor(float contentScaleFactor);
|
||||||
virtual void setSize(float width, float height);
|
virtual void setFrameSize(float width, float height);
|
||||||
virtual void setIMEKeyboardState(bool bOpen);
|
virtual void setIMEKeyboardState(bool bOpen);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -128,13 +128,13 @@ public:
|
||||||
/** Creates an sprite with a texture.
|
/** Creates an sprite with a texture.
|
||||||
The rect used will be the size of the texture.
|
The rect used will be the size of the texture.
|
||||||
The offset will be (0,0).
|
The offset will be (0,0).
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithTexture(CCTexture2D*) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithTexture(CCTexture2D *pTexture);
|
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithTexture(CCTexture2D *pTexture);
|
||||||
|
|
||||||
/** Creates an sprite with a texture and a rect.
|
/** Creates an sprite with a texture and a rect.
|
||||||
The offset will be (0,0).
|
The offset will be (0,0).
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithTexture(CCTexture2D*, const CCRect&) instead, This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect);
|
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect);
|
||||||
|
|
||||||
|
@ -150,14 +150,14 @@ public:
|
||||||
static CCSprite* createWithTexture(CCTexture2D *pTexture, const CCRect& rect);
|
static CCSprite* createWithTexture(CCTexture2D *pTexture, const CCRect& rect);
|
||||||
|
|
||||||
/** Creates an sprite with an sprite frame.
|
/** Creates an sprite with an sprite frame.
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithSpriteFrame(CCSpriteFrame*) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
|
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
|
||||||
|
|
||||||
/** Creates an sprite with an sprite frame name.
|
/** Creates an sprite with an sprite frame name.
|
||||||
An CCSpriteFrame will be fetched from the CCSpriteFrameCache by name.
|
An CCSpriteFrame will be fetched from the CCSpriteFrameCache by name.
|
||||||
If the CCSpriteFrame doesn't exist it will raise an exception.
|
If the CCSpriteFrame doesn't exist it will raise an exception.
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use createWithSpriteFrameName(const char*) instead. This interface will be deprecated sooner or later.
|
||||||
@since v0.9
|
@since v0.9
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithSpriteFrameName(const char *pszSpriteFrameName);
|
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithSpriteFrameName(const char *pszSpriteFrameName);
|
||||||
|
@ -175,13 +175,13 @@ public:
|
||||||
/** Creates an sprite with an image filename.
|
/** Creates an sprite with an image filename.
|
||||||
The rect used will be the size of the image.
|
The rect used will be the size of the image.
|
||||||
The offset will be (0,0).
|
The offset will be (0,0).
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use create(const char*) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithFile(const char *pszFileName);
|
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithFile(const char *pszFileName);
|
||||||
|
|
||||||
/** Creates an sprite with an image filename and a rect.
|
/** Creates an sprite with an image filename and a rect.
|
||||||
The offset will be (0,0).
|
The offset will be (0,0).
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use create(const char*, const CCRect&) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithFile(const char *pszFileName, const CCRect& rect);
|
CC_DEPRECATED_ATTRIBUTE static CCSprite* spriteWithFile(const char *pszFileName, const CCRect& rect);
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ public:
|
||||||
static CCSprite* create(const char *pszFileName, const CCRect& rect);
|
static CCSprite* create(const char *pszFileName, const CCRect& rect);
|
||||||
|
|
||||||
/** Creates an sprite.
|
/** Creates an sprite.
|
||||||
@deprecated: This interface will be deprecated sooner or later.
|
@deprecated: Please use create() instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCSprite* node();
|
CC_DEPRECATED_ATTRIBUTE static CCSprite* node();
|
||||||
/** Creates an sprite.
|
/** Creates an sprite.
|
||||||
|
|
|
@ -1214,7 +1214,7 @@ MATHJAX_EXTENSIONS =
|
||||||
# typically be disabled. For large projects the javascript based search engine
|
# typically be disabled. For large projects the javascript based search engine
|
||||||
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
|
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
|
||||||
|
|
||||||
SEARCHENGINE = NO
|
SEARCHENGINE = YES
|
||||||
|
|
||||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||||
# implemented using a PHP enabled web server instead of at the web client
|
# implemented using a PHP enabled web server instead of at the web client
|
|
@ -0,0 +1,310 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
|
Copyright (c) 2012 James Chen
|
||||||
|
|
||||||
|
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.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "CCEditBox.h"
|
||||||
|
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
|
#include "CCEditBoxImplIOS.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
|
CCEditBox::CCEditBox(void)
|
||||||
|
: m_pEditBoxImpl(NULL)
|
||||||
|
, m_pDelegate(NULL)
|
||||||
|
, m_eEditBoxInputMode(kEditBoxInputModeAny)
|
||||||
|
, m_eEditBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters)
|
||||||
|
, m_eKeyboardReturnType(kKeyboardReturnTypeDefault)
|
||||||
|
, m_colText(ccWHITE)
|
||||||
|
, m_colPlaceHolder(ccGRAY)
|
||||||
|
, m_nMaxLength(0)
|
||||||
|
, m_fAdjustHeight(0.0f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CCEditBox::~CCEditBox(void)
|
||||||
|
{
|
||||||
|
CC_SAFE_DELETE(m_pEditBoxImpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CCEditBox::touchDownAction(CCObject *sender, CCControlEvent controlEvent)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->openKeyboard();
|
||||||
|
}
|
||||||
|
|
||||||
|
CCEditBox* CCEditBox::create(const CCSize& size)
|
||||||
|
{
|
||||||
|
CCEditBox* pRet = new CCEditBox();
|
||||||
|
|
||||||
|
if (pRet != NULL && pRet->initWithSize(size))
|
||||||
|
{
|
||||||
|
pRet->autorelease();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CC_SAFE_DELETE(pRet);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCEditBox::initWithSize(const CCSize& size)
|
||||||
|
{
|
||||||
|
if (CCControlButton::init())
|
||||||
|
{
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
|
m_pEditBoxImpl = new CCEditBoxImplIOS(this);
|
||||||
|
#endif
|
||||||
|
m_pEditBoxImpl->initWithSize(size);
|
||||||
|
|
||||||
|
|
||||||
|
CCScale9Sprite* pNormal9Sprite = CCScale9Sprite::create("extensions/button.png");
|
||||||
|
CCScale9Sprite* pPressed9Sprite = CCScale9Sprite::create("extensions/buttonHighlighted.png");
|
||||||
|
CCScale9Sprite* pDisabled9Sprite = CCScale9Sprite::create("extensions/button.png");
|
||||||
|
setBackgroundSpriteForState(pNormal9Sprite, CCControlStateNormal);
|
||||||
|
setBackgroundSpriteForState(pPressed9Sprite, CCControlStateHighlighted);
|
||||||
|
setBackgroundSpriteForState(pDisabled9Sprite, CCControlStateDisabled);
|
||||||
|
|
||||||
|
this->setPreferredSize(size);
|
||||||
|
this->setPosition(ccp(0, 0));
|
||||||
|
this->addTargetWithActionForControlEvent(this, cccontrol_selector(CCEditBox::touchDownAction), CCControlEventTouchDown);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::setDelegate(CCEditBoxDelegate* pDelegate)
|
||||||
|
{
|
||||||
|
m_pDelegate = pDelegate;
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setDelegate(pDelegate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::setText(const char* pText)
|
||||||
|
{
|
||||||
|
if (pText != NULL)
|
||||||
|
{
|
||||||
|
m_strText = pText;
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setText(pText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CCEditBox::getText(void)
|
||||||
|
{
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
return m_pEditBoxImpl->getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::setFontColor(const ccColor3B& color)
|
||||||
|
{
|
||||||
|
m_colText = color;
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setFontColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::setPlaceholderFontColor(const ccColor3B& color)
|
||||||
|
{
|
||||||
|
m_colText = color;
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setPlaceholderFontColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::setPlaceHolder(const char* pText)
|
||||||
|
{
|
||||||
|
if (pText != NULL)
|
||||||
|
{
|
||||||
|
m_strPlaceHolder = pText;
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setPlaceHolder(pText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CCEditBox::getPlaceHolder(void)
|
||||||
|
{
|
||||||
|
return m_strPlaceHolder.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::setInputMode(EditBoxInputMode inputMode)
|
||||||
|
{
|
||||||
|
m_eEditBoxInputMode = inputMode;
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setInputMode(inputMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::setMaxLength(int maxLength)
|
||||||
|
{
|
||||||
|
m_nMaxLength = maxLength;
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setMaxLength(maxLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CCEditBox::getMaxLength()
|
||||||
|
{
|
||||||
|
return m_nMaxLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::setInputFlag(EditBoxInputFlag inputFlag)
|
||||||
|
{
|
||||||
|
m_eEditBoxInputFlag = inputFlag;
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setInputFlag(inputFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::setReturnType(KeyboardReturnType returnType)
|
||||||
|
{
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setReturnType(returnType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* override function */
|
||||||
|
void CCEditBox::setPosition(const CCPoint& pos)
|
||||||
|
{
|
||||||
|
CCControlButton::setPosition(pos);
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setPosition(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::setContentSize(const CCSize& size)
|
||||||
|
{
|
||||||
|
CCControlButton::setContentSize(size);
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->setContentSize(size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::visit(void)
|
||||||
|
{
|
||||||
|
CCControlButton::visit();
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->visit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::onExit(void)
|
||||||
|
{
|
||||||
|
CCControlButton::onExit();
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
// remove system edit control
|
||||||
|
m_pEditBoxImpl->closeKeyboard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static CCRect getRect(CCNode * pNode)
|
||||||
|
{
|
||||||
|
CCRect rc;
|
||||||
|
rc.origin = pNode->getPosition();
|
||||||
|
rc.size = pNode->getContentSize();
|
||||||
|
rc.origin.x -= rc.size.width / 2;
|
||||||
|
rc.origin.y -= rc.size.height / 2;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::keyboardWillShow(CCIMEKeyboardNotificationInfo& info)
|
||||||
|
{
|
||||||
|
//CCLOG("TextInputTest:keyboardWillShowAt(origin:%f,%f, size:%f,%f)",
|
||||||
|
// info.end.origin.x, info.end.origin.y, info.end.size.width, info.end.size.height);
|
||||||
|
|
||||||
|
CCRect rectTracked = getRect(this);
|
||||||
|
//CCLOG("TextInputTest:trackingNodeAt(origin:%f,%f, size:%f,%f)",
|
||||||
|
// rectTracked.origin.x, rectTracked.origin.y, rectTracked.size.width, rectTracked.size.height);
|
||||||
|
|
||||||
|
// if the keyboard area doesn't intersect with the tracking node area, nothing need to do.
|
||||||
|
if (! rectTracked.intersectsRect(info.end))
|
||||||
|
{
|
||||||
|
CCLog("info end x = %f, y = %f; width = %f, height = %f", info.end.origin.x, info.end.origin.y, info.end.size.width, info.end.size.height);
|
||||||
|
CCLog("rectTracked end x = %f, y = %f; width = %f, height = %f", rectTracked.origin.x, rectTracked.origin.y, rectTracked.size.width, rectTracked.size.height);
|
||||||
|
CCLog("needn't to adjust view layout.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// assume keyboard at the bottom of screen, calculate the vertical adjustment.
|
||||||
|
m_fAdjustHeight = info.end.getMaxY() - rectTracked.getMinY();
|
||||||
|
CCLOG("CCEditBox:needAdjustVerticalPosition(%f)", m_fAdjustHeight);
|
||||||
|
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->doAnimationWhenKeyboardMove(info.duration, m_fAdjustHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::keyboardDidShow(CCIMEKeyboardNotificationInfo& info)
|
||||||
|
{
|
||||||
|
if (m_pDelegate != NULL)
|
||||||
|
{
|
||||||
|
m_pDelegate->editBoxEditingDidBegin(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::keyboardWillHide(CCIMEKeyboardNotificationInfo& info)
|
||||||
|
{
|
||||||
|
if (m_pEditBoxImpl != NULL)
|
||||||
|
{
|
||||||
|
m_pEditBoxImpl->doAnimationWhenKeyboardMove(info.duration, -m_fAdjustHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBox::keyboardDidHide(CCIMEKeyboardNotificationInfo& info)
|
||||||
|
{
|
||||||
|
if (m_pDelegate != NULL)
|
||||||
|
{
|
||||||
|
m_pDelegate->editBoxEditingDidEnd(this);
|
||||||
|
m_pDelegate->editBoxReturn(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_CC_EXT_END
|
|
@ -0,0 +1,308 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
|
Copyright (c) 2012 James Chen
|
||||||
|
|
||||||
|
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 __CCEDITTEXT_H__
|
||||||
|
#define __CCEDITTEXT_H__
|
||||||
|
|
||||||
|
#include "cocos2d.h"
|
||||||
|
#include "ExtensionMacros.h"
|
||||||
|
#include "../CCControlExtension/CCControlExtensions.h"
|
||||||
|
|
||||||
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
|
|
||||||
|
enum KeyboardReturnType {
|
||||||
|
kKeyboardReturnTypeDefault = 0,
|
||||||
|
kKeyboardReturnTypeDone,
|
||||||
|
kKeyboardReturnTypeSend,
|
||||||
|
kKeyboardReturnTypeSearch,
|
||||||
|
kKeyboardReturnTypeGo
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief The EditBoxInputMode defines the type of text that the user is allowed
|
||||||
|
* to enter.
|
||||||
|
*/
|
||||||
|
enum EditBoxInputMode
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The user is allowed to enter any text, including line breaks.
|
||||||
|
*/
|
||||||
|
kEditBoxInputModeAny = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user is allowed to enter an e-mail address.
|
||||||
|
*/
|
||||||
|
kEditBoxInputModeEmailAddr,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user is allowed to enter an integer value.
|
||||||
|
*/
|
||||||
|
kEditBoxInputModeNumeric,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user is allowed to enter a phone number.
|
||||||
|
*/
|
||||||
|
kEditBoxInputModePhoneNumber,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user is allowed to enter a URL.
|
||||||
|
*/
|
||||||
|
kEditBoxInputModeUrl,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user is allowed to enter a real number value.
|
||||||
|
* This extends kEditBoxInputModeNumeric by allowing a decimal point.
|
||||||
|
*/
|
||||||
|
kEditBoxInputModeDecimal,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user is allowed to enter any text, except for line breaks.
|
||||||
|
*/
|
||||||
|
kEditBoxInputModeSingleLine
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief The EditBoxInputFlag defines how the input text is displayed/formatted.
|
||||||
|
*/
|
||||||
|
enum EditBoxInputFlag
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Indicates that the text entered is confidential data that should be
|
||||||
|
* obscured whenever possible. This implies EDIT_BOX_INPUT_FLAG_SENSITIVE.
|
||||||
|
*/
|
||||||
|
kEditBoxInputFlagPassword = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the text entered is sensitive data that the
|
||||||
|
* implementation must never store into a dictionary or table for use
|
||||||
|
* in predictive, auto-completing, or other accelerated input schemes.
|
||||||
|
* A credit card number is an example of sensitive data.
|
||||||
|
*/
|
||||||
|
kEditBoxInputFlagSensitive,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This flag is a hint to the implementation that during text editing,
|
||||||
|
* the initial letter of each word should be capitalized.
|
||||||
|
*/
|
||||||
|
kEditBoxInputFlagInitialCapsWord,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This flag is a hint to the implementation that during text editing,
|
||||||
|
* the initial letter of each sentence should be capitalized.
|
||||||
|
*/
|
||||||
|
kEditBoxInputFlagInitialCapsSentence,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Capitalize all characters automatically.
|
||||||
|
*/
|
||||||
|
kEditBoxInputFlagInitialCapsAllCharacters
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CCEditBox;
|
||||||
|
class CCEditBoxImpl;
|
||||||
|
|
||||||
|
|
||||||
|
class CCEditBoxDelegate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~CCEditBoxDelegate() {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when an edit box gains focus after keyboard is shown.
|
||||||
|
* @param editBox The edit box object that generated the event.
|
||||||
|
*/
|
||||||
|
virtual void editBoxEditingDidBegin(CCEditBox* editBox) {};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when an edit box loses focus after keyboard is hidden.
|
||||||
|
* @param editBox The edit box object that generated the event.
|
||||||
|
*/
|
||||||
|
virtual void editBoxEditingDidEnd(CCEditBox* editBox) {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the edit box text was changed.
|
||||||
|
* @param editBox The edit box object that generated the event.
|
||||||
|
* @param text The new text.
|
||||||
|
*/
|
||||||
|
virtual void editBoxTextChanged(
|
||||||
|
CCEditBox* editBox,
|
||||||
|
const std::string& text) {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the return button was pressed or the outside area of keyboard was touched.
|
||||||
|
* @param editBox The edit box object that generated the event.
|
||||||
|
*/
|
||||||
|
virtual void editBoxReturn(CCEditBox* editBox) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Class for edit box.
|
||||||
|
*
|
||||||
|
* You can use this widget to gather small amounts of text from the user.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class CCEditBox
|
||||||
|
: public CCControlButton
|
||||||
|
, public CCIMEDelegate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
CCEditBox(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor.
|
||||||
|
*/
|
||||||
|
virtual ~CCEditBox(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create a edit box with size.
|
||||||
|
* @return An autorelease pointer of CCEditBox, you don't need to release it only if you retain it again.
|
||||||
|
*/
|
||||||
|
static CCEditBox* create(const CCSize& size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init edit box with specified size. This method should be invoked right after constructor.
|
||||||
|
* @param size The size of edit box.
|
||||||
|
*/
|
||||||
|
bool initWithSize(const CCSize& size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the delegate for edit box.
|
||||||
|
*/
|
||||||
|
void setDelegate(CCEditBoxDelegate* pDelegate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text entered in the edit box.
|
||||||
|
* @param pText The given text.
|
||||||
|
*/
|
||||||
|
void setText(const char* pText);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the text entered in the edit box.
|
||||||
|
* @return The text entered in the edit box.
|
||||||
|
*/
|
||||||
|
const char* getText(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the font color of the widget's text.
|
||||||
|
*/
|
||||||
|
void setFontColor(const ccColor3B& color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the font color of the placeholder text when the edit box is empty.
|
||||||
|
*/
|
||||||
|
void setPlaceholderFontColor(const ccColor3B& color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a text in the edit box that acts as a placeholder when an
|
||||||
|
* edit box is empty.
|
||||||
|
* @param pText The given text.
|
||||||
|
*/
|
||||||
|
void setPlaceHolder(const char* pText);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a text in the edit box that acts as a placeholder when an
|
||||||
|
* edit box is empty.
|
||||||
|
*/
|
||||||
|
const char* getPlaceHolder(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the input mode of the edit box.
|
||||||
|
* @param inputMode One of the EditBoxInputMode constants.
|
||||||
|
*/
|
||||||
|
void setInputMode(EditBoxInputMode inputMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the maximum input length of the edit box.
|
||||||
|
* Setting this value enables multiline input mode by default.
|
||||||
|
* Available on Android, iOS and Windows Phone.
|
||||||
|
*
|
||||||
|
* @param maxLength The maximum length.
|
||||||
|
*/
|
||||||
|
void setMaxLength(int maxLength);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the maximum input length of the edit box.
|
||||||
|
*
|
||||||
|
* @return Maximum input length.
|
||||||
|
*/
|
||||||
|
int getMaxLength();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the input flags that are to be applied to the edit box.
|
||||||
|
* @param inputFlag One of the EditBoxInputFlag constants.
|
||||||
|
*/
|
||||||
|
void setInputFlag(EditBoxInputFlag inputFlag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the return type that are to be applied to the edit box.
|
||||||
|
* @param returnType One of the CCKeyboardReturnType constants.
|
||||||
|
*/
|
||||||
|
void setReturnType(KeyboardReturnType returnType);
|
||||||
|
|
||||||
|
/* override functions */
|
||||||
|
virtual void setPosition(const CCPoint& pos);
|
||||||
|
virtual void setContentSize(const CCSize& size);
|
||||||
|
virtual void visit(void);
|
||||||
|
virtual void onExit(void);
|
||||||
|
virtual void keyboardWillShow(CCIMEKeyboardNotificationInfo& info);
|
||||||
|
virtual void keyboardDidShow(CCIMEKeyboardNotificationInfo& info);
|
||||||
|
virtual void keyboardWillHide(CCIMEKeyboardNotificationInfo& info);
|
||||||
|
virtual void keyboardDidHide(CCIMEKeyboardNotificationInfo& info);
|
||||||
|
|
||||||
|
/* callback funtions */
|
||||||
|
void touchDownAction(CCObject *sender, CCControlEvent controlEvent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CCEditBoxImpl* m_pEditBoxImpl;
|
||||||
|
CCEditBoxDelegate* m_pDelegate;
|
||||||
|
|
||||||
|
EditBoxInputMode m_eEditBoxInputMode;
|
||||||
|
EditBoxInputFlag m_eEditBoxInputFlag;
|
||||||
|
KeyboardReturnType m_eKeyboardReturnType;
|
||||||
|
|
||||||
|
std::string m_strText;
|
||||||
|
std::string m_strPlaceHolder;
|
||||||
|
|
||||||
|
ccColor3B m_colText;
|
||||||
|
ccColor3B m_colPlaceHolder;
|
||||||
|
|
||||||
|
int m_nMaxLength;
|
||||||
|
float m_fAdjustHeight;
|
||||||
|
};
|
||||||
|
|
||||||
|
NS_CC_EXT_END
|
||||||
|
|
||||||
|
#endif /* __CCEDITTEXT_H__ */
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
|
Copyright (c) 2012 James Chen
|
||||||
|
|
||||||
|
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 __CCEditBoxIMPL_H__
|
||||||
|
#define __CCEditBoxIMPL_H__
|
||||||
|
|
||||||
|
#include "cocos2d.h"
|
||||||
|
#include "ExtensionMacros.h"
|
||||||
|
#include "CCEditBox.h"
|
||||||
|
|
||||||
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
|
|
||||||
|
class CCEditBoxImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCEditBoxImpl(CCEditBox* pEditBox) : m_pEditBox(pEditBox), m_pDelegate(NULL) {}
|
||||||
|
virtual ~CCEditBoxImpl() {}
|
||||||
|
|
||||||
|
virtual bool initWithSize(const CCSize& size) = 0;
|
||||||
|
virtual void setFontColor(const ccColor3B& color) = 0;
|
||||||
|
virtual void setPlaceholderFontColor(const ccColor3B& color) = 0;
|
||||||
|
virtual void setInputMode(EditBoxInputMode inputMode) = 0;
|
||||||
|
virtual void setInputFlag(EditBoxInputFlag inputFlag) = 0;
|
||||||
|
virtual void setMaxLength(int maxLength) = 0;
|
||||||
|
virtual int getMaxLength() = 0;
|
||||||
|
virtual void setReturnType(KeyboardReturnType returnType) = 0;
|
||||||
|
|
||||||
|
virtual void setText(const char* pText) = 0;
|
||||||
|
virtual const char* getText(void) = 0;
|
||||||
|
virtual void setPlaceHolder(const char* pText) = 0;
|
||||||
|
virtual void doAnimationWhenKeyboardMove(float duration, float distance) = 0;
|
||||||
|
|
||||||
|
virtual void openKeyboard() = 0;
|
||||||
|
virtual void closeKeyboard() = 0;
|
||||||
|
|
||||||
|
virtual void setPosition(const CCPoint& pos) = 0;
|
||||||
|
virtual void setContentSize(const CCSize& size) = 0;
|
||||||
|
virtual void visit(void) = 0;
|
||||||
|
|
||||||
|
void setDelegate(CCEditBoxDelegate* pDelegate) { m_pDelegate = pDelegate; };
|
||||||
|
CCEditBoxDelegate* getDelegate() { return m_pDelegate; };
|
||||||
|
CCEditBox* getCCEditBox() { return m_pEditBox; };
|
||||||
|
protected:
|
||||||
|
CCEditBoxDelegate* m_pDelegate;
|
||||||
|
CCEditBox* m_pEditBox;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
NS_CC_EXT_END
|
||||||
|
|
||||||
|
#endif /* __CCEditBoxIMPL_H__ */
|
|
@ -0,0 +1,73 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
|
Copyright (c) 2012 James Chen
|
||||||
|
|
||||||
|
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 __CCEditBoxIMPLIOS_H__
|
||||||
|
#define __CCEditBoxIMPLIOS_H__
|
||||||
|
|
||||||
|
#include "cocos2d.h"
|
||||||
|
#include "ExtensionMacros.h"
|
||||||
|
#include "CCEditBoxImpl.h"
|
||||||
|
|
||||||
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
|
class CCEditBox;
|
||||||
|
|
||||||
|
class CCEditBoxImplIOS : public CCEditBoxImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCEditBoxImplIOS(CCEditBox* pEditText);
|
||||||
|
virtual ~CCEditBoxImplIOS();
|
||||||
|
|
||||||
|
virtual bool initWithSize(const CCSize& size);
|
||||||
|
virtual void setFontColor(const ccColor3B& color);
|
||||||
|
virtual void setPlaceholderFontColor(const ccColor3B& color);
|
||||||
|
virtual void setInputMode(EditBoxInputMode inputMode);
|
||||||
|
virtual void setInputFlag(EditBoxInputFlag inputFlag);
|
||||||
|
virtual void setMaxLength(int maxLength);
|
||||||
|
virtual int getMaxLength();
|
||||||
|
virtual void setReturnType(KeyboardReturnType returnType);
|
||||||
|
|
||||||
|
virtual void setText(const char* pText);
|
||||||
|
virtual const char* getText(void);
|
||||||
|
virtual void setPlaceHolder(const char* pText);
|
||||||
|
virtual void setPosition(const CCPoint& pos);
|
||||||
|
virtual void setContentSize(const CCSize& size);
|
||||||
|
virtual void visit(void);
|
||||||
|
virtual void doAnimationWhenKeyboardMove(float duration, float distance);
|
||||||
|
virtual void openKeyboard();
|
||||||
|
virtual void closeKeyboard();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CCEditBox* m_pEditBox;
|
||||||
|
CCSize m_tContentSize;
|
||||||
|
void* m_pSysEdit;
|
||||||
|
int m_nMaxTextLength;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
NS_CC_EXT_END
|
||||||
|
|
||||||
|
#endif /* __CCEditBoxIMPLIOS_H__ */
|
||||||
|
|
|
@ -0,0 +1,235 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
|
Copyright (c) 2012 James Chen
|
||||||
|
|
||||||
|
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.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "CCEditBoxImplIOS.h"
|
||||||
|
#include "CCEditBox.h"
|
||||||
|
#import "EAGLView.h"
|
||||||
|
#import "EditBoxImplIOS.h"
|
||||||
|
|
||||||
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
|
#define GET_IMPL ((EditBoxImplIOS*)m_pSysEdit)
|
||||||
|
|
||||||
|
CCEditBoxImplIOS::CCEditBoxImplIOS(CCEditBox* pEditText)
|
||||||
|
: CCEditBoxImpl(pEditText)
|
||||||
|
, m_pSysEdit(NULL)
|
||||||
|
, m_nMaxTextLength(-1)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CCEditBoxImplIOS::~CCEditBoxImplIOS()
|
||||||
|
{
|
||||||
|
[GET_IMPL release];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::doAnimationWhenKeyboardMove(float duration, float distance)
|
||||||
|
{
|
||||||
|
if ([GET_IMPL isEditState] || distance < 0.0f)
|
||||||
|
{
|
||||||
|
[GET_IMPL doAnimationWhenKeyboardMoveWithDuration:duration distance:distance];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCEditBoxImplIOS::initWithSize(const CCSize& size)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
CCEGLViewProtocol& eglView = CCEGLView::sharedOpenGLView();
|
||||||
|
|
||||||
|
CGRect rect;
|
||||||
|
if (eglView.isRetinaEnabled())
|
||||||
|
{
|
||||||
|
rect = CGRectMake(0, 0, size.width,size.height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect = CGRectMake(0, 0, size.width * eglView.getScaleX(),size.height * eglView.getScaleY());
|
||||||
|
}
|
||||||
|
m_pSysEdit = [[EditBoxImplIOS alloc] initWithFrame:rect editBox:this];
|
||||||
|
if (!m_pSysEdit) break;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}while (0);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::setFontColor(const ccColor3B& color)
|
||||||
|
{
|
||||||
|
GET_IMPL.textField.textColor = [UIColor colorWithRed:color.r / 255.0f green:color.g / 255.0f blue:color.b / 255.0f alpha:1.0f];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::setPlaceholderFontColor(const ccColor3B& color)
|
||||||
|
{
|
||||||
|
// TODO need to be implemented.
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::setInputMode(EditBoxInputMode inputMode)
|
||||||
|
{
|
||||||
|
switch (inputMode)
|
||||||
|
{
|
||||||
|
case kEditBoxInputModeEmailAddr:
|
||||||
|
GET_IMPL.textField.keyboardType = UIKeyboardTypeEmailAddress;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputModeNumeric:
|
||||||
|
GET_IMPL.textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputModePhoneNumber:
|
||||||
|
GET_IMPL.textField.keyboardType = UIKeyboardTypePhonePad;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputModeUrl:
|
||||||
|
GET_IMPL.textField.keyboardType = UIKeyboardTypeURL;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputModeDecimal:
|
||||||
|
GET_IMPL.textField.keyboardType = UIKeyboardTypeDecimalPad;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputModeSingleLine:
|
||||||
|
GET_IMPL.textField.keyboardType = UIKeyboardTypeDefault;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
GET_IMPL.textField.keyboardType = UIKeyboardTypeDefault;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::setMaxLength(int maxLength)
|
||||||
|
{
|
||||||
|
m_nMaxTextLength = maxLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CCEditBoxImplIOS::getMaxLength()
|
||||||
|
{
|
||||||
|
return m_nMaxTextLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::setInputFlag(EditBoxInputFlag inputFlag)
|
||||||
|
{
|
||||||
|
switch (inputFlag)
|
||||||
|
{
|
||||||
|
case kEditBoxInputFlagPassword:
|
||||||
|
GET_IMPL.textField.secureTextEntry = YES;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputFlagInitialCapsWord:
|
||||||
|
GET_IMPL.textField.autocapitalizationType = UITextAutocapitalizationTypeWords;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputFlagInitialCapsSentence:
|
||||||
|
GET_IMPL.textField.autocapitalizationType = UITextAutocapitalizationTypeSentences;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputFlagInitialCapsAllCharacters:
|
||||||
|
GET_IMPL.textField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::setReturnType(KeyboardReturnType returnType)
|
||||||
|
{
|
||||||
|
switch (returnType) {
|
||||||
|
case kKeyboardReturnTypeDefault:
|
||||||
|
GET_IMPL.textField.returnKeyType = UIReturnKeyDefault;
|
||||||
|
break;
|
||||||
|
case kKeyboardReturnTypeDone:
|
||||||
|
GET_IMPL.textField.returnKeyType = UIReturnKeyGo;
|
||||||
|
break;
|
||||||
|
case kKeyboardReturnTypeSend:
|
||||||
|
GET_IMPL.textField.returnKeyType = UIReturnKeyDone;
|
||||||
|
break;
|
||||||
|
case kKeyboardReturnTypeSearch:
|
||||||
|
GET_IMPL.textField.returnKeyType = UIReturnKeySearch;
|
||||||
|
break;
|
||||||
|
case kKeyboardReturnTypeGo:
|
||||||
|
GET_IMPL.textField.returnKeyType = UIReturnKeySend;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
GET_IMPL.textField.returnKeyType = UIReturnKeyDefault;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::setText(const char* pText)
|
||||||
|
{
|
||||||
|
GET_IMPL.textField.text = [NSString stringWithUTF8String:pText];
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CCEditBoxImplIOS::getText(void)
|
||||||
|
{
|
||||||
|
return [GET_IMPL.textField.text UTF8String];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::setPlaceHolder(const char* pText)
|
||||||
|
{
|
||||||
|
GET_IMPL.textField.placeholder = [NSString stringWithUTF8String:pText];
|
||||||
|
}
|
||||||
|
|
||||||
|
static CGPoint convertDesignCoordToScreenCoord(const CCPoint& designCoord)
|
||||||
|
{
|
||||||
|
float viewH = (float)[[EAGLView sharedEGLView] getHeight];
|
||||||
|
CCEGLViewProtocol& eglView = CCEGLView::sharedOpenGLView();
|
||||||
|
CCPoint visiblePos;
|
||||||
|
if (eglView.isRetinaEnabled())
|
||||||
|
{
|
||||||
|
visiblePos = ccp(designCoord.x, designCoord.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
visiblePos = ccp(designCoord.x * eglView.getScaleX(), designCoord.y * eglView.getScaleY());
|
||||||
|
}
|
||||||
|
|
||||||
|
CCPoint screenGLPos = ccpAdd(visiblePos, eglView.getViewPortRect().origin);
|
||||||
|
CGPoint screenPos = CGPointMake(screenGLPos.x, viewH - screenGLPos.y);
|
||||||
|
return screenPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::setPosition(const CCPoint& pos)
|
||||||
|
{
|
||||||
|
//TODO should consider anchor point, the default value is (0.5, 0,5)
|
||||||
|
[GET_IMPL setPosition:convertDesignCoordToScreenCoord(ccp(pos.x-m_tContentSize.width/2, pos.y+m_tContentSize.height/2))];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::setContentSize(const CCSize& size)
|
||||||
|
{
|
||||||
|
m_tContentSize = size;
|
||||||
|
CCLog("[Edit text] content size = (%f, %f)", size.width, size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::visit(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::openKeyboard()
|
||||||
|
{
|
||||||
|
[GET_IMPL openKeyboard];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCEditBoxImplIOS::closeKeyboard()
|
||||||
|
{
|
||||||
|
[GET_IMPL closeKeyboard];
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
|
Copyright (c) 2012 James Chen
|
||||||
|
|
||||||
|
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.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface CustomUITextField : UITextField
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface EditBoxImplIOS : NSObject <UITextFieldDelegate>
|
||||||
|
{
|
||||||
|
CustomUITextField* textField_;
|
||||||
|
void* editBox_;
|
||||||
|
BOOL editState_;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property(nonatomic, retain) UITextField* textField;
|
||||||
|
@property(nonatomic, readonly, getter = isEditState) BOOL editState;
|
||||||
|
@property(nonatomic, assign) void* editBox;
|
||||||
|
|
||||||
|
-(id) initWithFrame: (CGRect) frameRect editBox: (void*) editBox;
|
||||||
|
-(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance;
|
||||||
|
-(void) setPosition:(CGPoint) pos;
|
||||||
|
-(void) setContentSize:(CGSize) size;
|
||||||
|
-(void) visit;
|
||||||
|
-(void) openKeyboard;
|
||||||
|
-(void) closeKeyboard;
|
||||||
|
|
||||||
|
@end
|
|
@ -0,0 +1,189 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
|
Copyright (c) 2012 James Chen
|
||||||
|
|
||||||
|
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.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#import "EditBoxImplIOS.h"
|
||||||
|
#import "EAGLView.h"
|
||||||
|
#import "CCEditBoxImplIOS.h"
|
||||||
|
|
||||||
|
#define getEditBoxImplIOS() ((cocos2d::extension::CCEditBoxImplIOS*)editBox_)
|
||||||
|
|
||||||
|
@implementation CustomUITextField
|
||||||
|
- (CGRect)textRectForBounds:(CGRect)bounds {
|
||||||
|
float padding = 5.0f;
|
||||||
|
return CGRectMake(bounds.origin.x + padding, bounds.origin.y + padding,
|
||||||
|
bounds.size.width - padding*2, bounds.size.height - padding*2);
|
||||||
|
}
|
||||||
|
- (CGRect)editingRectForBounds:(CGRect)bounds {
|
||||||
|
return [self textRectForBounds:bounds];
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@implementation EditBoxImplIOS
|
||||||
|
|
||||||
|
@synthesize textField = textField_;
|
||||||
|
@synthesize editState = editState_;
|
||||||
|
@synthesize editBox = editBox_;
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[textField_ resignFirstResponder];
|
||||||
|
[textField_ removeFromSuperview];
|
||||||
|
[textField_ release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(id) initWithFrame: (CGRect) frameRect editBox: (void*) editBox
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (self == nil) break;
|
||||||
|
editState_ = NO;
|
||||||
|
textField_ = [[CustomUITextField alloc] initWithFrame: frameRect];
|
||||||
|
if (!textField_) break;
|
||||||
|
[textField_ setTextColor:[UIColor whiteColor]];
|
||||||
|
textField_.font = [UIFont systemFontOfSize:frameRect.size.height*2/3]; //TODO need to delete hard code here.
|
||||||
|
textField_.backgroundColor = [UIColor clearColor];
|
||||||
|
textField_.borderStyle = UITextBorderStyleNone;
|
||||||
|
textField_.delegate = self;
|
||||||
|
textField_.returnKeyType = UIReturnKeyDefault;
|
||||||
|
[textField_ addTarget:self action:@selector(textChanged) forControlEvents:UIControlEventEditingChanged];
|
||||||
|
self.editBox = editBox;
|
||||||
|
|
||||||
|
[[EAGLView sharedEGLView] addSubview:textField_];
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}while(0);
|
||||||
|
|
||||||
|
[textField_ release];
|
||||||
|
|
||||||
|
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance
|
||||||
|
{
|
||||||
|
id eglView = [EAGLView sharedEGLView];
|
||||||
|
[eglView doAnimationWhenKeyboardMoveWithDuration:duration distance:distance];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) setPosition:(CGPoint) pos
|
||||||
|
{
|
||||||
|
CGRect frame = [textField_ frame];
|
||||||
|
frame.origin = pos;
|
||||||
|
[textField_ setFrame:frame];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) setContentSize:(CGSize) size
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) visit
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) openKeyboard
|
||||||
|
{
|
||||||
|
[textField_ becomeFirstResponder];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) closeKeyboard
|
||||||
|
{
|
||||||
|
[textField_ resignFirstResponder];
|
||||||
|
[textField_ removeFromSuperview];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)textFieldShouldReturn:(UITextField *)sender
|
||||||
|
{
|
||||||
|
if (sender == textField_) {
|
||||||
|
[sender resignFirstResponder];
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)animationSelector
|
||||||
|
{
|
||||||
|
id eglView = [EAGLView sharedEGLView];
|
||||||
|
[eglView doAnimationWhenAnotherEditBeClicked];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)textFieldShouldBeginEditing:(UITextField *)sender // return NO to disallow editing.
|
||||||
|
{
|
||||||
|
editState_ = YES;
|
||||||
|
id eglView = [EAGLView sharedEGLView];
|
||||||
|
if ([eglView isKeyboardShown])
|
||||||
|
{
|
||||||
|
[self performSelector:@selector(animationSelector) withObject:nil afterDelay:0.0f];
|
||||||
|
}
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)textFieldShouldEndEditing:(UITextField *)sender
|
||||||
|
{
|
||||||
|
editState_ = NO;
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delegate method called before the text has been changed.
|
||||||
|
* @param textField The text field containing the text.
|
||||||
|
* @param range The range of characters to be replaced.
|
||||||
|
* @param string The replacement string.
|
||||||
|
* @return YES if the specified text range should be replaced; otherwise, NO to keep the old text.
|
||||||
|
*/
|
||||||
|
- (BOOL)textField:(UITextField *) textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
|
||||||
|
{
|
||||||
|
if (getEditBoxImplIOS()->getMaxLength() < 0)
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSUInteger oldLength = [textField.text length];
|
||||||
|
NSUInteger replacementLength = [string length];
|
||||||
|
NSUInteger rangeLength = range.length;
|
||||||
|
|
||||||
|
NSUInteger newLength = oldLength - rangeLength + replacementLength;
|
||||||
|
|
||||||
|
return newLength <= getEditBoxImplIOS()->getMaxLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called each time when the text field's text has changed.
|
||||||
|
*/
|
||||||
|
- (void) textChanged
|
||||||
|
{
|
||||||
|
NSLog(@"text is %@", self.textField.text);
|
||||||
|
cocos2d::extension::CCEditBoxDelegate* pDelegate = getEditBoxImplIOS()->getDelegate();
|
||||||
|
if (pDelegate != NULL)
|
||||||
|
{
|
||||||
|
pDelegate->editBoxTextChanged(getEditBoxImplIOS()->getCCEditBox(), getEditBoxImplIOS()->getText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "GUI/CCControlExtension/CCControlExtensions.h"
|
#include "GUI/CCControlExtension/CCControlExtensions.h"
|
||||||
#include "GUI/CCScrollView/CCScrollView.h"
|
#include "GUI/CCScrollView/CCScrollView.h"
|
||||||
|
#include "GUI/CCEditBox/CCEditBox.h"
|
||||||
|
|
||||||
#include "network/HttpRequest.h"
|
#include "network/HttpRequest.h"
|
||||||
#include "network/HttpResponse.h"
|
#include "network/HttpResponse.h"
|
||||||
|
|
|
@ -25,7 +25,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
|
||||||
if (!CCDirector::sharedDirector()->getOpenGLView())
|
if (!CCDirector::sharedDirector()->getOpenGLView())
|
||||||
{
|
{
|
||||||
CCEGLView *view = &CCEGLView::sharedOpenGLView();
|
CCEGLView *view = &CCEGLView::sharedOpenGLView();
|
||||||
view->setSize(w, h);
|
view->setFrameSize(w, h);
|
||||||
|
|
||||||
AppDelegate *pAppDelegate = new AppDelegate();
|
AppDelegate *pAppDelegate = new AppDelegate();
|
||||||
CCApplication::sharedApplication().run();
|
CCApplication::sharedApplication().run();
|
||||||
|
|
|
@ -15,6 +15,6 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
CCEGLView& eglView = CCEGLView::sharedOpenGLView();
|
CCEGLView& eglView = CCEGLView::sharedOpenGLView();
|
||||||
eglView.setSize(960, 640 );
|
eglView.setFrameSize(960, 640 );
|
||||||
return CCApplication::sharedApplication().run();
|
return CCApplication::sharedApplication().run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,11 @@ local function creatDog()
|
||||||
-- create dog animate
|
-- create dog animate
|
||||||
local textureDog = CCTextureCache:sharedTextureCache():addImage("dog.png")
|
local textureDog = CCTextureCache:sharedTextureCache():addImage("dog.png")
|
||||||
local rect = CCRectMake(0, 0, frameWidth, frameHeight)
|
local rect = CCRectMake(0, 0, frameWidth, frameHeight)
|
||||||
local frame0 = CCSpriteFrame:create(textureDog, rect)
|
local frame0 = CCSpriteFrame:createWithTexture(textureDog, rect)
|
||||||
rect = CCRectMake(frameWidth, 0, frameWidth, frameHeight)
|
rect = CCRectMake(frameWidth, 0, frameWidth, frameHeight)
|
||||||
local frame1 = CCSpriteFrame:create(textureDog, rect)
|
local frame1 = CCSpriteFrame:createWithTexture(textureDog, rect)
|
||||||
|
|
||||||
local spriteDog = CCSprite:create(frame0)
|
local spriteDog = CCSprite:createWithSpriteFrame(frame0)
|
||||||
spriteDog.isPaused = false
|
spriteDog.isPaused = false
|
||||||
spriteDog:setPosition(0, winSize.height / 4 * 3)
|
spriteDog:setPosition(0, winSize.height / 4 * 3)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
|
||||||
if (!CCDirector::sharedDirector()->getOpenGLView())
|
if (!CCDirector::sharedDirector()->getOpenGLView())
|
||||||
{
|
{
|
||||||
CCEGLView *view = &CCEGLView::sharedOpenGLView();
|
CCEGLView *view = &CCEGLView::sharedOpenGLView();
|
||||||
view->setSize(w, h);
|
view->setFrameSize(w, h);
|
||||||
|
|
||||||
AppDelegate *pAppDelegate = new AppDelegate();
|
AppDelegate *pAppDelegate = new AppDelegate();
|
||||||
CCApplication::sharedApplication().run();
|
CCApplication::sharedApplication().run();
|
||||||
|
|
|
@ -25,7 +25,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
CCEGLView& eglView = CCEGLView::sharedOpenGLView();
|
CCEGLView& eglView = CCEGLView::sharedOpenGLView();
|
||||||
eglView.setSize(480, 320);
|
eglView.setFrameSize(480, 320);
|
||||||
int ret = CCApplication::sharedApplication().run();
|
int ret = CCApplication::sharedApplication().run();
|
||||||
|
|
||||||
#ifdef USE_WIN32_CONSOLE
|
#ifdef USE_WIN32_CONSOLE
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
//
|
||||||
|
// CCEditBoxTest.cpp
|
||||||
|
// TestCpp
|
||||||
|
//
|
||||||
|
// Created by James on 8/14/12.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "EditBoxTest.h"
|
||||||
|
#include "../ExtensionsTest.h"
|
||||||
|
|
||||||
|
USING_NS_CC;
|
||||||
|
USING_NS_CC_EXT;
|
||||||
|
|
||||||
|
|
||||||
|
EditBoxTest::EditBoxTest()
|
||||||
|
{
|
||||||
|
CCPoint visibleOrigin = CCEGLView::sharedOpenGLView().getVisibleOrigin();
|
||||||
|
CCSize visibleSize = CCEGLView::sharedOpenGLView().getVisibleSize();
|
||||||
|
|
||||||
|
CCSprite* pBg = CCSprite::create("Images/HelloWorld.png");
|
||||||
|
pBg->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2));
|
||||||
|
addChild(pBg);
|
||||||
|
|
||||||
|
// Back Menu
|
||||||
|
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(EditBoxTest::toExtensionsMainLayer));
|
||||||
|
itemBack->setPosition(ccp(visibleOrigin.x+visibleSize.width - 50, visibleOrigin.y+25));
|
||||||
|
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
|
||||||
|
menuBack->setPosition(CCPointZero);
|
||||||
|
addChild(menuBack);
|
||||||
|
|
||||||
|
CCSize editBoxSize = CCSizeMake(visibleSize.width/3, visibleSize.height/8);
|
||||||
|
CCEditBox* pEdit = NULL;
|
||||||
|
// top
|
||||||
|
pEdit = CCEditBox::create(editBoxSize);
|
||||||
|
pEdit->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/4));
|
||||||
|
addChild(pEdit);
|
||||||
|
// middle
|
||||||
|
pEdit = CCEditBox::create(editBoxSize);
|
||||||
|
pEdit->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2));
|
||||||
|
addChild(pEdit);
|
||||||
|
// bottom
|
||||||
|
pEdit = CCEditBox::create(editBoxSize);
|
||||||
|
pEdit->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4));
|
||||||
|
addChild(pEdit);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditBoxTest::~EditBoxTest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditBoxTest::toExtensionsMainLayer(cocos2d::CCObject *sender)
|
||||||
|
{
|
||||||
|
ExtensionsTestScene *pScene = new ExtensionsTestScene();
|
||||||
|
pScene->runThisTest();
|
||||||
|
pScene->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void runEditBoxTest()
|
||||||
|
{
|
||||||
|
CCScene *pScene = CCScene::create();
|
||||||
|
EditBoxTest *pLayer = new EditBoxTest();
|
||||||
|
pScene->addChild(pLayer);
|
||||||
|
|
||||||
|
CCDirector::sharedDirector()->replaceScene(pScene);
|
||||||
|
pLayer->release();
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// CCEditBoxTest.h
|
||||||
|
// TestCpp
|
||||||
|
//
|
||||||
|
// Created by James on 8/14/12.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __TestCpp__CCEditBoxTest__
|
||||||
|
#define __TestCpp__CCEditBoxTest__
|
||||||
|
|
||||||
|
#include "cocos2d.h"
|
||||||
|
#include "cocos-ext.h"
|
||||||
|
|
||||||
|
class EditBoxTest : public cocos2d::CCLayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EditBoxTest();
|
||||||
|
virtual ~EditBoxTest();
|
||||||
|
void toExtensionsMainLayer(cocos2d::CCObject *sender);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void runEditBoxTest();
|
||||||
|
|
||||||
|
#endif /* defined(__TestCpp__CCEditBoxTest__) */
|
|
@ -4,6 +4,9 @@
|
||||||
#include "ControlExtensionTest/CCControlSceneManager.h"
|
#include "ControlExtensionTest/CCControlSceneManager.h"
|
||||||
#include "CocosBuilderTest/CocosBuilderTest.h"
|
#include "CocosBuilderTest/CocosBuilderTest.h"
|
||||||
#include "NetworkTest/HttpClientTest.h"
|
#include "NetworkTest/HttpClientTest.h"
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
|
#include "EditBoxTest/EditBoxTest.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -17,6 +20,9 @@ enum
|
||||||
TEST_CCCONTROLBUTTON,
|
TEST_CCCONTROLBUTTON,
|
||||||
TEST_COCOSBUILDER,
|
TEST_COCOSBUILDER,
|
||||||
TEST_HTTPCLIENT,
|
TEST_HTTPCLIENT,
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
|
TEST_EDITBOX,
|
||||||
|
#endif
|
||||||
TEST_MAX_COUNT,
|
TEST_MAX_COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,6 +32,9 @@ static const std::string testsName[TEST_MAX_COUNT] =
|
||||||
"CCControlButtonTest",
|
"CCControlButtonTest",
|
||||||
"CocosBuilderTest",
|
"CocosBuilderTest",
|
||||||
"HttpClientTest",
|
"HttpClientTest",
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
|
"EditBoxTest"
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
@ -87,6 +96,14 @@ void ExtensionsMainLayer::menuCallback(CCObject* pSender)
|
||||||
{
|
{
|
||||||
runHttpClientTest();
|
runHttpClientTest();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
|
case TEST_EDITBOX:
|
||||||
|
{
|
||||||
|
runEditBoxTest();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
|
||||||
if (!CCDirector::sharedDirector()->getOpenGLView())
|
if (!CCDirector::sharedDirector()->getOpenGLView())
|
||||||
{
|
{
|
||||||
CCEGLView *view = &CCEGLView::sharedOpenGLView();
|
CCEGLView *view = &CCEGLView::sharedOpenGLView();
|
||||||
view->setSize(w, h);
|
view->setFrameSize(w, h);
|
||||||
|
|
||||||
AppDelegate *pAppDelegate = new AppDelegate();
|
AppDelegate *pAppDelegate = new AppDelegate();
|
||||||
CCApplication::sharedApplication().run();
|
CCApplication::sharedApplication().run();
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
86f6b6c3837508de917c08ed3e087b901da16e27
|
9dc4229a0e1a4577d300081dc8e3abc2a1e2f1f2
|
|
@ -15,6 +15,6 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
CCEGLView& eglView = CCEGLView::sharedOpenGLView();
|
CCEGLView& eglView = CCEGLView::sharedOpenGLView();
|
||||||
eglView.setSize(480, 320);
|
eglView.setFrameSize(480, 320);
|
||||||
return CCApplication::sharedApplication().run();
|
return CCApplication::sharedApplication().run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
|
||||||
if (!CCDirector::sharedDirector()->getOpenGLView())
|
if (!CCDirector::sharedDirector()->getOpenGLView())
|
||||||
{
|
{
|
||||||
CCEGLView *view = &CCEGLView::sharedOpenGLView();
|
CCEGLView *view = &CCEGLView::sharedOpenGLView();
|
||||||
view->setSize(w, h);
|
view->setFrameSize(w, h);
|
||||||
|
|
||||||
AppDelegate *pAppDelegate = new AppDelegate();
|
AppDelegate *pAppDelegate = new AppDelegate();
|
||||||
CCApplication::sharedApplication().run();
|
CCApplication::sharedApplication().run();
|
||||||
|
|
|
@ -25,7 +25,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
CCEGLView& eglView = CCEGLView::sharedOpenGLView();
|
CCEGLView& eglView = CCEGLView::sharedOpenGLView();
|
||||||
eglView.setSize(480, 320);
|
eglView.setFrameSize(480, 320);
|
||||||
|
|
||||||
int ret = CCApplication::sharedApplication().run();
|
int ret = CCApplication::sharedApplication().run();
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
7cb982a0fdfc6ad650535099fa5fadf5d05073e4
|
0b7cd029edf3970b0b444a943661d09f58aeba3d
|
|
@ -0,0 +1 @@
|
||||||
|
7cda137d3b8d286470f2b504faaa77d981947cbf
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
RunAction "Action1", oneIteration
|
|
@ -0,0 +1 @@
|
||||||
|
b92978b50737213fe6e10b1a95285f63f650b651
|
Binary file not shown.
|
@ -0,0 +1,706 @@
|
||||||
|
Dim Milliseconds
|
||||||
|
DefaultTimeout = Setting("DefaultTimeout")
|
||||||
|
|
||||||
|
If DefaultTimeout > 10000 Then
|
||||||
|
Milliseconds = 10000
|
||||||
|
Setting("DefaultTimeout") = Milliseconds
|
||||||
|
End If
|
||||||
|
|
||||||
|
Err.Clear
|
||||||
|
On Error Resume Next
|
||||||
|
call CaseFunctionName
|
||||||
|
|
||||||
|
If Err.Number <> 0 Then
|
||||||
|
|
||||||
|
If Dialog("TestCpp.exe").Exist(3) Then
|
||||||
|
Dialog("TestCpp.exe").Activate
|
||||||
|
Dialog("TestCpp.exe").Move 872,177
|
||||||
|
Dialog("TestCpp.exe").WinObject("DirectUIHWND").Click 21,235
|
||||||
|
Wait 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
WriteLog Err.Number
|
||||||
|
WriteLog Err.Description
|
||||||
|
WriteLog Err.Source
|
||||||
|
|
||||||
|
Dim FileName ,TimeNow, ResPath
|
||||||
|
ResPath = Environment.Value("TestDir")
|
||||||
|
ResPath = ResPath & "\"
|
||||||
|
TestNameNow=environment.Value("TestName")
|
||||||
|
FileName = ResPath & ""&TestNameNow & ".png"
|
||||||
|
|
||||||
|
desktop.CaptureBitmap filename,True
|
||||||
|
Systemutil.closedescendentprocesses
|
||||||
|
|
||||||
|
If Dialog("TestCpp.exe").Exist(3) Then
|
||||||
|
Dialog("TestCpp.exe").WinObject("关闭程序").Click
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
Err.Clear
|
||||||
|
On Error goto 0
|
||||||
|
|
||||||
|
Function common_test(a,b,c)
|
||||||
|
For i = a To b
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait c
|
||||||
|
Next
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function random_click(a,b,c)
|
||||||
|
Dim touch_x,touch_y
|
||||||
|
Randomize
|
||||||
|
For Response = a To b
|
||||||
|
touch_x = Int((400 * Rnd + 0))
|
||||||
|
touch_y = Int((250 * Rnd + 0))
|
||||||
|
Window("Hello Tests").Click touch_x,touch_y
|
||||||
|
Wait c
|
||||||
|
Next
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function random_drag(a,b,c)
|
||||||
|
Dim drag_x,drag_y,drop_x,drop_y
|
||||||
|
Randomize
|
||||||
|
For Response = a To b
|
||||||
|
drag_x = Int((400 * Rnd + 0))
|
||||||
|
drag_y = Int((250 * Rnd + 0))
|
||||||
|
drop_x = Int((400 * Rnd + 0))
|
||||||
|
drop_y = Int((250 * Rnd + 0))
|
||||||
|
Window("Hello Tests").Drag drag_x,drag_y
|
||||||
|
Window("Hello Tests").Drop drop_x,drop_y
|
||||||
|
Wait c
|
||||||
|
Next
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function CaseFunctionName()
|
||||||
|
'SystemUtil.BlockInput
|
||||||
|
Window("Hello Tests").Activate
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'ActionsTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 241,43
|
||||||
|
Wait 2
|
||||||
|
|
||||||
|
Call common_test(1,27,1)
|
||||||
|
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 5
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 2
|
||||||
|
|
||||||
|
Call common_test(1,5,1)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
Wait 2
|
||||||
|
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'TransitionsTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 236,77
|
||||||
|
Wait 2
|
||||||
|
|
||||||
|
Call common_test(1,26,1)
|
||||||
|
Wait 1
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
Wait 2
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'ActionsProgressTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 287,113
|
||||||
|
Wait 2
|
||||||
|
|
||||||
|
Call common_test(1,7,2)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
Wait 2
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'EffectsTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 236,163
|
||||||
|
Wait 3
|
||||||
|
|
||||||
|
Call common_test(1,21,4)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
Wait 2
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'ClickAndMoveTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 228,199
|
||||||
|
Wait 3
|
||||||
|
|
||||||
|
Call random_click(1,10,2)
|
||||||
|
|
||||||
|
Call random_click(1,100,0)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
Wait 2
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'RotateWorldTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 237,235
|
||||||
|
Wait 3.5
|
||||||
|
''MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
Wait 2
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'ParticleTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 236,276
|
||||||
|
Wait 3
|
||||||
|
|
||||||
|
Call common_test(1,42,2)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
Wait 2
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'ActionEaseTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Drag 363,307
|
||||||
|
Window("Hello Tests").Drop 363,10
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 237,19
|
||||||
|
Wait 2
|
||||||
|
|
||||||
|
Call common_test(1,13,2)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
Wait 2
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'MotionStreakTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 240,61
|
||||||
|
Wait 2
|
||||||
|
|
||||||
|
Window("Hello Tests").Click 230,239
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
|
||||||
|
Call random_drag(1,10,0)
|
||||||
|
Window("Hello Tests").Click 230,239
|
||||||
|
Call random_drag(1,10,0)
|
||||||
|
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 2
|
||||||
|
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'DrawPrimitivesTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 235,101
|
||||||
|
Wait 1
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'NodeTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 237,139
|
||||||
|
Wait 1
|
||||||
|
|
||||||
|
Call common_test(1,13,1)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'TouchesTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 238,183
|
||||||
|
Window("Hello Tests").Drag 236,221
|
||||||
|
Window("Hello Tests").Drop 175,226
|
||||||
|
|
||||||
|
Wait 5
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'MenuTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 234,220
|
||||||
|
Window("Hello Tests").Click 238,63
|
||||||
|
Window("Hello Tests").Click 158,132
|
||||||
|
|
||||||
|
Window("Hello Tests").Click 238,155
|
||||||
|
Window("Hello Tests").Click 236,180
|
||||||
|
Window("Hello Tests").Click 158,188
|
||||||
|
Window("Hello Tests").Click 313,184
|
||||||
|
Window("Hello Tests").Click 190,217
|
||||||
|
Window("Hello Tests").Click 235,216
|
||||||
|
Window("Hello Tests").Click 205,144
|
||||||
|
Window("Hello Tests").Click 218,143
|
||||||
|
Window("Hello Tests").Click 237,247
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'ActionManagerTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 234,261
|
||||||
|
|
||||||
|
Call common_test(1,4,3)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'LayerTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 240,302
|
||||||
|
|
||||||
|
Call random_drag(1,10,0)
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 2
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 2
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Call random_drag(1,10,0)
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 242,164
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 254,163
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 231,164
|
||||||
|
Wait 1
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'SceneTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Drag 370,306
|
||||||
|
Window("Hello Tests").Drop 370,-20
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 234,17
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 230,111
|
||||||
|
Window("Hello Tests").Click 230,111
|
||||||
|
Window("Hello Tests").Click 230,111
|
||||||
|
Window("Hello Tests").Click 233,163
|
||||||
|
Window("Hello Tests").Click 226,218
|
||||||
|
Window("Hello Tests").Click 226,218
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'ParallaxTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 232,55
|
||||||
|
Wait 5
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
|
||||||
|
Call random_drag(1,10,0)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'TileMapTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 233,99
|
||||||
|
Wait 2
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 2
|
||||||
|
|
||||||
|
Call random_drag(1,10,0)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'IntervalTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 235,139
|
||||||
|
Wait 3
|
||||||
|
Window("Hello Tests").Click 224,48
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 231,52
|
||||||
|
Window("Hello Tests").Click 228,56
|
||||||
|
Window("Hello Tests").Click 228,56
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'ChipmunkAccelTouchTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 235,178
|
||||||
|
|
||||||
|
Call random_click(1,20,2)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'LabelTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 239,216
|
||||||
|
Wait 3
|
||||||
|
Call common_test(1,25,0.5)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'TextInputTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 236,255
|
||||||
|
|
||||||
|
Window("Hello Tests").Click 238,161
|
||||||
|
Const constring = "0123456789abcdefgchijklmnopqrstuvwxyz"
|
||||||
|
Dim TextInput_i,TextInput_j,randstring
|
||||||
|
Randomize
|
||||||
|
For TextInput_i=1 To 8
|
||||||
|
randstring = randstring & Mid(constring, Int(Len(constring)*Rnd)+1, 1)
|
||||||
|
Next
|
||||||
|
Window("Hello Tests").Type randstring
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Window("Hello Tests").Click 238,161
|
||||||
|
Randomize
|
||||||
|
For TextInput_j=1 To 8
|
||||||
|
randstring = randstring & Mid(constring, Int(Len(constring)*Rnd)+1, 1)
|
||||||
|
Next
|
||||||
|
Window("Hello Tests").Type randstring
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'SpriteTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 238,294
|
||||||
|
|
||||||
|
Call random_click(1,10,2)
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Call random_click(1,10,2)
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Call common_test(1,108,0.5)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'SchdulerTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Drag 359,309
|
||||||
|
Window("Hello Tests").Drop 359,-11
|
||||||
|
Wait 1
|
||||||
|
'Schedule with delay of 3sec,repeat 4
|
||||||
|
Window("Hello Tests").Click 236,15
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Scheduler timeScale Test
|
||||||
|
Window("Hello Tests").Drag 260,212
|
||||||
|
Window("Hello Tests").Drop 301,212
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Drag 301,212
|
||||||
|
Window("Hello Tests").Drop 209,214
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Drag 209,214
|
||||||
|
Window("Hello Tests").Drop 100,208
|
||||||
|
Wait 2
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Two custom schedulers
|
||||||
|
Window("Hello Tests").Drag 126,16
|
||||||
|
Window("Hello Tests").Drop 81,22
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Drag 361,19
|
||||||
|
Window("Hello Tests").Drop 422,22
|
||||||
|
Wait 3
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Self -remove an scheduler
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Pause/Resume
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Pause/Resume
|
||||||
|
Wait 3
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Unschedule All selectors
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Unschedule All selectors(HARD)
|
||||||
|
Wait 2
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Unschedule All selectors
|
||||||
|
Wait 4
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Schedule from Schedule
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Schedule update with priority
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'RenderTextureTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 240,59
|
||||||
|
'Save Image
|
||||||
|
|
||||||
|
Call random_drag(1,10,0)
|
||||||
|
Window("Hello Tests").Click 388,17
|
||||||
|
Window("Hello Tests").Click 398,41
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Testing issue #937
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Testing Z Buffer in Render Texture
|
||||||
|
Call random_click(1,10,0)
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'Testing depthStencil attachment
|
||||||
|
MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'Texture2DTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 234,97
|
||||||
|
Call common_test(1,35,0.5)
|
||||||
|
MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'Box2dTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 235,134
|
||||||
|
Call random_click(1,30,2)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'Box2dTestBed
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 236,176
|
||||||
|
Call common_test(1,35,2)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'EffectAdvancedTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 237,217
|
||||||
|
Call common_test(1,5,1)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
AccelerometerTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 244,255
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'KeypadTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 240,298
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'CocosDenshionTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Drag 377,314
|
||||||
|
Window("Hello Tests").Drop 377,0
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 243,20
|
||||||
|
|
||||||
|
Window("Hello Tests").Click 248,38
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 248,78
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 247,121
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 246,158
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 251,202
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 246,238
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 241,282
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Drag 427,260
|
||||||
|
Window("Hello Tests").Drop 427,6
|
||||||
|
Window("Hello Tests").Click 232,18
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 245,56
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 242,109
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 242,144
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 243,189
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 243,230
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 254,275
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 248,304
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Drag 412,272
|
||||||
|
Window("Hello Tests").Drop 412,-13
|
||||||
|
Window("Hello Tests").Click 235,124
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 238,158
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 229,200
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 239,243
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 246,277
|
||||||
|
Wait 1
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'PerformanceTest
|
||||||
|
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 237,64
|
||||||
|
Window("Hello Tests").Click 238,37
|
||||||
|
|
||||||
|
'PerformanceNodeChildrenTest
|
||||||
|
Window("Hello Tests").Click 238,38
|
||||||
|
Dim Performance_i
|
||||||
|
For Performance_i = 1 To 4
|
||||||
|
Window("Hello Tests").Click 273,145
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 1
|
||||||
|
Next
|
||||||
|
Back
|
||||||
|
Window("Hello Tests").Click 427,290
|
||||||
|
|
||||||
|
'PerformanceParticeTest
|
||||||
|
Window("Hello Tests").Click 237,78
|
||||||
|
|
||||||
|
For Performance_j = 1 To 4
|
||||||
|
Window("Hello Tests").Click 273,145
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 1
|
||||||
|
Next
|
||||||
|
'Back
|
||||||
|
Window("Hello Tests").Click 427,290
|
||||||
|
'PerformanceSpriteTest
|
||||||
|
Window("Hello Tests").Click 233,120
|
||||||
|
Dim Performance_k
|
||||||
|
For Performance_k = 1 To 5
|
||||||
|
Window("Hello Tests").Click 271,64
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Wait 1
|
||||||
|
Next
|
||||||
|
'Back
|
||||||
|
Window("Hello Tests").Click 427,290
|
||||||
|
|
||||||
|
'PerformanceTextureTest
|
||||||
|
Window("Hello Tests").Click 229,159
|
||||||
|
'Back
|
||||||
|
Window("Hello Tests").Click 427,290
|
||||||
|
|
||||||
|
'PerformanceTouchesTest
|
||||||
|
Window("Hello Tests").Click 234,200
|
||||||
|
Call random_drag(1,10,0)
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
Call random_drag(1,10,0)
|
||||||
|
'Back
|
||||||
|
Window("Hello Tests").Click 427,290
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'ZwoptexTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 233,104
|
||||||
|
Wait 1
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'CurlTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 239,141
|
||||||
|
Window("Hello Tests").Click 242,160
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'UserDefaultTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 238,184
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'BugsTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 240,222
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'FontTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 237,261
|
||||||
|
Call common_test(1,4,0.5)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'CurrentLanguageTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 244,301
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'TextureCacheTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Drag 385,309
|
||||||
|
Window("Hello Tests").Drop 385,33
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Click 241,159
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'ExtensionsTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 241,197
|
||||||
|
Wait 1
|
||||||
|
'NotificationCenterTest
|
||||||
|
Window("Hello Tests").Click 235,41
|
||||||
|
Window("Hello Tests").Click 339,166
|
||||||
|
Window("Hello Tests").Click 339,166
|
||||||
|
Window("Hello Tests").Click 113,189
|
||||||
|
'Back
|
||||||
|
Window("Hello Tests").Click 429,289
|
||||||
|
Wait 1
|
||||||
|
'CCControlButtonTest
|
||||||
|
Window("Hello Tests").Click 238,79
|
||||||
|
Window("Hello Tests").Drag 118,181
|
||||||
|
Window("Hello Tests").Drop 374,189
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Drag 367,179
|
||||||
|
Window("Hello Tests").Drop 76,183
|
||||||
|
Wait 1
|
||||||
|
'Back
|
||||||
|
Window("Hello Tests").Click 422,293
|
||||||
|
'CocosBuilderTest
|
||||||
|
Window("Hello Tests").Click 237,119
|
||||||
|
'Menus_Items
|
||||||
|
Window("Hello Tests").Click 137,158
|
||||||
|
Window("Hello Tests").Click 242,157
|
||||||
|
Window("Hello Tests").Click 113,147
|
||||||
|
Window("Hello Tests").Click 23,20
|
||||||
|
'Button
|
||||||
|
Window("Hello Tests").Click 132,209
|
||||||
|
Window("Hello Tests").Click 240,149
|
||||||
|
Window("Hello Tests").Drag 255,150
|
||||||
|
Window("Hello Tests").Drop 259,233
|
||||||
|
Window("Hello Tests").Click 23,20
|
||||||
|
'Particle Systems
|
||||||
|
Window("Hello Tests").Click 131,261
|
||||||
|
Window("Hello Tests").Click 23,20
|
||||||
|
'Sprites_9 Slice
|
||||||
|
Window("Hello Tests").Click 341,161
|
||||||
|
Window("Hello Tests").Click 23,20
|
||||||
|
'Labels
|
||||||
|
Window("Hello Tests").Click 345,210
|
||||||
|
Window("Hello Tests").Click 23,20
|
||||||
|
'ScrollViewTest
|
||||||
|
Window("Hello Tests").Click 347,259
|
||||||
|
Call random_drag(1,10,0)
|
||||||
|
Window("Hello Tests").Click 23,20
|
||||||
|
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'SharderTest
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 242,239
|
||||||
|
Dim Sharder_i
|
||||||
|
Call common_test(1,6,0.5)
|
||||||
|
Window("Hello Tests").Drag 197,235
|
||||||
|
Window("Hello Tests").Drop 358,236
|
||||||
|
Wait 1
|
||||||
|
Window("Hello Tests").Drag 358,236
|
||||||
|
Window("Hello Tests").Drop 78,221
|
||||||
|
|
||||||
|
Window("Hello Tests").Click 338,291
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'MutiTouchTest
|
||||||
|
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 240,279
|
||||||
|
Call random_drag(1,5,0)
|
||||||
|
'MainMenu
|
||||||
|
Window("Hello Tests").Click 441,296
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
'Quit
|
||||||
|
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
Window("Hello Tests").Click 461,22
|
||||||
|
'SystemUtil.UnblockInput
|
||||||
|
End function
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
1bbfcd16748887dfb66d264a6327737e2ed5a3b1
|
|
@ -0,0 +1,89 @@
|
||||||
|
[General]
|
||||||
|
XlBridgeTimeout=120
|
||||||
|
ContinueOnError=0
|
||||||
|
AutomaticTransactions=0
|
||||||
|
AutomaticTransactionsPerFunc=0
|
||||||
|
automatic_nested_transactions=1
|
||||||
|
|
||||||
|
[ThinkTime]
|
||||||
|
Options=RECORDED
|
||||||
|
Factor=1.000000
|
||||||
|
LimitFlag=0
|
||||||
|
Limit=10
|
||||||
|
ThinkTimeRandomLow=50
|
||||||
|
ThinkTimeRandomHigh=150
|
||||||
|
|
||||||
|
[Log]
|
||||||
|
LogOptions=LogExtended
|
||||||
|
MsgClassData=0
|
||||||
|
MsgClassParameters=0
|
||||||
|
MsgClassFull=0
|
||||||
|
|
||||||
|
[RtsNetwork]
|
||||||
|
LoadImages=1
|
||||||
|
LoadActiveX=1
|
||||||
|
LoadJava=0
|
||||||
|
LoadScripts=1
|
||||||
|
NavigationTimeout=60000
|
||||||
|
ObjectTimeout=3000
|
||||||
|
|
||||||
|
[RtsPerformance]
|
||||||
|
MinThinkTime=3500
|
||||||
|
MaxThinkTime=3500
|
||||||
|
AutoThinkTime=1
|
||||||
|
EnableChecks=0
|
||||||
|
ExcludeThinkTime=0
|
||||||
|
FitThinkTime=0
|
||||||
|
|
||||||
|
[RtsUserInfo]
|
||||||
|
UserName=
|
||||||
|
Password=5029fb73e
|
||||||
|
|
||||||
|
[RtsGeneral]
|
||||||
|
EnableAutoTrans=1
|
||||||
|
FailOnHttpErrors=0
|
||||||
|
RunInSeparateThread=0
|
||||||
|
|
||||||
|
[WEB]
|
||||||
|
HttpVer=1.1
|
||||||
|
UseCustomAgent=1
|
||||||
|
SimulateCache=1
|
||||||
|
TurboLoadTechnology=0
|
||||||
|
WinInetReplay=0
|
||||||
|
EnableModemSpeed=0
|
||||||
|
ModemSpeed=14400
|
||||||
|
KeepAlive=Yes
|
||||||
|
SearchForImages=1
|
||||||
|
CacheSize=20000
|
||||||
|
MaxConnections=4
|
||||||
|
AutomaticThinkTime=0
|
||||||
|
MaxAutoThinkTime=0
|
||||||
|
MinAutoThinkTime=0
|
||||||
|
ConnectTimeout=120
|
||||||
|
ReceiveTimeout=120
|
||||||
|
ResolveTimeout=120
|
||||||
|
EnableChecks=1
|
||||||
|
AnalogMode=1
|
||||||
|
ResetContext=1
|
||||||
|
ProxyUseBrowser=1
|
||||||
|
ProxyUseProxy=0
|
||||||
|
ProxyHTTPHost=
|
||||||
|
ProxyHTTPSHost=
|
||||||
|
ProxyHTTPPort=0
|
||||||
|
ProxyHTTPSPort=0
|
||||||
|
ProxyUseSame=0
|
||||||
|
ProxyNoLocal=0
|
||||||
|
ProxyBypass=
|
||||||
|
ProxyUserName=
|
||||||
|
ProxyPassword=
|
||||||
|
UseMshtml=1
|
||||||
|
Retry401ThinkTime="0"
|
||||||
|
CustomUserAgent=Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)
|
||||||
|
UseBrowserEmulation=0
|
||||||
|
|
||||||
|
[RtsConfigfuration]
|
||||||
|
AutMode=0
|
||||||
|
ScalableMode=1
|
||||||
|
EnableShowBrowser=0
|
||||||
|
[Snapshots]
|
||||||
|
SnapshotOnErrorActive=0
|
|
@ -0,0 +1,15 @@
|
||||||
|
[RunLogicInitRoot]
|
||||||
|
RunLogicActionType="VuserInit"
|
||||||
|
|
||||||
|
[RunLogicEndRoot]
|
||||||
|
RunLogicActionType="VuserEnd"
|
||||||
|
|
||||||
|
[RunLogicRunRoot]
|
||||||
|
RunLogicNumOfIterations="1"
|
||||||
|
MercIniTreeSons="Action0"
|
||||||
|
RunLogicActionOrder="Action0"
|
||||||
|
|
||||||
|
[RunLogicRunRoot:Action0]
|
||||||
|
MercIniTreeFather="RunLogicRunRoot"
|
||||||
|
RunLogicObjectKind="Action"
|
||||||
|
RunLogicInterpreterType="ActiveScript"
|
Binary file not shown.
|
@ -0,0 +1,54 @@
|
||||||
|
[General]
|
||||||
|
Type=Tulip
|
||||||
|
RunType=ActiveScript
|
||||||
|
DefaultCfg=default.cfg
|
||||||
|
DefaultRunLogic=default.usp
|
||||||
|
ParamRightBrace=>
|
||||||
|
ParamLeftBrace=<
|
||||||
|
NewFunctionHeader=1
|
||||||
|
MinorVersion=0
|
||||||
|
MajorVersion=6
|
||||||
|
DevelopTool=AQT
|
||||||
|
|
||||||
|
[Actions]
|
||||||
|
Action0=Action0\Script.mts
|
||||||
|
Action1=Action1\Script.mts
|
||||||
|
|
||||||
|
[VuserProfiles]
|
||||||
|
Profiles=Default Profile
|
||||||
|
|
||||||
|
[CfgFiles]
|
||||||
|
Default Profile=default.cfg
|
||||||
|
|
||||||
|
[RunLogicFiles]
|
||||||
|
Default Profile=default.usp
|
||||||
|
|
||||||
|
[Rendezvous]
|
||||||
|
|
||||||
|
[Transactions]
|
||||||
|
|
||||||
|
[ActiveScript]
|
||||||
|
Lang=none
|
||||||
|
|
||||||
|
[TulipInfo]
|
||||||
|
ProductName=QuickTest Professional
|
||||||
|
Version=10.00
|
||||||
|
|
||||||
|
[TulipAddins]
|
||||||
|
ActiveX=
|
||||||
|
Database=
|
||||||
|
Windows Applications=
|
||||||
|
TEA=
|
||||||
|
Web=
|
||||||
|
XML=
|
||||||
|
|
||||||
|
[ExtraFiles]
|
||||||
|
Test.tsp=
|
||||||
|
Default.xls=
|
||||||
|
Parameters.mtr=
|
||||||
|
Action0\Script.mts=
|
||||||
|
Action0\Resource.mtr=
|
||||||
|
Action0\ObjectRepository.bdb=
|
||||||
|
Action1\Script.mts=
|
||||||
|
Action1\Resource.mtr=
|
||||||
|
Action1\ObjectRepository.bdb=
|
Binary file not shown.
|
@ -0,0 +1,29 @@
|
||||||
|
echo./*
|
||||||
|
echo.* Run cocos2d-win32 tests.exe
|
||||||
|
echo.*/
|
||||||
|
echo.
|
||||||
|
|
||||||
|
set qtpproj=%cd%
|
||||||
|
cd ..\..\..\..\
|
||||||
|
|
||||||
|
"%VS90COMNTOOLS%..\IDE\devenv.com" "%WORKSPACE%\cocos2d-win32.vc2008.sln" /Build "Debug|Win32"
|
||||||
|
|
||||||
|
set CC_TEST_BIN=TestCpp.exe
|
||||||
|
|
||||||
|
set CC_TEST_RES=%cd%\samples\TestCpp\Resources\*.*
|
||||||
|
set CC_HELLOWORLD_RES=%cd%\samples\HelloCpp\Resources\*.*
|
||||||
|
set CC_HELLOLUA_RES=%cd%\samples\HelloLua\Resources\*.*
|
||||||
|
set CC_TESTJS_RES=%cd%\samples\TestJavascript\Resources\*.*
|
||||||
|
|
||||||
|
cd Debug.win32
|
||||||
|
|
||||||
|
xcopy /E /Y /Q "%CC_TEST_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_HELLOWORLD_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_HELLOLUA_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_TESTJS_RES%" .
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
cd %qtpproj%\qtp_win32
|
||||||
|
cscript qtrunner.vbs
|
||||||
|
|
||||||
|
pause
|
|
@ -0,0 +1,29 @@
|
||||||
|
echo./*
|
||||||
|
echo.* Run cocos2d-win32 tests.exe
|
||||||
|
echo.*/
|
||||||
|
echo.
|
||||||
|
|
||||||
|
set qtpproj=%cd%
|
||||||
|
cd ..\..\..\..\
|
||||||
|
|
||||||
|
"%VS90COMNTOOLS%..\IDE\devenv.com" "%WORKSPACE%\cocos2d-win32.vc2008.sln" /Build "Release|Win32"
|
||||||
|
|
||||||
|
set CC_TEST_BIN=TestCpp.exe
|
||||||
|
|
||||||
|
set CC_TEST_RES=%cd%\samples\TestCpp\Resources\*.*
|
||||||
|
set CC_HELLOWORLD_RES=%cd%\samples\HelloCpp\Resources\*.*
|
||||||
|
set CC_HELLOLUA_RES=%cd%\samples\HelloLua\Resources\*.*
|
||||||
|
set CC_TESTJS_RES=%cd%\samples\TestJavascript\Resources\*.*
|
||||||
|
|
||||||
|
cd Debug.win32
|
||||||
|
|
||||||
|
xcopy /E /Y /Q "%CC_TEST_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_HELLOWORLD_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_HELLOLUA_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_TESTJS_RES%" .
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
cd %qtpproj%\qtp_win32
|
||||||
|
cscript qtrunner.vbs
|
||||||
|
|
||||||
|
pause
|
|
@ -0,0 +1,29 @@
|
||||||
|
echo./*
|
||||||
|
echo.* Run cocos2d-win32 tests.exe
|
||||||
|
echo.*/
|
||||||
|
echo.
|
||||||
|
|
||||||
|
set qtpproj=%cd%
|
||||||
|
cd ..\..\..\..\
|
||||||
|
|
||||||
|
"%VS100COMNTOOLS%..\IDE\devenv.com" "%WORKSPACE%\cocos2d-win32.vc2010.sln" /Build "Debug|Win32"
|
||||||
|
|
||||||
|
set CC_TEST_BIN=TestCpp.exe
|
||||||
|
|
||||||
|
set CC_TEST_RES=%cd%\samples\TestCpp\Resources\*.*
|
||||||
|
set CC_HELLOWORLD_RES=%cd%\samples\HelloCpp\Resources\*.*
|
||||||
|
set CC_HELLOLUA_RES=%cd%\samples\HelloLua\Resources\*.*
|
||||||
|
set CC_TESTJS_RES=%cd%\samples\TestJavascript\Resources\*.*
|
||||||
|
|
||||||
|
cd Debug.win32
|
||||||
|
|
||||||
|
xcopy /E /Y /Q "%CC_TEST_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_HELLOWORLD_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_HELLOLUA_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_TESTJS_RES%" .
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
cd %qtpproj%\qtp_win32
|
||||||
|
cscript qtrunner.vbs
|
||||||
|
|
||||||
|
pause
|
|
@ -0,0 +1,29 @@
|
||||||
|
echo./*
|
||||||
|
echo.* Run cocos2d-win32 tests.exe
|
||||||
|
echo.*/
|
||||||
|
echo.
|
||||||
|
|
||||||
|
set qtpproj=%cd%
|
||||||
|
cd ..\..\..\..\
|
||||||
|
|
||||||
|
"%VS100COMNTOOLS%..\IDE\devenv.com" "%WORKSPACE%\cocos2d-win32.vc2010.sln" /Build "Release|Win32"
|
||||||
|
|
||||||
|
set CC_TEST_BIN=TestCpp.exe
|
||||||
|
|
||||||
|
set CC_TEST_RES=%cd%\samples\TestCpp\Resources\*.*
|
||||||
|
set CC_HELLOWORLD_RES=%cd%\samples\HelloCpp\Resources\*.*
|
||||||
|
set CC_HELLOLUA_RES=%cd%\samples\HelloLua\Resources\*.*
|
||||||
|
set CC_TESTJS_RES=%cd%\samples\TestJavascript\Resources\*.*
|
||||||
|
|
||||||
|
cd Release.win32
|
||||||
|
|
||||||
|
xcopy /E /Y /Q "%CC_TEST_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_HELLOWORLD_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_HELLOLUA_RES%" .
|
||||||
|
xcopy /E /Y /Q "%CC_TESTJS_RES%" .
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
cd %qtpproj%\qtp_win32
|
||||||
|
cscript qtrunner.vbs
|
||||||
|
|
||||||
|
pause
|
|
@ -5,29 +5,34 @@ enum {
|
||||||
|
|
||||||
class CCAction : public CCObject
|
class CCAction : public CCObject
|
||||||
{
|
{
|
||||||
// bool isDone(void);
|
bool isDone(void);
|
||||||
// CCNode* getTarget(void);
|
CCNode* getTarget(void);
|
||||||
// void setTarget(CCNode *pTarget);
|
// void setTarget(CCNode *pTarget);
|
||||||
// CCNode* getOriginalTarget(void);
|
CCNode* getOriginalTarget(void);
|
||||||
// void setOriginalTarget(CCNode *pOriginalTarget);
|
// void setOriginalTarget(CCNode *pOriginalTarget);
|
||||||
// int getTag(void);
|
|
||||||
// void setTag(int nTag);
|
|
||||||
|
|
||||||
// static CCAction* create();
|
// static CCAction* create();
|
||||||
|
int getTag(void);
|
||||||
|
void setTag(int nTag);
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCActionInterval : public CCAction
|
class CCActionInterval : public CCAction
|
||||||
{
|
{
|
||||||
// float getElapsed(void);
|
float getElapsed(void);
|
||||||
// void setAmplitudeRate(CGFloat amp);
|
bool isDone(void);
|
||||||
// CGFloat getAmplitudeRate(void);
|
void setAmplitudeRate(float amp);
|
||||||
|
float getAmplitudeRate(void);
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
CCActionInterval* create(float d);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCFiniteTimeAction : public CCActionInterval
|
class CCFiniteTimeAction : public CCActionInterval
|
||||||
{
|
{
|
||||||
// float getDuration(void);
|
float getDuration(void);
|
||||||
// void setDuration(float duration);
|
void setDuration(float duration);
|
||||||
// CCFiniteTimeAction* reverse(void);
|
CCFiniteTimeAction* reverse(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
// CCActionInterval
|
// CCActionInterval
|
||||||
|
@ -35,7 +40,9 @@ class CCSpeed : public CCAction
|
||||||
{
|
{
|
||||||
float getSpeed(void);
|
float getSpeed(void);
|
||||||
void setSpeed(float fSpeed);
|
void setSpeed(float fSpeed);
|
||||||
CCAction* reverse(void);
|
CCActionInterval* reverse(void);
|
||||||
|
bool isDone(void);
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCSpeed* create(CCActionInterval *pAction, float fRate);
|
static CCSpeed* create(CCActionInterval *pAction, float fRate);
|
||||||
};
|
};
|
||||||
|
@ -44,6 +51,8 @@ class CCFollow : public CCAction
|
||||||
{
|
{
|
||||||
bool isBoundarySet(void);
|
bool isBoundarySet(void);
|
||||||
void setBoudarySet(bool bValue);
|
void setBoudarySet(bool bValue);
|
||||||
|
bool isDone(void);
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCFollow* create(CCNode *pFollowedNode);
|
static CCFollow* create(CCNode *pFollowedNode);
|
||||||
static CCFollow* create(CCNode *pFollowedNode, CCRect rect);
|
static CCFollow* create(CCNode *pFollowedNode, CCRect rect);
|
||||||
|
@ -51,63 +60,97 @@ class CCFollow : public CCAction
|
||||||
|
|
||||||
class CCSequence : public CCActionInterval
|
class CCSequence : public CCActionInterval
|
||||||
{
|
{
|
||||||
static CCFiniteTimeAction* create(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCFiniteTimeAction* createWithTwoActions(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
|
||||||
static CCFiniteTimeAction* create(CCArray *actions);
|
static CCFiniteTimeAction* create(CCArray *actions);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCRepeat : public CCActionInterval
|
class CCRepeat : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
bool isDone(void);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCRepeat* create(CCActionInterval *pAction, unsigned int times);
|
static CCRepeat* create(CCActionInterval *pAction, unsigned int times);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCRepeatForever : public CCActionInterval
|
class CCRepeatForever : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
bool isDone(void);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCRepeatForever* create(CCActionInterval *pAction);
|
static CCRepeatForever* create(CCActionInterval *pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCSpawn : public CCActionInterval
|
class CCSpawn : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCFiniteTimeAction* create(CCArray *actions);
|
static CCFiniteTimeAction* create(CCArray *actions);
|
||||||
static CCSpawn* create(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
|
static CCFiniteTimeAction* create(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCRotateTo : public CCActionInterval
|
class CCRotateTo : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCRotateTo* create(float duration, float fDeltaAngle);
|
static CCRotateTo* create(float duration, float fDeltaAngle);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCRotateBy : public CCActionInterval
|
class CCRotateBy : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCRotateBy* create(float duration, float fDeltaAngle);
|
static CCRotateBy* create(float duration, float fDeltaAngle);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCMoveTo : public CCActionInterval
|
class CCMoveTo : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCMoveTo* create(float duration, CCPoint position);
|
static CCMoveTo* create(float duration, CCPoint position);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCMoveBy : public CCActionInterval
|
class CCMoveBy : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCMoveBy* create(float duration, CCPoint position);
|
static CCMoveBy* create(float duration, CCPoint position);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCSkewTo : public CCActionInterval
|
class CCSkewTo : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCSkewTo* create(float t, float sx, float sy);
|
static CCSkewTo* create(float t, float sx, float sy);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCSkewBy : public CCActionInterval
|
class CCSkewBy : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCSkewBy* create(float t, float deltaSkewX, float deltaSkewY);
|
static CCSkewBy* create(float t, float deltaSkewX, float deltaSkewY);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCJumpBy : public CCActionInterval
|
class CCJumpBy : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCJumpBy* create(float duration, CCPoint position, float height, int jumps);
|
static CCJumpBy* create(float duration, CCPoint position, float height, int jumps);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCJumpTo : public CCActionInterval
|
class CCJumpTo : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCJumpTo* create(float duration, CCPoint position, float height, int jumps);
|
static CCJumpTo* create(float duration, CCPoint position, float height, int jumps);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -119,112 +162,169 @@ typedef struct _ccBezierConfig {
|
||||||
|
|
||||||
class CCBezierBy : public CCActionInterval
|
class CCBezierBy : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCBezierBy* create(float t, ccBezierConfig c);
|
static CCBezierBy* create(float t, ccBezierConfig c);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCBezierTo : public CCActionInterval
|
class CCBezierTo : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCBezierTo* create(float t, ccBezierConfig c);
|
static CCBezierTo* create(float t, ccBezierConfig c);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCScaleTo : public CCActionInterval
|
class CCScaleTo : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCScaleTo* create(float duration, float s);
|
static CCScaleTo* create(float duration, float s);
|
||||||
static CCScaleTo* create(float duration, float sx, float sy);
|
static CCScaleTo* create(float duration, float sx, float sy);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCScaleBy : public CCActionInterval
|
class CCScaleBy : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCScaleBy* create(float duration, float s);
|
static CCScaleBy* create(float duration, float s);
|
||||||
static CCScaleBy* create(float duration, float sx, float sy);
|
static CCScaleBy* create(float duration, float sx, float sy);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCBlink : public CCActionInterval
|
class CCBlink : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCBlink* create(float duration, unsigned int uBlinks);
|
static CCBlink* create(float duration, unsigned int uBlinks);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCFadeIn : public CCActionInterval
|
class CCFadeIn : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCFadeIn* create(float d);
|
static CCFadeIn* create(float d);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCFadeOut : public CCActionInterval
|
class CCFadeOut : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCFadeOut* create(float d);
|
static CCFadeOut* create(float d);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCFadeTo : public CCActionInterval
|
class CCFadeTo : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCFadeTo* create(float duration, GLubyte opacity);
|
static CCFadeTo* create(float duration, GLubyte opacity);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCTintTo : public CCActionInterval
|
class CCTintTo : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCTintTo* create(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
static CCTintTo* create(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCTintBy : public CCActionInterval
|
class CCTintBy : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCTintBy* create(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
static CCTintBy* create(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCDelayTime : public CCActionInterval
|
class CCDelayTime : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCDelayTime* create(float d);
|
static CCDelayTime* create(float d);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCReverseTime : public CCActionInterval
|
class CCReverseTime : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
static CCReverseTime* create(CCFiniteTimeAction *pAction);
|
static CCReverseTime* create(CCFiniteTimeAction *pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCAnimate : public CCActionInterval
|
class CCAnimate : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
CCAnimation* getAnimation(void);
|
CCAnimation* getAnimation(void);
|
||||||
void setAnimation(CCAnimation *pAnimation);
|
void setAnimation(CCAnimation *pAnimation);
|
||||||
|
|
||||||
static CCAction* create(CCAnimation *pAnimation);
|
static CCAnimate* create(CCAnimation *pAnimation);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCProgressTo : public CCAction
|
class CCTargetedAction : public CCActionInterval
|
||||||
{
|
{
|
||||||
static CCAction* create(float duration, float fPercent);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
};
|
CCNode* getForcedTarget(void);
|
||||||
|
void setForcedTarget(CCNode* target);
|
||||||
|
|
||||||
class CCProgressFromTo : public CCAction
|
static CCTargetedAction* create(CCNode* pTarget, CCFiniteTimeAction* pAction);
|
||||||
{
|
|
||||||
static CCAction* create(float duration, float fFromPercentage, float fToPercentage);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// CCActionInstant
|
// CCActionInstant
|
||||||
class CCShow : public CCAction
|
class CCActionInstant : public CCFiniteTimeAction
|
||||||
{
|
{
|
||||||
static CCAction* create();
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCFiniteTimeAction* reverse(void);
|
||||||
|
bool isDone(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCHide : public CCAction
|
class CCShow : public CCActionInstant
|
||||||
{
|
{
|
||||||
static CCAction* create();
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCFiniteTimeAction* reverse(void);
|
||||||
|
|
||||||
|
static CCShow* create();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCToggleVisibility : public CCAction
|
class CCHide : public CCActionInstant
|
||||||
{
|
{
|
||||||
static CCAction* create();
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCFiniteTimeAction* reverse(void);
|
||||||
|
|
||||||
|
static CCHide* create();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCFlipX : public CCAction
|
class CCToggleVisibility : public CCActionInstant
|
||||||
{
|
{
|
||||||
static CCAction* create(bool x);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
|
static CCToggleVisibility* create();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCFlipY : public CCAction
|
class CCFlipX : public CCActionInstant
|
||||||
{
|
{
|
||||||
static CCAction* create(bool y);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCFiniteTimeAction* reverse(void);
|
||||||
|
|
||||||
|
static CCFlipX* create(bool x);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCPlace : public CCAction //<NSCopying>
|
class CCFlipY : public CCActionInstant
|
||||||
{
|
{
|
||||||
static CCAction* create(CCPoint pos);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCFiniteTimeAction* reverse(void);
|
||||||
|
|
||||||
|
static CCFlipY* create(bool y);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCPlace : public CCActionInstant //<NSCopying>
|
||||||
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
|
static CCPlace* create(CCPoint pos);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
class CCActionCamera : public CCActionInterval
|
class CCActionCamera : public CCActionInterval
|
||||||
{
|
{
|
||||||
void startWithTarget(CCNode *pTarget);
|
void startWithTarget(CCNode *pTarget);
|
||||||
|
CCActionInterval* reverse();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCOrbitCamera : public CCActionCamera
|
class CCOrbitCamera : public CCActionCamera
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
void sphericalRadius(float *r, float *zenith, float *azimuth);
|
void sphericalRadius(float *r, float *zenith, float *azimuth);
|
||||||
|
|
||||||
static CCOrbitCamera * create(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
|
static CCOrbitCamera * create(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX);
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
|
||||||
|
class CCPointArray : public CCNode
|
||||||
|
{
|
||||||
|
bool initWithCapacity(unsigned int capacity);
|
||||||
|
void addControlPoint(CCPoint controlPoint);
|
||||||
|
void insertControlPoint(CCPoint &controlPoint, unsigned int index);
|
||||||
|
void replaceControlPoint(CCPoint &controlPoint, unsigned int index);
|
||||||
|
CCPoint getControlPointAtIndex(unsigned int index);
|
||||||
|
void removeControlPointAtIndex(unsigned int index);
|
||||||
|
unsigned int count();
|
||||||
|
CCPointArray* reverse();
|
||||||
|
void reverseInline();
|
||||||
|
CCObject* copyWithZone(CCZone *zone);
|
||||||
|
CCArray* getControlPoints();
|
||||||
|
void setControlPoints(CCArray *controlPoints);
|
||||||
|
|
||||||
|
static CCPointArray* create(unsigned int capacity);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCCardinalSplineTo : public CCActionInterval
|
||||||
|
{
|
||||||
|
CCCardinalSplineTo* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse();
|
||||||
|
CCPointArray* getPoints();
|
||||||
|
void setPoints(CCPointArray* points);
|
||||||
|
|
||||||
|
static CCCardinalSplineTo* create(float duration, CCPointArray* points, float tension);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CCCardinalSplineBy : public CCCardinalSplineTo
|
||||||
|
{
|
||||||
|
CCActionInterval* reverse();
|
||||||
|
|
||||||
|
static CCCardinalSplineBy* create(float duration, CCPointArray* points, float tension);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCCatmullRomTo : public CCCardinalSplineTo
|
||||||
|
{
|
||||||
|
static CCCatmullRomTo* create(float dt, CCPointArray* points);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCCatmullRomBy : public CCCardinalSplineBy
|
||||||
|
{
|
||||||
|
static CCCatmullRomBy* create(float dt, CCPointArray* points);
|
||||||
|
};
|
|
@ -1,114 +1,183 @@
|
||||||
|
|
||||||
class CCActionEase : public CCActionInterval
|
class CCActionEase : public CCActionInterval
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval *pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCActionEase* create(CCActionInterval *pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseRateAction : public CCActionInterval
|
class CCEaseRateAction : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction, float fRate);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseRateAction* create(CCActionInterval* pAction, float fRate);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseIn : public CCActionInterval
|
class CCEaseIn : public CCEaseRateAction
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction, float fRate);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseIn* create(CCActionInterval* pAction, float fRate);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseOut : public CCActionInterval
|
class CCEaseOut : public CCEaseRateAction
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction, float fRate);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseOut* create(CCActionInterval* pAction, float fRate);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseInOut : public CCActionInterval
|
class CCEaseInOut : public CCEaseRateAction
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction, float fRate);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseInOut* create(CCActionInterval* pAction, float fRate);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseExponentialIn : public CCActionInterval
|
class CCEaseExponentialIn : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseExponentialIn* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseExponentialOut : public CCActionInterval
|
class CCEaseExponentialOut : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseExponentialOut* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseExponentialInOut : public CCActionInterval
|
class CCEaseExponentialInOut : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseExponentialInOut* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseSineIn : public CCActionInterval
|
class CCEaseSineIn : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseSineIn* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseSineOut : public CCActionInterval
|
class CCEaseSineOut : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseSineOut* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseSineInOut : public CCActionInterval
|
class CCEaseSineInOut : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseSineInOut* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseElastic : public CCActionInterval
|
class CCEaseElastic : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval *pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
static CCActionInterval* create(CCActionInterval *pAction, float fPeriod);
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
float getPeriod(void);
|
||||||
|
void setPeriod(float fPeriod);
|
||||||
|
|
||||||
|
static CCEaseElastic* create(CCActionInterval *pAction);
|
||||||
|
static CCEaseElastic* create(CCActionInterval *pAction, float fPeriod);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseElasticIn : public CCActionInterval
|
class CCEaseElasticIn : public CCEaseElastic
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval *pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
static CCActionInterval* create(CCActionInterval *pAction, float fPeriod);
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseElasticIn* create(CCActionInterval *pAction);
|
||||||
|
static CCEaseElasticIn* create(CCActionInterval *pAction, float fPeriod);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseElasticOut : public CCActionInterval
|
class CCEaseElasticOut : public CCEaseElastic
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval *pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
static CCActionInterval* create(CCActionInterval *pAction, float fPeriod);
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseElasticOut* create(CCActionInterval *pAction);
|
||||||
|
static CCEaseElasticOut* create(CCActionInterval *pAction, float fPeriod);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseElasticInOut : public CCActionInterval
|
class CCEaseElasticInOut : public CCEaseElastic
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval *pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
static CCActionInterval* create(CCActionInterval *pAction, float fPeriod);
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseElasticInOut* create(CCActionInterval *pAction);
|
||||||
|
static CCEaseElasticInOut* create(CCActionInterval *pAction, float fPeriod);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseBounce : public CCActionInterval
|
class CCEaseBounce : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseBounce* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseBounceIn : public CCActionInterval
|
class CCEaseBounceIn : public CCEaseBounce
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseBounceIn* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseBounceOut : public CCActionInterval
|
class CCEaseBounceOut : public CCEaseBounce
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseBounceOut* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseBounceInOut : public CCActionInterval
|
class CCEaseBounceInOut : public CCEaseBounce
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseBounceInOut* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseBackIn : public CCActionInterval
|
class CCEaseBackIn : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseBackIn* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseBackOut : public CCActionInterval
|
class CCEaseBackOut : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseBackOut* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCEaseBackInOut : public CCActionInterval
|
class CCEaseBackInOut : public CCActionEase
|
||||||
{
|
{
|
||||||
static CCActionInterval* create(CCActionInterval* pAction);
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
|
static CCEaseBackInOut* create(CCActionInterval* pAction);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
|
||||||
class CCGridAction : public CCActionInterval
|
class CCGridAction : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
CCGridBase* getGrid(void);
|
CCGridBase* getGrid(void);
|
||||||
|
|
||||||
static CCGridAction* create(ccGridSize gridSize, float duration);
|
static CCGridAction* create(ccGridSize gridSize, float duration);
|
||||||
|
@ -8,14 +11,38 @@ class CCGridAction : public CCActionInterval
|
||||||
|
|
||||||
class CCAccelDeccelAmplitude : public CCActionInterval
|
class CCAccelDeccelAmplitude : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
float getRate(void);
|
float getRate(void);
|
||||||
void setRate(float fRate);
|
void setRate(float fRate);
|
||||||
|
|
||||||
static CCAccelDeccelAmplitude* create(CCAction *pAction, float duration);
|
static CCAccelDeccelAmplitude* create(CCAction *pAction, float duration);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CCGrid3DAction : public CCGridAction
|
||||||
|
{
|
||||||
|
virtual CCGridBase* getGrid(void);
|
||||||
|
ccVertex3F vertex(const ccGridSize& pos);
|
||||||
|
ccVertex3F originalVertex(const ccGridSize& pos);
|
||||||
|
void setVertex(const ccGridSize& pos, const ccVertex3F& vertex);
|
||||||
|
|
||||||
|
//static CCGrid3DAction* create(const ccGridSize& gridSize, float duration);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCTiledGrid3DAction : public CCGridAction
|
||||||
|
{
|
||||||
|
ccQuad3 tile(ccGridSize pos);
|
||||||
|
ccQuad3 originalTile(ccGridSize pos);
|
||||||
|
void setTile(ccGridSize pos, ccQuad3 coords);
|
||||||
|
CCGridBase* getGrid(void);
|
||||||
|
|
||||||
|
//static CCTiledGrid3DAction* create(ccGridSize gridSize, float duration);
|
||||||
|
};
|
||||||
|
|
||||||
class CCAccelAmplitude : public CCActionInterval
|
class CCAccelAmplitude : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
float getRate(void);
|
float getRate(void);
|
||||||
void setRate(float fRate);
|
void setRate(float fRate);
|
||||||
|
|
||||||
|
@ -24,6 +51,8 @@ class CCAccelAmplitude : public CCActionInterval
|
||||||
|
|
||||||
class CCDeccelAmplitude : public CCActionInterval
|
class CCDeccelAmplitude : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCActionInterval* reverse(void);
|
||||||
|
|
||||||
float getRate(void);
|
float getRate(void);
|
||||||
void setRate(float fRate);
|
void setRate(float fRate);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
class CCWaves3D : public CCGrid3DAction
|
class CCWaves3D : public CCGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
float getAmplitude(void);
|
float getAmplitude(void);
|
||||||
void setAmplitude(float fAmplitude);
|
void setAmplitude(float fAmplitude);
|
||||||
float getAmplitudeRate(void);
|
float getAmplitudeRate(void);
|
||||||
|
@ -11,16 +13,22 @@ class CCWaves3D : public CCGrid3DAction
|
||||||
|
|
||||||
class CCFlipX3D : public CCGrid3DAction
|
class CCFlipX3D : public CCGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCFlipX3D* create(float duration);
|
static CCFlipX3D* create(float duration);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCFlipY3D : public CCFlipX3D
|
class CCFlipY3D : public CCFlipX3D
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCFlipY3D* create(float duration);
|
static CCFlipY3D* create(float duration);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCLens3D : public CCGrid3DAction
|
class CCLens3D : public CCGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
float getLensEffect(void);
|
float getLensEffect(void);
|
||||||
void setLensEffect(float fLensEffect);
|
void setLensEffect(float fLensEffect);
|
||||||
CCPoint getPosition(void);
|
CCPoint getPosition(void);
|
||||||
|
@ -31,6 +39,8 @@ class CCLens3D : public CCGrid3DAction
|
||||||
|
|
||||||
class CCRipple3D : public CCGrid3DAction
|
class CCRipple3D : public CCGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
CCPoint getPosition(void);
|
CCPoint getPosition(void);
|
||||||
void setPosition(CCPoint position);
|
void setPosition(CCPoint position);
|
||||||
float getAmplitude(void);
|
float getAmplitude(void);
|
||||||
|
@ -43,11 +53,15 @@ class CCRipple3D : public CCGrid3DAction
|
||||||
|
|
||||||
class CCShaky3D : public CCGrid3DAction
|
class CCShaky3D : public CCGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCShaky3D* create(int range, bool shakeZ, ccGridSize gridSize, float duration);
|
static CCShaky3D* create(int range, bool shakeZ, ccGridSize gridSize, float duration);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCLiquid : public CCGrid3DAction
|
class CCLiquid : public CCGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
float getAmplitude(void);
|
float getAmplitude(void);
|
||||||
void setAmplitude(float fAmplitude);
|
void setAmplitude(float fAmplitude);
|
||||||
float getAmplitudeRate(void);
|
float getAmplitudeRate(void);
|
||||||
|
@ -58,6 +72,8 @@ class CCLiquid : public CCGrid3DAction
|
||||||
|
|
||||||
class CCWaves : public CCGrid3DAction
|
class CCWaves : public CCGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
float getAmplitude(void);
|
float getAmplitude(void);
|
||||||
void setAmplitude(float fAmplitude);
|
void setAmplitude(float fAmplitude);
|
||||||
float getAmplitudeRate(void);
|
float getAmplitudeRate(void);
|
||||||
|
@ -68,6 +84,8 @@ class CCWaves : public CCGrid3DAction
|
||||||
|
|
||||||
class CCTwirl : public CCGrid3DAction
|
class CCTwirl : public CCGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
CCPoint getPosition(void);
|
CCPoint getPosition(void);
|
||||||
void setPosition(CCPoint position);
|
void setPosition(CCPoint position);
|
||||||
float getAmplitude(void);
|
float getAmplitude(void);
|
||||||
|
|
|
@ -18,4 +18,8 @@ class CCActionManager : public CCObject
|
||||||
void pauseTarget(CCObject *pTarget);
|
void pauseTarget(CCObject *pTarget);
|
||||||
|
|
||||||
void resumeTarget(CCObject *pTarget);
|
void resumeTarget(CCObject *pTarget);
|
||||||
|
|
||||||
|
CCSet* pauseAllRunningActions();
|
||||||
|
|
||||||
|
void resumeTargets(CCSet* targetsToResume);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
|
|
||||||
class CCProgressTo : public CCActionInterval
|
class CCProgressTo : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCProgressTo* create(float duration, float fPercent);
|
static CCProgressTo* create(float duration, float fPercent);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCProgressFromTo : public CCActionInterval
|
class CCProgressFromTo : public CCActionInterval
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCProgressFromTo* create(float duration, float fFromPercentage, float fToPercentage);
|
static CCProgressFromTo* create(float duration, float fFromPercentage, float fToPercentage);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,16 +1,22 @@
|
||||||
|
|
||||||
class CCShakyTiles3D : public CCTiledGrid3DAction
|
class CCShakyTiles3D : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCShakyTiles3D* create(int nRange, bool bShakeZ, ccGridSize gridSize, float duration);
|
static CCShakyTiles3D* create(int nRange, bool bShakeZ, ccGridSize gridSize, float duration);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCShatteredTiles3D : public CCTiledGrid3DAction
|
class CCShatteredTiles3D : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCShatteredTiles3D* create(int nRange, bool bShatterZ, ccGridSize gridSize, float duration);
|
static CCShatteredTiles3D* create(int nRange, bool bShatterZ, ccGridSize gridSize, float duration);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCShuffleTiles : public CCTiledGrid3DAction
|
class CCShuffleTiles : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
void shuffle(int *pArray, int nLen);
|
void shuffle(int *pArray, int nLen);
|
||||||
ccGridSize getDelta(ccGridSize pos);
|
ccGridSize getDelta(ccGridSize pos);
|
||||||
void placeTile(ccGridSize pos, Tile *t);
|
void placeTile(ccGridSize pos, Tile *t);
|
||||||
|
@ -34,6 +40,8 @@ class CCFadeOutBLTiles : public CCFadeOutTRTiles
|
||||||
|
|
||||||
class CCFadeOutUpTiles : public CCFadeOutTRTiles
|
class CCFadeOutUpTiles : public CCFadeOutTRTiles
|
||||||
{
|
{
|
||||||
|
void transformTile(ccGridSize pos, float distance);
|
||||||
|
|
||||||
static CCFadeOutUpTiles* create(ccGridSize gridSize, float time);
|
static CCFadeOutUpTiles* create(ccGridSize gridSize, float time);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,6 +52,8 @@ class CCFadeOutDownTiles : public CCFadeOutUpTiles
|
||||||
|
|
||||||
class CCTurnOffTiles : public CCTiledGrid3DAction
|
class CCTurnOffTiles : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
void shuffle(int *pArray, int nLen);
|
void shuffle(int *pArray, int nLen);
|
||||||
void turnOnTile(ccGridSize pos);
|
void turnOnTile(ccGridSize pos);
|
||||||
void turnOffTile(ccGridSize pos);
|
void turnOffTile(ccGridSize pos);
|
||||||
|
@ -54,6 +64,8 @@ class CCTurnOffTiles : public CCTiledGrid3DAction
|
||||||
|
|
||||||
class CCWavesTiles3D : public CCTiledGrid3DAction
|
class CCWavesTiles3D : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
float getAmplitude(void);
|
float getAmplitude(void);
|
||||||
void setAmplitude(float fAmplitude);
|
void setAmplitude(float fAmplitude);
|
||||||
float getAmplitudeRate(void);
|
float getAmplitudeRate(void);
|
||||||
|
@ -64,6 +76,8 @@ class CCWavesTiles3D : public CCTiledGrid3DAction
|
||||||
|
|
||||||
class CCJumpTiles3D : public CCTiledGrid3DAction
|
class CCJumpTiles3D : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
float getAmplitude(void);
|
float getAmplitude(void);
|
||||||
void setAmplitude(float fAmplitude);
|
void setAmplitude(float fAmplitude);
|
||||||
float getAmplitudeRate(void);
|
float getAmplitudeRate(void);
|
||||||
|
@ -74,10 +88,14 @@ class CCJumpTiles3D : public CCTiledGrid3DAction
|
||||||
|
|
||||||
class CCSplitRows : public CCTiledGrid3DAction
|
class CCSplitRows : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCSplitRows* create(int nRows, float duration);
|
static CCSplitRows* create(int nRows, float duration);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCSplitCols : public CCTiledGrid3DAction
|
class CCSplitCols : public CCTiledGrid3DAction
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCSplitCols* create(int nCols, float duration);
|
static CCSplitCols* create(int nCols, float duration);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
struct CCAffineTransform {
|
struct CCAffineTransform {
|
||||||
CCFloat a, b, c, d;
|
float a, b, c, d;
|
||||||
CCFloat tx, ty;
|
float tx, ty;
|
||||||
};
|
};
|
||||||
|
|
||||||
CCAffineTransform __CCAffineTransformMake(CCFloat a, CCFloat b, CCFloat c, CCFloat d, CCFloat tx, CCFloat ty);
|
CCAffineTransform __CCAffineTransformMake(float a, float b, float c, float d, float tx, float ty);
|
||||||
CCAffineTransform CCAffineTransformMake(CCFloat a, CCFloat b, CCFloat c, CCFloat d, CCFloat tx, CCFloat ty);
|
CCAffineTransform CCAffineTransformMake(float a, float b, float c, float d, float tx, float ty);
|
||||||
|
|
||||||
CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t);
|
CCPoint __CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t);
|
||||||
CCPoint CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t);
|
CCPoint CCPointApplyAffineTransform(CCPoint point, CCAffineTransform t);
|
||||||
|
@ -17,8 +17,8 @@ CCAffineTransform CCAffineTransformMakeIdentity();
|
||||||
CCRect CCRectApplyAffineTransform(CCRect rect, CCAffineTransform anAffineTransform);
|
CCRect CCRectApplyAffineTransform(CCRect rect, CCAffineTransform anAffineTransform);
|
||||||
|
|
||||||
CCAffineTransform CCAffineTransformTranslate(CCAffineTransform t, float tx, float ty);
|
CCAffineTransform CCAffineTransformTranslate(CCAffineTransform t, float tx, float ty);
|
||||||
CCAffineTransform CCAffineTransformRotate(CCAffineTransform aTransform, CCFloat anAngle);
|
CCAffineTransform CCAffineTransformRotate(CCAffineTransform aTransform, float anAngle);
|
||||||
CCAffineTransform CCAffineTransformScale(CCAffineTransform t, CCFloat sx, CCFloat sy);
|
CCAffineTransform CCAffineTransformScale(CCAffineTransform t, float sx, float sy);
|
||||||
CCAffineTransform CCAffineTransformConcat(CCAffineTransform t1,CCAffineTransform t2);
|
CCAffineTransform CCAffineTransformConcat(CCAffineTransform t1,CCAffineTransform t2);
|
||||||
bool CCAffineTransformEqualToTransform(CCAffineTransform t1,CCAffineTransform t2);
|
bool CCAffineTransformEqualToTransform(CCAffineTransform t1,CCAffineTransform t2);
|
||||||
CCAffineTransform CCAffineTransformInvert(CCAffineTransform t);
|
CCAffineTransform CCAffineTransformInvert(CCAffineTransform t);
|
||||||
|
|
|
@ -3,6 +3,7 @@ class CCAnimationFrame : public CCObject
|
||||||
{
|
{
|
||||||
CCAnimationFrame();
|
CCAnimationFrame();
|
||||||
~CCAnimationFrame();
|
~CCAnimationFrame();
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
bool initWithSpriteFrame(CCSpriteFrame* spriteFrame, float delayUnits, CCDictionary* userInfo);
|
bool initWithSpriteFrame(CCSpriteFrame* spriteFrame, float delayUnits, CCDictionary* userInfo);
|
||||||
|
|
||||||
|
@ -21,10 +22,11 @@ class CCAnimation : public CCObject
|
||||||
{
|
{
|
||||||
CCAnimation();
|
CCAnimation();
|
||||||
~CCAnimation(void);
|
~CCAnimation(void);
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCAnimation* create(void);
|
static CCAnimation* create(void);
|
||||||
static CCAnimation* create(CCArray* arrayOfSpriteFrameNames);
|
static CCAnimation* createWithSpriteFrames(CCArray* arrayOfSpriteFrameNames);
|
||||||
static CCAnimation* create(CCArray* arrayOfSpriteFrameNames, float delay);
|
static CCAnimation* createWithSpriteFrames(CCArray* arrayOfSpriteFrameNames, float delay);
|
||||||
static CCAnimation* create(CCArray *arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops);
|
static CCAnimation* create(CCArray *arrayOfAnimationFrameNames, float delayPerUnit, unsigned int loops);
|
||||||
|
|
||||||
void addSpriteFrame(CCSpriteFrame *pFrame);
|
void addSpriteFrame(CCSpriteFrame *pFrame);
|
||||||
|
|
|
@ -7,4 +7,7 @@ class CCAnimationCache : public CCObject
|
||||||
|
|
||||||
static CCAnimationCache* sharedAnimationCache(void);
|
static CCAnimationCache* sharedAnimationCache(void);
|
||||||
static void purgeSharedAnimationCache(void);
|
static void purgeSharedAnimationCache(void);
|
||||||
|
|
||||||
|
void addAnimationsWithDictionary(CCDictionary* dictionary);
|
||||||
|
void addAnimationsWithFile(const char* plist);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
class CCArray : public CCObject
|
class CCArray : public CCObject
|
||||||
{
|
{
|
||||||
|
CCObject* copyWithZone(CCZone* pZone);
|
||||||
|
|
||||||
static CCArray* create();
|
static CCArray* create();
|
||||||
|
|
||||||
static CCArray* createWithObject(CCObject* pObject);
|
static CCArray* createWithObject(CCObject* pObject);
|
||||||
static CCArray* create(const char* pFileName);
|
static CCArray* createWithArray(CCArray* otherArray);
|
||||||
static CCArray* create(unsigned int capacity);
|
static CCArray* createWithCapacity(unsigned int capacity);
|
||||||
static CCArray* create(CCArray* otherArray);
|
static CCArray* createWithContentsOfFile(const char* pFileName);
|
||||||
|
|
||||||
unsigned int count();
|
unsigned int count();
|
||||||
|
|
||||||
|
@ -18,6 +21,8 @@ class CCArray : public CCObject
|
||||||
|
|
||||||
CCObject* randomObject();
|
CCObject* randomObject();
|
||||||
|
|
||||||
|
bool isEqualToArray(CCArray* pOtherArray);
|
||||||
|
|
||||||
bool containsObject(CCObject* object);
|
bool containsObject(CCObject* object);
|
||||||
|
|
||||||
void addObject(CCObject* object);
|
void addObject(CCObject* object);
|
||||||
|
|
|
@ -1,9 +1,24 @@
|
||||||
|
|
||||||
class CCAtlasNode : public CCNode
|
class CCAtlasNode : public CCNode
|
||||||
{
|
{
|
||||||
void updateAtlasValues();
|
CCTextureAtlas* getTextureAtlas();
|
||||||
|
void setTextureAtlas(CCTextureAtlas* atlas);
|
||||||
|
|
||||||
CCTexture2D* getTexture(void);
|
CCTexture2D* getTexture(void);
|
||||||
void setTexture(CCTexture2D *texture);
|
void setTexture(CCTexture2D *texture);
|
||||||
|
|
||||||
static CCAtlasNode * create(const char* tile,unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);
|
ccColor3B getColor();
|
||||||
|
void setColor(ccColor3B color);
|
||||||
|
|
||||||
|
unsigned int getQuadsToDraw();
|
||||||
|
void setQuadsToDraw(unsigned int quadsToDraw);
|
||||||
|
|
||||||
|
GLubyte getOpacity();
|
||||||
|
void setOpacity(GLubyte opacity);
|
||||||
|
|
||||||
|
void updateAtlasValues();
|
||||||
|
bool isOpacityModifyRGB();
|
||||||
|
void setOpacityModifyRGB(bool isOpacityModifyRGB);
|
||||||
|
|
||||||
|
static CCAtlasNode * create(const char* tile, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
typedef enum LanguageType
|
||||||
|
{
|
||||||
|
kLanguageEnglish = 0,
|
||||||
|
kLanguageChinese,
|
||||||
|
kLanguageFrench,
|
||||||
|
kLanguageItalian,
|
||||||
|
kLanguageGerman,
|
||||||
|
kLanguageSpanish,
|
||||||
|
kLanguageRussian
|
||||||
|
} ccLanguageType;
|
||||||
|
|
||||||
void CCLuaLog(const char * pszFormat);
|
void CCLuaLog(const char * pszFormat);
|
||||||
void CCMessageBox(const char * pszMsg, const char * pszTitle);
|
void CCMessageBox(const char * pszMsg, const char * pszTitle);
|
||||||
|
|
|
@ -19,8 +19,8 @@ class CCDictionary : public CCObject
|
||||||
void removeAllObjects();
|
void removeAllObjects();
|
||||||
|
|
||||||
static CCDictionary* create();
|
static CCDictionary* create();
|
||||||
static CCDictionary* create(CCDictionary* srcDict);
|
static CCDictionary* createWithDictionary(CCDictionary* srcDict);
|
||||||
static CCDictionary* create(const char *pFileName);
|
static CCDictionary* createWithContentsOfFile(const char *pFileName);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,18 +11,26 @@ class CCDirector : public CCObject
|
||||||
bool isPaused(void);
|
bool isPaused(void);
|
||||||
unsigned int getTotalFrames(void);
|
unsigned int getTotalFrames(void);
|
||||||
|
|
||||||
|
CCEGLView* getOpenGLView(void);
|
||||||
|
bool enableRetinaDisplay(bool bEnableRetina);
|
||||||
|
|
||||||
CCSize getWinSize(void);
|
CCSize getWinSize(void);
|
||||||
CCSize getWinSizeInPixels(void);
|
CCSize getWinSizeInPixels(void);
|
||||||
|
|
||||||
CCPoint convertToGL(CCPoint obPoint);
|
CCPoint convertToGL(CCPoint obPoint);
|
||||||
CCPoint convertToUI(CCPoint obPoint);
|
CCPoint convertToUI(CCPoint obPoint);
|
||||||
|
|
||||||
|
void pause();
|
||||||
|
void resume();
|
||||||
|
void purgeCachedData(void);
|
||||||
|
|
||||||
void runWithScene(CCScene *pScene);
|
void runWithScene(CCScene *pScene);
|
||||||
void pushScene(CCScene *pScene);
|
void pushScene(CCScene *pScene);
|
||||||
void popScene(void);
|
void popScene(void);
|
||||||
void replaceScene(CCScene *pScene);
|
void replaceScene(CCScene *pScene);
|
||||||
|
void endToLua();
|
||||||
|
|
||||||
CCFloat getContentScaleFactor(void);
|
float getContentScaleFactor(void);
|
||||||
|
|
||||||
CCScheduler* getScheduler();
|
CCScheduler* getScheduler();
|
||||||
CCActionManager* getActionManager();
|
CCActionManager* getActionManager();
|
||||||
|
|
|
@ -2,7 +2,15 @@
|
||||||
void ccDrawPoint(CCPoint point);
|
void ccDrawPoint(CCPoint point);
|
||||||
void ccDrawPoints(const CCPoint *points, unsigned int numberOfPoints);
|
void ccDrawPoints(const CCPoint *points, unsigned int numberOfPoints);
|
||||||
void ccDrawLine(CCPoint origin, CCPoint destination);
|
void ccDrawLine(CCPoint origin, CCPoint destination);
|
||||||
void ccDrawPoly(const CCPoint *vertices, int numOfVertices, bool closePolygon);
|
void ccDrawRect(CCPoint origin, CCPoint destination);
|
||||||
|
void ccDrawSolidRect(CCPoint origin, CCPoint destination, ccColor4F color);
|
||||||
|
void ccDrawPoly(const CCPoint *vertices, unsigned int numOfVertices, bool closePolygon);
|
||||||
|
void ccDrawSolidPoly(const CCPoint* poli, unsigned int numberOfPoints, ccColor4F color);
|
||||||
void ccDrawCircle(CCPoint center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
|
void ccDrawCircle(CCPoint center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
|
||||||
void ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, unsigned int segments);
|
void ccDrawQuadBezier(CCPoint origin, CCPoint control, CCPoint destination, unsigned int segments);
|
||||||
void ccDrawCubicBezier(CCPoint origin, CCPoint control1, CCPoint control2, CCPoint destination, unsigned int segments);
|
void ccDrawCubicBezier(CCPoint origin, CCPoint control1, CCPoint control2, CCPoint destination, unsigned int segments);
|
||||||
|
void ccDrawCatmullRom(CCPointArray* arrayOfControlPoints, unsigned int segments);
|
||||||
|
void ccDrawCardinalSpline(CCPointArray* config, float tension, unsigned int segments);
|
||||||
|
void ccDrawColor4B(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
|
||||||
|
void ccDrawColor4F(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
|
||||||
|
void ccPointSize(GLfloat pointSize);
|
||||||
|
|
|
@ -3,4 +3,7 @@ class CCFileUtils
|
||||||
{
|
{
|
||||||
static CCFileUtils* sharedFileUtils();
|
static CCFileUtils* sharedFileUtils();
|
||||||
std::string getWriteablePath();
|
std::string getWriteablePath();
|
||||||
|
const char* fullPathFromRelativePath(const char *pszRelativePath);
|
||||||
|
const char* fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile);
|
||||||
|
const char* fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile);
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@ class CCPoint
|
||||||
CCPoint();
|
CCPoint();
|
||||||
CCPoint(float x, float y);
|
CCPoint(float x, float y);
|
||||||
|
|
||||||
static bool CCPointEqualToPoint(const CCPoint& point1, const CCPoint& point2);
|
bool equals(const CCPoint & target) const ;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCSize
|
class CCSize
|
||||||
|
@ -18,7 +18,7 @@ class CCSize
|
||||||
CCSize();
|
CCSize();
|
||||||
CCSize(float width, float height);
|
CCSize(float width, float height);
|
||||||
|
|
||||||
static bool CCSizeEqualToSize(const CCSize& size1, const CCSize& size2);
|
bool equals(const CCSize & target) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCRect
|
class CCRect
|
||||||
|
@ -28,15 +28,15 @@ class CCRect
|
||||||
CCRect();
|
CCRect();
|
||||||
CCRect(float x, float y, float width, float height);
|
CCRect(float x, float y, float width, float height);
|
||||||
|
|
||||||
static CGFloat CCRectGetMinX(const CCRect& rect);
|
float getMinX();
|
||||||
static CGFloat CCRectGetMaxX(const CCRect& rect);
|
float getMidX();
|
||||||
static CGFloat CCRectGetMidX(const CCRect& rect);
|
float getMaxX();
|
||||||
static CGFloat CCRectGetMinY(const CCRect& rect);
|
float getMinY();
|
||||||
static CGFloat CCRectGetMaxY(const CCRect& rect);
|
float getMidY();
|
||||||
static CGFloat CCRectGetMidY(const CCRect& rect);
|
float getMaxY();
|
||||||
static bool CCRectEqualToRect(const CCRect& rect1, const CCRect& rect2);
|
bool equals(const CCRect & rect) const;
|
||||||
static bool CCRectContainsPoint(const CCRect& rect, const CCPoint& point);
|
bool containsPoint(const CCPoint & point) const;
|
||||||
static bool CCRectIntersectsRect(const CCRect& rectA, const CCRect& rectB);
|
bool intersectsRect(const CCRect & rect) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
CCPoint CCPointMake(float x, float y);
|
CCPoint CCPointMake(float x, float y);
|
||||||
|
|
|
@ -2,7 +2,21 @@
|
||||||
class CCLabelBMFont : public CCNode
|
class CCLabelBMFont : public CCNode
|
||||||
{
|
{
|
||||||
void setString(const char *label);
|
void setString(const char *label);
|
||||||
|
void setString(const char *label, bool fromUpdate);
|
||||||
|
void setCString(const char *label);
|
||||||
const char* getString(void);
|
const char* getString(void);
|
||||||
|
void updateString(bool fromUpdate);
|
||||||
|
|
||||||
|
void setAnchorPoint(const CCPoint & var);
|
||||||
|
void setAlignment(CCTextAlignment alignment);
|
||||||
|
void setWidth(float width);
|
||||||
|
void setLineBreakWithoutSpace(bool breakWithoutSpace);
|
||||||
|
void setScale(float scale);
|
||||||
|
void setScaleX(float scaleX);
|
||||||
|
void setScaleY(float scaleY);
|
||||||
|
|
||||||
|
void setFntFile(const char* fntFile);
|
||||||
|
const char* getFntFile();
|
||||||
|
|
||||||
void setColor(const ccColor3B& color);
|
void setColor(const ccColor3B& color);
|
||||||
const ccColor3B& getColor(void);
|
const ccColor3B& getColor(void);
|
||||||
|
@ -10,8 +24,12 @@ class CCLabelBMFont : public CCNode
|
||||||
GLubyte getOpacity(void);
|
GLubyte getOpacity(void);
|
||||||
void setOpacity(GLubyte opacity);
|
void setOpacity(GLubyte opacity);
|
||||||
|
|
||||||
|
bool isOpacityModifyRGB();
|
||||||
|
void setOpacityModifyRGB(bool isOpacityModifyRGB);
|
||||||
|
|
||||||
tolua_property__CCOpacity GLubyte opacity;
|
tolua_property__CCOpacity GLubyte opacity;
|
||||||
|
|
||||||
static void purgeCachedData();
|
static void purgeCachedData();
|
||||||
static CCLabelBMFont * create(const char *str, const char *fntFile);
|
static CCLabelBMFont * create();
|
||||||
|
static CCLabelBMFont * create(const char *str, const char *fntFile, float width = kCCLabelAutomaticWidth, CCTextAlignment alignment = kCCTextAlignmentLeft, CCPoint imageOffset = CCPointMake(0, 0));
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,23 @@ class CCLabelTTF : public CCSprite
|
||||||
void setString(const char *label);
|
void setString(const char *label);
|
||||||
const char* getString(void);
|
const char* getString(void);
|
||||||
|
|
||||||
static CCLabelTTF * create(const char *label, CCSize dimensions, CCTextAlignment hAlignment,CCVerticalTextAlignment vAlignment, const char *fontName, float fontSize);
|
CCTextAlignment getHorizontalAlignment();
|
||||||
static CCLabelTTF * create(const char *label, CCSize dimensions, CCTextAlignment alignment, const char *fontName, float fontSize);
|
void setHorizontalAlignment(CCTextAlignment alignment);
|
||||||
static CCLabelTTF * create(const char *label, const char *fontName, float fontSize);
|
|
||||||
|
CCVerticalTextAlignment getVerticalAlignment();
|
||||||
|
void setVerticalAlignment(CCVerticalTextAlignment verticalAlignment);
|
||||||
|
|
||||||
|
CCSize getDimensions();
|
||||||
|
void setDimensions(CCSize &dim);
|
||||||
|
|
||||||
|
float getFontSize();
|
||||||
|
void setFontSize(float fontSize);
|
||||||
|
|
||||||
|
const char* getFontName();
|
||||||
|
void setFontName(const char *fontName);
|
||||||
|
|
||||||
|
static CCLabelTTF * create();
|
||||||
|
static CCLabelTTF * create(const char *str, const char *fontName, float fontSize);
|
||||||
|
static CCLabelTTF * create(const char *str, const char *fontName, float fontSize, const CCSize& dimensions, CCTextAlignment hAlignment);
|
||||||
|
static CCLabelTTF * create(const char *str, const char *fontName, float fontSize, const CCSize& dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment);
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,6 +25,8 @@ class CCLayerColor : public CCLayer
|
||||||
void changeHeight(GLfloat h);
|
void changeHeight(GLfloat h);
|
||||||
void changeWidthAndHeight(GLfloat w ,GLfloat h);
|
void changeWidthAndHeight(GLfloat w ,GLfloat h);
|
||||||
|
|
||||||
|
void setContentSize(const CCSize & var);
|
||||||
|
|
||||||
void setOpacity(GLubyte var);
|
void setOpacity(GLubyte var);
|
||||||
GLubyte getOpacity(void);
|
GLubyte getOpacity(void);
|
||||||
void setColor(ccColor3B Value);
|
void setColor(ccColor3B Value);
|
||||||
|
@ -32,6 +34,9 @@ class CCLayerColor : public CCLayer
|
||||||
void setBlendFunc(ccBlendFunc Value);
|
void setBlendFunc(ccBlendFunc Value);
|
||||||
ccBlendFunc getBlendFunc(void);
|
ccBlendFunc getBlendFunc(void);
|
||||||
|
|
||||||
|
void setOpacityModifyRGB(bool bValue);
|
||||||
|
bool isOpacityModifyRGB(void);
|
||||||
|
|
||||||
static CCLayerColor * create(ccColor4B color, GLfloat width, GLfloat height);
|
static CCLayerColor * create(ccColor4B color, GLfloat width, GLfloat height);
|
||||||
static CCLayerColor * create(ccColor4B color);
|
static CCLayerColor * create(ccColor4B color);
|
||||||
};
|
};
|
||||||
|
@ -62,5 +67,6 @@ class CCLayerMultiplex : public CCLayer
|
||||||
void switchTo(unsigned int n);
|
void switchTo(unsigned int n);
|
||||||
void switchToAndReleaseMe(unsigned int n);
|
void switchToAndReleaseMe(unsigned int n);
|
||||||
|
|
||||||
|
static CCLayerMultiplex * create(CCLayer* layer);
|
||||||
static CCLayerMultiplex * createWithLayer(CCLayer* layer);
|
static CCLayerMultiplex * createWithLayer(CCLayer* layer);
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,8 @@ class CCMenu : public CCLayer
|
||||||
void alignItemsInColumns(unsigned int columns, va_list args);
|
void alignItemsInColumns(unsigned int columns, va_list args);
|
||||||
void alignItemsInRows(unsigned int rows, va_list args);
|
void alignItemsInRows(unsigned int rows, va_list args);
|
||||||
|
|
||||||
|
setHandlerPriority(int newPriority);
|
||||||
|
|
||||||
void addChild(CCMenuItem* child, int zOrder = 0, int tag = -1);
|
void addChild(CCMenuItem* child, int zOrder = 0, int tag = -1);
|
||||||
|
|
||||||
void setOpacity(GLubyte opacity);
|
void setOpacity(GLubyte opacity);
|
||||||
|
@ -26,6 +28,13 @@ class CCMenu : public CCLayer
|
||||||
void setColor(ccColor3B color);
|
void setColor(ccColor3B color);
|
||||||
ccColor3B getColor(void);
|
ccColor3B getColor(void);
|
||||||
|
|
||||||
|
void setOpacityModifyRGB(bool bValue);
|
||||||
|
bool isOpacityModifyRGB(void);
|
||||||
|
|
||||||
|
bool isEnabled();
|
||||||
|
void setEnabled(bool value);
|
||||||
|
|
||||||
static CCMenu* create();
|
static CCMenu* create();
|
||||||
static CCMenu* createWithItem(CCMenuItem* item);
|
static CCMenu* createWithItem(CCMenuItem* item);
|
||||||
|
static CCMenu* createWithArray(CCArray* pArrayOfItems);
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,6 +21,18 @@ class CCMenuItemLabel : public CCMenuItem
|
||||||
GLubyte getOpacity();
|
GLubyte getOpacity();
|
||||||
void setColor(ccColor3B color);
|
void setColor(ccColor3B color);
|
||||||
ccColor3B getColor();
|
ccColor3B getColor();
|
||||||
|
void setDisabledColor(const ccColor3B & color);
|
||||||
|
const ccColor3B & getDisabledColor();
|
||||||
|
void setLabel(CCNode* pLabel);
|
||||||
|
CCNode* getLabel();
|
||||||
|
|
||||||
|
void activate();
|
||||||
|
void selected();
|
||||||
|
void unselected();
|
||||||
|
void setEnabled(bool enabled);
|
||||||
|
|
||||||
|
void setOpacityModifyRGB(bool bValue);
|
||||||
|
bool isOpacityModifyRGB(void);
|
||||||
|
|
||||||
static CCMenuItemLabel* create(CCNode* label);
|
static CCMenuItemLabel* create(CCNode* label);
|
||||||
};
|
};
|
||||||
|
@ -37,9 +49,14 @@ class CCMenuItemAtlasFont : public CCMenuItem
|
||||||
class CCMenuItemFont : public CCMenuItem
|
class CCMenuItemFont : public CCMenuItem
|
||||||
{
|
{
|
||||||
static void setFontSize(int s);
|
static void setFontSize(int s);
|
||||||
static int fontSize();
|
static unsigned int fontSize();
|
||||||
static void setFontName(const char* name);
|
static void setFontName(const char* name);
|
||||||
static const char* fontName();
|
static const char* fontName();
|
||||||
|
void setFontSizeObj(unsigned int s);
|
||||||
|
unsigned int fontSizeObj();
|
||||||
|
void setFontNameObj(const char* name);
|
||||||
|
const char* fontNameObj();
|
||||||
|
|
||||||
static CCMenuItemFont * create(const char* value);
|
static CCMenuItemFont * create(const char* value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,6 +67,20 @@ class CCMenuItemSprite : public CCMenuItem
|
||||||
void setOpacity(GLubyte opacity);
|
void setOpacity(GLubyte opacity);
|
||||||
GLubyte getOpacity();
|
GLubyte getOpacity();
|
||||||
|
|
||||||
|
void setNormalImage(CCNode* pImage);
|
||||||
|
CCNode* getNormalImage();
|
||||||
|
void setSelectedImage(CCNode* pImage);
|
||||||
|
CCNode* getSelectedImage();
|
||||||
|
void setDisabledImage(CCNode* pImage);
|
||||||
|
CCNode* getDisabledImage();
|
||||||
|
|
||||||
|
void selected();
|
||||||
|
void unselected();
|
||||||
|
void setEnabled(bool bEnabled);
|
||||||
|
|
||||||
|
void setOpacityModifyRGB(bool bValue);
|
||||||
|
bool isOpacityModifyRGB(void);
|
||||||
|
|
||||||
static CCMenuItemSprite * create(CCNode* normalSprite,
|
static CCMenuItemSprite * create(CCNode* normalSprite,
|
||||||
CCNode* selectedSprite);
|
CCNode* selectedSprite);
|
||||||
static CCMenuItemSprite * create(CCNode* normalSprite,
|
static CCMenuItemSprite * create(CCNode* normalSprite,
|
||||||
|
@ -64,6 +95,11 @@ class CCMenuItemImage : public CCMenuItem
|
||||||
void setOpacity(GLubyte opacity);
|
void setOpacity(GLubyte opacity);
|
||||||
GLubyte getOpacity();
|
GLubyte getOpacity();
|
||||||
|
|
||||||
|
void setNormalSpriteFrame(CCSpriteFrame* frame);
|
||||||
|
void setSelectedSpriteFrame(CCSpriteFrame* frame);
|
||||||
|
void setDisabledSpriteFrame(CCSpriteFrame* frame);
|
||||||
|
|
||||||
|
static CCMenuItemImage* create();
|
||||||
static CCMenuItemImage* create(const char* normalImage,
|
static CCMenuItemImage* create(const char* normalImage,
|
||||||
const char* selectedImage);
|
const char* selectedImage);
|
||||||
static CCMenuItemImage* create(const char* normalImage,
|
static CCMenuItemImage* create(const char* normalImage,
|
||||||
|
@ -73,8 +109,25 @@ class CCMenuItemImage : public CCMenuItem
|
||||||
|
|
||||||
class CCMenuItemToggle : public CCMenuItem
|
class CCMenuItemToggle : public CCMenuItem
|
||||||
{
|
{
|
||||||
|
void setColor(ccColor3B color);
|
||||||
|
ccColor3B getColor();
|
||||||
|
void setOpacity(GLubyte opacity);
|
||||||
|
GLubyte getOpacity();
|
||||||
|
void setSelectedIndex(unsigned int index);
|
||||||
|
unsigned int getSelectedIndex();
|
||||||
|
void setSubItems(CCArray* pArrayOfItems);
|
||||||
|
CCArray* getSubItems();
|
||||||
|
|
||||||
void addSubItem(CCMenuItem *item);
|
void addSubItem(CCMenuItem *item);
|
||||||
CCMenuItem* selectedItem();
|
CCMenuItem* selectedItem();
|
||||||
|
|
||||||
|
void activate();
|
||||||
|
void selected();
|
||||||
|
void unselected();
|
||||||
|
void setEnabled(bool var);
|
||||||
|
|
||||||
|
void setOpacityModifyRGB(bool bValue);
|
||||||
|
bool isOpacityModifyRGB(void);
|
||||||
|
|
||||||
static CCMenuItemToggle* create(CCMenuItem *item);
|
static CCMenuItemToggle* create(CCMenuItem *item);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
enum {
|
||||||
|
kCCNodeTagInvalid = -1,
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kCCNodeOnEnter,
|
kCCNodeOnEnter,
|
||||||
|
@ -22,6 +25,7 @@ class CCNode : public CCObject
|
||||||
float getPositionX();
|
float getPositionX();
|
||||||
float getPositionY();
|
float getPositionY();
|
||||||
void setPosition(float x, float y);
|
void setPosition(float x, float y);
|
||||||
|
void setPosition(CCPoint pos);
|
||||||
void setPositionX(float x);
|
void setPositionX(float x);
|
||||||
void setPositionY(float y);
|
void setPositionY(float y);
|
||||||
float getSkewX();
|
float getSkewX();
|
||||||
|
@ -33,7 +37,7 @@ class CCNode : public CCObject
|
||||||
CCPoint getAnchorPoint();
|
CCPoint getAnchorPoint();
|
||||||
void setAnchorPoint(CCPoint point);
|
void setAnchorPoint(CCPoint point);
|
||||||
CCSize getContentSize();
|
CCSize getContentSize();
|
||||||
void setContentSize(CCSize size);
|
void setContentSize(const CCSize & size);
|
||||||
int getTag();
|
int getTag();
|
||||||
void setTag(int var);
|
void setTag(int var);
|
||||||
|
|
||||||
|
@ -61,6 +65,7 @@ class CCNode : public CCObject
|
||||||
//CCPoint getAnchorPointInPixels();
|
//CCPoint getAnchorPointInPixels();
|
||||||
//CCSize getContentSizeInPixels();
|
//CCSize getContentSizeInPixels();
|
||||||
//void setContentSizeInPixels(CCSize sz);
|
//void setContentSizeInPixels(CCSize sz);
|
||||||
|
CCPoint getAnchorPointInPoints();
|
||||||
bool isRunning();
|
bool isRunning();
|
||||||
CCNode* getParent();
|
CCNode* getParent();
|
||||||
void setParent(CCNode * var);
|
void setParent(CCNode * var);
|
||||||
|
@ -68,6 +73,18 @@ class CCNode : public CCObject
|
||||||
void ignoreAnchorPointForPosition(bool newValue);
|
void ignoreAnchorPointForPosition(bool newValue);
|
||||||
void* getUserData();
|
void* getUserData();
|
||||||
void setUserData(void *var);
|
void setUserData(void *var);
|
||||||
|
CCObject* getUserObject();
|
||||||
|
void setUserObject(CCObject* pObject);
|
||||||
|
CCGLProgram* getShaderProgram();
|
||||||
|
void setShaderProgram(CCGLProgram* pShaderProgram);
|
||||||
|
int getOrderOfArrival();
|
||||||
|
void setOrderOfArrival(int order);
|
||||||
|
ccGLServerState getGLServerState();
|
||||||
|
void setGLServerState(ccGLServerState state);
|
||||||
|
CCActionManager* getActionManager();
|
||||||
|
void setActionManager(CCActionManager* pActionMgr);
|
||||||
|
CCScheduler* getScheduler();
|
||||||
|
void setScheduler(CCScheduler* pScheduler);
|
||||||
void addChild(CCNode * child);
|
void addChild(CCNode * child);
|
||||||
void addChild(CCNode * child, int zOrder);
|
void addChild(CCNode * child, int zOrder);
|
||||||
void addChild(CCNode * child, int zOrder, int tag);
|
void addChild(CCNode * child, int zOrder, int tag);
|
||||||
|
|
|
@ -6,4 +6,6 @@ class CCObject
|
||||||
bool isSingleReference(void);
|
bool isSingleReference(void);
|
||||||
unsigned int retainCount(void);
|
unsigned int retainCount(void);
|
||||||
bool isEqual(const CCObject* pObject);
|
bool isEqual(const CCObject* pObject);
|
||||||
|
CCObject* copy();
|
||||||
|
CCObject* autorelease();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class CCParticleBatchNode : public CCNode, public CCTextureProtocol
|
class CCParticleBatchNode : public CCNode, public CCTextureProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static CCParticleBatchNode* create(CCTexture2D *tex, unsigned int capacity = kCCParticleDefaultCapacity);
|
static CCParticleBatchNode* createWithTexture(CCTexture2D *tex, unsigned int capacity = kCCParticleDefaultCapacity);
|
||||||
static CCParticleBatchNode* create(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity);
|
static CCParticleBatchNode* create(const char* fileImage, unsigned int capacity = kCCParticleDefaultCapacity);
|
||||||
|
|
||||||
virtual void addChild(CCNode * child);
|
virtual void addChild(CCNode * child);
|
||||||
|
|
|
@ -1,9 +1,31 @@
|
||||||
|
enum {
|
||||||
|
kCCParticleDurationInfinity = -1,
|
||||||
|
kCCParticleStartSizeEqualToEndSize = -1,
|
||||||
|
kCCParticleStartRadiusEqualToEndRadius = -1,
|
||||||
|
kParticleStartSizeEqualToEndSize = kCCParticleStartSizeEqualToEndSize,
|
||||||
|
kParticleDurationInfinity = kCCParticleDurationInfinity,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
kCCParticleModeGravity,
|
||||||
|
kCCParticleModeRadius,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
kCCPositionTypeFree,
|
||||||
|
kCCPositionTypeRelative,
|
||||||
|
kCCPositionTypeGrouped,
|
||||||
|
}tCCPositionType;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
kPositionTypeFree = kCCPositionTypeFree,
|
||||||
|
kPositionTypeGrouped = kCCPositionTypeGrouped,
|
||||||
|
};
|
||||||
|
|
||||||
class CCParticleSystem : public CCNode
|
class CCParticleSystem : public CCNode
|
||||||
{
|
{
|
||||||
// mode A
|
// mode A
|
||||||
const CCPoint& getGravity();
|
const CCPoint& getGravity();
|
||||||
|
|
||||||
void setGravity(const CCPoint& g);
|
void setGravity(const CCPoint& g);
|
||||||
float getSpeed();
|
float getSpeed();
|
||||||
void setSpeed(float speed);
|
void setSpeed(float speed);
|
||||||
|
@ -40,6 +62,26 @@ class CCParticleSystem : public CCNode
|
||||||
void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
|
void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
|
||||||
void postStep();
|
void postStep();
|
||||||
|
|
||||||
|
float getStartSize();
|
||||||
|
float getStartSizeVar();
|
||||||
|
float getEndSize();
|
||||||
|
float getEndSizeVar();
|
||||||
|
const ccColor4F & getStartColor();
|
||||||
|
const ccColor4F & getStartColorVar();
|
||||||
|
const ccColor4F & getEndColor();
|
||||||
|
const ccColor4F & getEndColorVar();
|
||||||
|
float getStartSpin();
|
||||||
|
float getStartSpinVar();
|
||||||
|
float getEndSpin();
|
||||||
|
float getEndSpinVar();
|
||||||
|
float getEmissionRate();
|
||||||
|
unsigned int getTotalParticles();
|
||||||
|
|
||||||
|
bool isAutoRemoveOnFinish();
|
||||||
|
void setAutoRemoveOnFinish(bool var);
|
||||||
|
int getEmitterMode();
|
||||||
|
void setEmitterMode(int mode);
|
||||||
|
|
||||||
CCTexture2D* getTexture(void);
|
CCTexture2D* getTexture(void);
|
||||||
void setTexture(CCTexture2D* var);
|
void setTexture(CCTexture2D* var);
|
||||||
|
|
||||||
|
@ -58,7 +100,20 @@ class CCParticleSystem : public CCNode
|
||||||
static CCParticleSystem * create(const char *plistFile);
|
static CCParticleSystem * create(const char *plistFile);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCParticleSystemQuad : public CCParticleSystem {
|
class CCParticleSystemQuad : public CCParticleSystem
|
||||||
|
{
|
||||||
|
void postStep();
|
||||||
|
void setDisplayFrame(CCSpriteFrame* spriteFrame);
|
||||||
|
void setTexture(CCTexture2D* texture);
|
||||||
|
void setTextureWithRect(CCTexture2D *texture, const CCRect& rect);
|
||||||
|
void setBatchNode(CCParticleBatchNode* batchNode);
|
||||||
|
void setTotalParticles(unsigned int tp);
|
||||||
|
|
||||||
|
void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
|
||||||
|
void postStep();
|
||||||
|
void setTotalParticles(unsigned int tp);
|
||||||
|
|
||||||
|
static CCParticleSystemQuad * create();
|
||||||
static CCParticleSystemQuad * create(const char *plistFile);
|
static CCParticleSystemQuad * create(const char *plistFile);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ static CCPoint ccpProject(const CCPoint& v1, const CCPoint& v2);
|
||||||
static CCPoint ccpRotate(const CCPoint& v1, const CCPoint& v2);
|
static CCPoint ccpRotate(const CCPoint& v1, const CCPoint& v2);
|
||||||
static CCPoint ccpUnrotate(const CCPoint& v1, const CCPoint& v2);
|
static CCPoint ccpUnrotate(const CCPoint& v1, const CCPoint& v2);
|
||||||
static CGFloat ccpLengthSQ(const CCPoint& v);
|
static CGFloat ccpLengthSQ(const CCPoint& v);
|
||||||
|
static CGFloat ccpDistanceSQ(const CCPoint p1, const CCPoint p2);
|
||||||
CGFloat ccpLength(const CCPoint& v);
|
CGFloat ccpLength(const CCPoint& v);
|
||||||
CGFloat ccpDistance(const CCPoint& v1, const CCPoint& v2);
|
CGFloat ccpDistance(const CCPoint& v1, const CCPoint& v2);
|
||||||
CCPoint ccpNormalize(const CCPoint& v);
|
CCPoint ccpNormalize(const CCPoint& v);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue