This commit is contained in:
Ming 2010-09-02 08:46:25 +00:00
parent 7a1c55dd5a
commit 857595d644
6 changed files with 18 additions and 12 deletions

View File

@ -55,7 +55,7 @@ CCAction * CCAction::action()
char * CCAction::description()
{
char *ret = new char[100] ;
sprintf_s(ret, 100, "<CCAction | Tag = %d>", m_nTag);
sprintf(ret,"<CCAction | Tag = %d>", m_nTag);
return ret;
}
NSObject* CCAction::copyWithZone(NSZone *pZone)

View File

@ -21,10 +21,11 @@ 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 <cfloat>
#include "CCCameraAction.h"
#include "CCNode.h"
#include "CCCamera.h"
#include "platform/CCXMath.h"
namespace cocos2d{
//
// CameraAction
@ -97,11 +98,11 @@ namespace cocos2d{
CCIntervalAction::startWithTarget(pTarget);
float r, zenith, azimuth;
this->sphericalRadius(&r, &zenith, &azimuth);
if( _isnan(m_fRadius) )
if( CCXMath::isnanCocos2d(m_fRadius) )
m_fRadius = r;
if( _isnan(m_fAngleZ) )
if( CCXMath::isnanCocos2d(m_fAngleZ) )
m_fAngleZ = (CGFloat)CC_RADIANS_TO_DEGREES(zenith);
if( _isnan(m_fAngleX) )
if( CCXMath::isnanCocos2d(m_fAngleX) )
m_fAngleX = (CGFloat)CC_RADIANS_TO_DEGREES(azimuth);
m_fRadZ = (CGFloat)CC_DEGREES_TO_RADIANS(m_fAngleZ);

View File

@ -26,8 +26,8 @@ THE SOFTWARE.
#include "CCSprite.h"
#include "CCNode.h"
#include "CGPointExtension.h"
#include "platform/CCXMath.h"
#include <float.h>
#include <stdarg.h>
namespace cocos2d {
@ -542,7 +542,7 @@ bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAct
ccTime d2 = pAction2->getDuration();
// __super::initWithDuration(fmaxf(d1, d2));
float maxd = (d1 >= d2 || _isnan(d2)) ? d1 : d2;
float maxd = (d1 >= d2 || CCXMath::isnanCocos2d(d2)) ? d1 : d2;
CCIntervalAction::initWithDuration(maxd);
m_pOne = pAction1;

View File

@ -411,7 +411,7 @@ void CCNode::cleanup()
char * CCNode::description()
{
char *ret = new char[100] ;
sprintf_s(ret, 100, "<CCNode | Tag = %d>", m_nTag);
sprintf(ret, "<CCNode | Tag = %d>", m_nTag);
return ret;
}

View File

@ -848,6 +848,10 @@
RelativePath=".\platform\CCXEGLView_platform.h"
>
</File>
<File
RelativePath=".\platform\CCXMath.h"
>
</File>
<File
RelativePath=".\platform\CCXUIImage_platform.h"
>

View File

@ -27,6 +27,7 @@ THE SOFTWARE.
#include "CGPointExtension.h"
#include "CCTouchDispatcher.h"
#include "CCTouch.h"
#include "platform/CCXMath.h"
#include <vector>
#include <float.h>
@ -317,7 +318,7 @@ namespace cocos2d{
assert(rowColumns);
float tmp = (*it)->getContentSize().height;
rowHeight = (unsigned int)((rowHeight >= tmp || _isnan(tmp)) ? rowHeight : tmp);
rowHeight = (unsigned int)((rowHeight >= tmp || CCXMath::isnanCocos2d(tmp)) ? rowHeight : tmp);
++columnsOccupied;
if (columnsOccupied >= rowColumns)
@ -361,7 +362,7 @@ namespace cocos2d{
}
float tmp = (*it)->getContentSize().height;
rowHeight = (unsigned int)((rowHeight >= tmp || _isnan(tmp)) ? rowHeight : tmp);
rowHeight = (unsigned int)((rowHeight >= tmp || CCXMath::isnanCocos2d(tmp)) ? rowHeight : tmp);
(*it)->setPosition(ccp(x - winSize.width / 2,
y - (*it)->getContentSize().height / 2));
@ -430,7 +431,7 @@ namespace cocos2d{
// columnWidth = fmaxf(columnWidth, [item contentSize].width);
float tmp = (*it)->getContentSize().width;
columnWidth = (unsigned int)((columnWidth >= tmp || _isnan(tmp)) ? columnWidth : tmp);
columnWidth = (unsigned int)((columnWidth >= tmp || CCXMath::isnanCocos2d(tmp)) ? columnWidth : tmp);
columnHeight += (int)((*it)->getContentSize().height + 5);
++rowsOccupied;
@ -478,7 +479,7 @@ namespace cocos2d{
// columnWidth = fmaxf(columnWidth, [item contentSize].width);
float tmp = (*it)->getContentSize().width;
columnWidth = (unsigned int)((columnWidth >= tmp || _isnan(tmp)) ? columnWidth : tmp);
columnWidth = (unsigned int)((columnWidth >= tmp || CCXMath::isnanCocos2d(tmp)) ? columnWidth : tmp);
(*it)->setPosition(ccp(x + columnWidths[column] / 2,
y - winSize.height / 2));