mirror of https://github.com/axmolengine/axmol.git
Merge pull request #839 from dumganhar/gles20
fixed #1160: Renamed 'CGFloat' to 'CCFloat'.
This commit is contained in:
commit
e9e6256815
|
@ -860,12 +860,12 @@ bool CCDirector::enableRetinaDisplay(bool enabled)
|
|||
return true;
|
||||
}
|
||||
|
||||
CGFloat CCDirector::getContentScaleFactor(void)
|
||||
CCFloat CCDirector::getContentScaleFactor(void)
|
||||
{
|
||||
return m_fContentScaleFactor;
|
||||
}
|
||||
|
||||
void CCDirector::setContentScaleFactor(CGFloat scaleFactor)
|
||||
void CCDirector::setContentScaleFactor(CCFloat scaleFactor)
|
||||
{
|
||||
if (scaleFactor != m_fContentScaleFactor)
|
||||
{
|
||||
|
|
|
@ -92,8 +92,8 @@ namespace cocos2d{
|
|||
m_fAngleX = angleX;
|
||||
m_fDeltaAngleX = deltaAngleX;
|
||||
|
||||
m_fRadDeltaZ = (CGFloat)CC_DEGREES_TO_RADIANS(deltaAngleZ);
|
||||
m_fRadDeltaX = (CGFloat)CC_DEGREES_TO_RADIANS(deltaAngleX);
|
||||
m_fRadDeltaZ = (CCFloat)CC_DEGREES_TO_RADIANS(deltaAngleZ);
|
||||
m_fRadDeltaX = (CCFloat)CC_DEGREES_TO_RADIANS(deltaAngleX);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -107,12 +107,12 @@ namespace cocos2d{
|
|||
if( isnan(m_fRadius) )
|
||||
m_fRadius = r;
|
||||
if( isnan(m_fAngleZ) )
|
||||
m_fAngleZ = (CGFloat)CC_RADIANS_TO_DEGREES(zenith);
|
||||
m_fAngleZ = (CCFloat)CC_RADIANS_TO_DEGREES(zenith);
|
||||
if( isnan(m_fAngleX) )
|
||||
m_fAngleX = (CGFloat)CC_RADIANS_TO_DEGREES(azimuth);
|
||||
m_fAngleX = (CCFloat)CC_RADIANS_TO_DEGREES(azimuth);
|
||||
|
||||
m_fRadZ = (CGFloat)CC_DEGREES_TO_RADIANS(m_fAngleZ);
|
||||
m_fRadX = (CGFloat)CC_DEGREES_TO_RADIANS(m_fAngleX);
|
||||
m_fRadZ = (CCFloat)CC_DEGREES_TO_RADIANS(m_fAngleZ);
|
||||
m_fRadX = (CCFloat)CC_DEGREES_TO_RADIANS(m_fAngleX);
|
||||
}
|
||||
|
||||
void CCOrbitCamera::update(ccTime dt)
|
||||
|
@ -151,7 +151,7 @@ namespace cocos2d{
|
|||
|
||||
*zenith = acosf( z/r);
|
||||
if( x < 0 )
|
||||
*azimuth= (CGFloat)M_PI - asinf(y/s);
|
||||
*azimuth= (CCFloat)M_PI - asinf(y/s);
|
||||
else
|
||||
*azimuth = asinf(y/s);
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ namespace cocos2d
|
|||
for (j = 0; j < m_sGridSize.y + 1; ++j)
|
||||
{
|
||||
ccVertex3F v = originalVertex(ccg(i ,j));
|
||||
v.z += (sinf((CGFloat)M_PI * time * m_nWaves * 2 + (v.y+v.x) * .01f) * m_fAmplitude * m_fAmplitudeRate);
|
||||
CCLog("v.z offset is %f\n", (sinf((CGFloat)M_PI * time * m_nWaves * 2 + (v.y+v.x) * .01f) * m_fAmplitude * m_fAmplitudeRate));
|
||||
v.z += (sinf((CCFloat)M_PI * time * m_nWaves * 2 + (v.y+v.x) * .01f) * m_fAmplitude * m_fAmplitudeRate);
|
||||
CCLog("v.z offset is %f\n", (sinf((CCFloat)M_PI * time * m_nWaves * 2 + (v.y+v.x) * .01f) * m_fAmplitude * m_fAmplitudeRate));
|
||||
setVertex(ccg(i, j), v);
|
||||
}
|
||||
}
|
||||
|
@ -168,19 +168,19 @@ namespace cocos2d
|
|||
|
||||
void CCFlipX3D::update(ccTime time)
|
||||
{
|
||||
CGFloat angle = (CGFloat)M_PI * time; // 180 degrees
|
||||
CGFloat mz = sinf(angle);
|
||||
CCFloat angle = (CCFloat)M_PI * time; // 180 degrees
|
||||
CCFloat mz = sinf(angle);
|
||||
angle = angle / 2.0f; // x calculates degrees from 0 to 90
|
||||
CGFloat mx = cosf(angle);
|
||||
CCFloat mx = cosf(angle);
|
||||
|
||||
ccVertex3F v0, v1, v, diff;
|
||||
|
||||
v0 = originalVertex(ccg(1, 1));
|
||||
v1 = originalVertex(ccg(0, 0));
|
||||
|
||||
CGFloat x0 = v0.x;
|
||||
CGFloat x1 = v1.x;
|
||||
CGFloat x;
|
||||
CCFloat x0 = v0.x;
|
||||
CCFloat x1 = v1.x;
|
||||
CCFloat x;
|
||||
ccGridSize a, b, c, d;
|
||||
|
||||
if ( x0 > x1 )
|
||||
|
@ -276,19 +276,19 @@ namespace cocos2d
|
|||
|
||||
void CCFlipY3D::update(ccTime time)
|
||||
{
|
||||
CGFloat angle = (CGFloat)M_PI * time; // 180 degrees
|
||||
CGFloat mz = sinf( angle );
|
||||
CCFloat angle = (CCFloat)M_PI * time; // 180 degrees
|
||||
CCFloat mz = sinf( angle );
|
||||
angle = angle / 2.0f; // x calculates degrees from 0 to 90
|
||||
CGFloat my = cosf(angle);
|
||||
CCFloat my = cosf(angle);
|
||||
|
||||
ccVertex3F v0, v1, v, diff;
|
||||
|
||||
v0 = originalVertex(ccg(1, 1));
|
||||
v1 = originalVertex(ccg(0, 0));
|
||||
|
||||
CGFloat y0 = v0.y;
|
||||
CGFloat y1 = v1.y;
|
||||
CGFloat y;
|
||||
CCFloat y0 = v0.y;
|
||||
CCFloat y1 = v1.y;
|
||||
CCFloat y;
|
||||
ccGridSize a, b, c, d;
|
||||
|
||||
if (y0 > y1)
|
||||
|
@ -423,12 +423,12 @@ namespace cocos2d
|
|||
{
|
||||
ccVertex3F v = originalVertex(ccg(i, j));
|
||||
CCPoint vect = ccpSub(m_positionInPixels, ccp(v.x, v.y));
|
||||
CGFloat r = ccpLength(vect);
|
||||
CCFloat r = ccpLength(vect);
|
||||
|
||||
if (r < m_fRadius)
|
||||
{
|
||||
r = m_fRadius - r;
|
||||
CGFloat pre_log = r / m_fRadius;
|
||||
CCFloat pre_log = r / m_fRadius;
|
||||
if ( pre_log == 0 )
|
||||
{
|
||||
pre_log = 0.001f;
|
||||
|
@ -530,13 +530,13 @@ namespace cocos2d
|
|||
{
|
||||
ccVertex3F v = originalVertex(ccg(i, j));
|
||||
CCPoint vect = ccpSub(m_positionInPixels, ccp(v.x,v.y));
|
||||
CGFloat r = ccpLength(vect);
|
||||
CCFloat r = ccpLength(vect);
|
||||
|
||||
if (r < m_fRadius)
|
||||
{
|
||||
r = m_fRadius - r;
|
||||
CGFloat rate = powf(r / m_fRadius, 2);
|
||||
v.z += (sinf( time*(CGFloat)M_PI * m_nWaves * 2 + r * 0.1f) * m_fAmplitude * m_fAmplitudeRate * rate);
|
||||
CCFloat rate = powf(r / m_fRadius, 2);
|
||||
v.z += (sinf( time*(CCFloat)M_PI * m_nWaves * 2 + r * 0.1f) * m_fAmplitude * m_fAmplitudeRate * rate);
|
||||
}
|
||||
|
||||
setVertex(ccg(i, j), v);
|
||||
|
@ -690,8 +690,8 @@ namespace cocos2d
|
|||
for (j = 1; j < m_sGridSize.y; ++j)
|
||||
{
|
||||
ccVertex3F v = originalVertex(ccg(i, j));
|
||||
v.x = (v.x + (sinf(time * (CGFloat)M_PI * m_nWaves * 2 + v.x * .01f) * m_fAmplitude * m_fAmplitudeRate));
|
||||
v.y = (v.y + (sinf(time * (CGFloat)M_PI * m_nWaves * 2 + v.y * .01f) * m_fAmplitude * m_fAmplitudeRate));
|
||||
v.x = (v.x + (sinf(time * (CCFloat)M_PI * m_nWaves * 2 + v.x * .01f) * m_fAmplitude * m_fAmplitudeRate));
|
||||
v.y = (v.y + (sinf(time * (CCFloat)M_PI * m_nWaves * 2 + v.y * .01f) * m_fAmplitude * m_fAmplitudeRate));
|
||||
setVertex(ccg(i, j), v);
|
||||
}
|
||||
}
|
||||
|
@ -769,12 +769,12 @@ namespace cocos2d
|
|||
|
||||
if (m_bVertical)
|
||||
{
|
||||
v.x = (v.x + (sinf(time * (CGFloat)M_PI * m_nWaves * 2 + v.y * .01f) * m_fAmplitude * m_fAmplitudeRate));
|
||||
v.x = (v.x + (sinf(time * (CCFloat)M_PI * m_nWaves * 2 + v.y * .01f) * m_fAmplitude * m_fAmplitudeRate));
|
||||
}
|
||||
|
||||
if (m_bHorizontal)
|
||||
{
|
||||
v.y = (v.y + (sinf(time * (CGFloat)M_PI * m_nWaves * 2 + v.x * .01f) * m_fAmplitude * m_fAmplitudeRate));
|
||||
v.y = (v.y + (sinf(time * (CCFloat)M_PI * m_nWaves * 2 + v.x * .01f) * m_fAmplitude * m_fAmplitudeRate));
|
||||
}
|
||||
|
||||
setVertex(ccg(i, j), v);
|
||||
|
@ -861,10 +861,10 @@ namespace cocos2d
|
|||
ccVertex3F v = originalVertex(ccg(i ,j));
|
||||
|
||||
CCPoint avg = ccp(i-(m_sGridSize.x/2.0f), j-(m_sGridSize.y/2.0f));
|
||||
CGFloat r = ccpLength(avg);
|
||||
CCFloat r = ccpLength(avg);
|
||||
|
||||
CGFloat amp = 0.1f * m_fAmplitude * m_fAmplitudeRate;
|
||||
CGFloat a = r * cosf( (CGFloat)M_PI/2.0f + time * (CGFloat)M_PI * m_nTwirls * 2 ) * amp;
|
||||
CCFloat amp = 0.1f * m_fAmplitude * m_fAmplitudeRate;
|
||||
CCFloat a = r * cosf( (CCFloat)M_PI/2.0f + time * (CCFloat)M_PI * m_nTwirls * 2 ) * amp;
|
||||
|
||||
CCPoint d;
|
||||
|
||||
|
|
|
@ -113,14 +113,14 @@ void CCActionInterval::step(ccTime dt)
|
|||
update(1 > m_elapsed/m_fDuration ? m_elapsed/m_fDuration : 1);
|
||||
}
|
||||
|
||||
void CCActionInterval::setAmplitudeRate(CGFloat amp)
|
||||
void CCActionInterval::setAmplitudeRate(CCFloat amp)
|
||||
{
|
||||
CC_UNUSED_PARAM(amp);
|
||||
// Abstract class needs implementation
|
||||
CCAssert(0, "");
|
||||
}
|
||||
|
||||
CGFloat CCActionInterval::getAmplitudeRate(void)
|
||||
CCFloat CCActionInterval::getAmplitudeRate(void)
|
||||
{
|
||||
// Abstract class needs implementation
|
||||
CCAssert(0, "");
|
||||
|
|
|
@ -801,7 +801,7 @@ namespace cocos2d
|
|||
{
|
||||
ccQuad3 coords = originalTile(ccg(i, j));
|
||||
|
||||
coords.bl.z = (sinf(time * (CGFloat)M_PI *m_nWaves * 2 +
|
||||
coords.bl.z = (sinf(time * (CCFloat)M_PI *m_nWaves * 2 +
|
||||
(coords.bl.y+coords.bl.x) * .01f) * m_fAmplitude * m_fAmplitudeRate );
|
||||
coords.br.z = coords.bl.z;
|
||||
coords.tl.z = coords.bl.z;
|
||||
|
@ -872,8 +872,8 @@ namespace cocos2d
|
|||
{
|
||||
int i, j;
|
||||
|
||||
float sinz = (sinf((CGFloat)M_PI * time * m_nJumps * 2) * m_fAmplitude * m_fAmplitudeRate );
|
||||
float sinz2 = (sinf((CGFloat)M_PI * (time * m_nJumps * 2 + 1)) * m_fAmplitude * m_fAmplitudeRate );
|
||||
float sinz = (sinf((CCFloat)M_PI * time * m_nJumps * 2) * m_fAmplitude * m_fAmplitudeRate );
|
||||
float sinz2 = (sinf((CCFloat)M_PI * (time * m_nJumps * 2 + 1)) * m_fAmplitude * m_fAmplitudeRate );
|
||||
|
||||
for( i = 0; i < m_sGridSize.x; i++ )
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace std;
|
|||
|
||||
namespace cocos2d {
|
||||
|
||||
CCAffineTransform __CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty)
|
||||
CCAffineTransform __CCAffineTransformMake(CCFloat a, CCFloat b, CCFloat c, CCFloat d, CCFloat tx, CCFloat ty)
|
||||
{
|
||||
CCAffineTransform t;
|
||||
t.a = a; t.b = b; t.c = c; t.d = d; t.tx = tx; t.ty = ty;
|
||||
|
@ -40,16 +40,16 @@ CCAffineTransform __CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFlo
|
|||
CCPoint __CCPointApplyAffineTransform(const CCPoint& point, const CCAffineTransform& t)
|
||||
{
|
||||
CCPoint p;
|
||||
p.x = (CGFloat)((double)t.a * point.x + (double)t.c * point.y + t.tx);
|
||||
p.y = (CGFloat)((double)t.b * point.x + (double)t.d * point.y + t.ty);
|
||||
p.x = (CCFloat)((double)t.a * point.x + (double)t.c * point.y + t.tx);
|
||||
p.y = (CCFloat)((double)t.b * point.x + (double)t.d * point.y + t.ty);
|
||||
return p;
|
||||
}
|
||||
|
||||
CCSize __CCSizeApplyAffineTransform(const CCSize& size, const CCAffineTransform& t)
|
||||
{
|
||||
CCSize s;
|
||||
s.width = (CGFloat)((double)t.a * size.width + (double)t.c * size.height);
|
||||
s.height = (CGFloat)((double)t.b * size.width + (double)t.d * size.height);
|
||||
s.width = (CCFloat)((double)t.a * size.width + (double)t.c * size.height);
|
||||
s.height = (CCFloat)((double)t.b * size.width + (double)t.d * size.height);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -64,20 +64,20 @@ extern const CCAffineTransform CCAffineTransformIdentity = CCAffineTransformMake
|
|||
|
||||
CCRect CCRectApplyAffineTransform(const CCRect& rect, const CCAffineTransform& anAffineTransform)
|
||||
{
|
||||
CGFloat top = CCRect::CCRectGetMinY(rect);
|
||||
CGFloat left = CCRect::CCRectGetMinX(rect);
|
||||
CGFloat right = CCRect::CCRectGetMaxX(rect);
|
||||
CGFloat bottom = CCRect::CCRectGetMaxY(rect);
|
||||
CCFloat top = CCRect::CCRectGetMinY(rect);
|
||||
CCFloat left = CCRect::CCRectGetMinX(rect);
|
||||
CCFloat right = CCRect::CCRectGetMaxX(rect);
|
||||
CCFloat bottom = CCRect::CCRectGetMaxY(rect);
|
||||
|
||||
CCPoint topLeft = CCPointApplyAffineTransform(CCPointMake(left, top), anAffineTransform);
|
||||
CCPoint topRight = CCPointApplyAffineTransform(CCPointMake(right, top), anAffineTransform);
|
||||
CCPoint bottomLeft = CCPointApplyAffineTransform(CCPointMake(left, bottom), anAffineTransform);
|
||||
CCPoint bottomRight = CCPointApplyAffineTransform(CCPointMake(right, bottom), anAffineTransform);
|
||||
|
||||
CGFloat minX = min(min(topLeft.x, topRight.x), min(bottomLeft.x, bottomRight.x));
|
||||
CGFloat maxX = max(max(topLeft.x, topRight.x), max(bottomLeft.x, bottomRight.x));
|
||||
CGFloat minY = min(min(topLeft.y, topRight.y), min(bottomLeft.y, bottomRight.y));
|
||||
CGFloat maxY = max(max(topLeft.y, topRight.y), max(bottomLeft.y, bottomRight.y));
|
||||
CCFloat minX = min(min(topLeft.x, topRight.x), min(bottomLeft.x, bottomRight.x));
|
||||
CCFloat maxX = max(max(topLeft.x, topRight.x), max(bottomLeft.x, bottomRight.x));
|
||||
CCFloat minY = min(min(topLeft.y, topRight.y), min(bottomLeft.y, bottomRight.y));
|
||||
CCFloat maxY = max(max(topLeft.y, topRight.y), max(bottomLeft.y, bottomRight.y));
|
||||
|
||||
return CCRectMake(minX, minY, (maxX - minX), (maxY - minY));
|
||||
}
|
||||
|
@ -87,12 +87,12 @@ CCAffineTransform CCAffineTransformTranslate(const CCAffineTransform& t, float t
|
|||
return __CCAffineTransformMake(t.a, t.b, t.c, t.d, t.tx + t.a * tx + t.c * ty, t.ty + t.b * tx + t.d * ty);
|
||||
}
|
||||
|
||||
CCAffineTransform CCAffineTransformScale(const CCAffineTransform& t, CGFloat sx, CGFloat sy)
|
||||
CCAffineTransform CCAffineTransformScale(const CCAffineTransform& t, CCFloat sx, CCFloat sy)
|
||||
{
|
||||
return __CCAffineTransformMake(t.a * sx, t.b * sx, t.c * sy, t.d * sy, t.tx, t.ty);
|
||||
}
|
||||
|
||||
CCAffineTransform CCAffineTransformRotate(const CCAffineTransform& t, CGFloat anAngle)
|
||||
CCAffineTransform CCAffineTransformRotate(const CCAffineTransform& t, CCFloat anAngle)
|
||||
{
|
||||
float fSin = sin(anAngle);
|
||||
float fCos = cos(anAngle);
|
||||
|
|
|
@ -92,32 +92,32 @@ bool CCRect::CCRectEqualToRect(const CCRect& rect1, const CCRect& rect2)
|
|||
&& CCSize::CCSizeEqualToSize(rect1.size, rect2.size));
|
||||
}
|
||||
|
||||
CGFloat CCRect::CCRectGetMaxX(const CCRect& rect)
|
||||
CCFloat CCRect::CCRectGetMaxX(const CCRect& rect)
|
||||
{
|
||||
return rect.origin.x + rect.size.width;
|
||||
}
|
||||
|
||||
CGFloat CCRect::CCRectGetMidX(const CCRect& rect)
|
||||
CCFloat CCRect::CCRectGetMidX(const CCRect& rect)
|
||||
{
|
||||
return (float)(rect.origin.x + rect.size.width / 2.0);
|
||||
}
|
||||
|
||||
CGFloat CCRect::CCRectGetMinX(const CCRect& rect)
|
||||
CCFloat CCRect::CCRectGetMinX(const CCRect& rect)
|
||||
{
|
||||
return rect.origin.x;
|
||||
}
|
||||
|
||||
CGFloat CCRect::CCRectGetMaxY(const CCRect& rect)
|
||||
CCFloat CCRect::CCRectGetMaxY(const CCRect& rect)
|
||||
{
|
||||
return rect.origin.y + rect.size.height;
|
||||
}
|
||||
|
||||
CGFloat CCRect::CCRectGetMidY(const CCRect& rect)
|
||||
CCFloat CCRect::CCRectGetMidY(const CCRect& rect)
|
||||
{
|
||||
return (float)(rect.origin.y + rect.size.height / 2.0);
|
||||
}
|
||||
|
||||
CGFloat CCRect::CCRectGetMinY(const CCRect& rect)
|
||||
CCFloat CCRect::CCRectGetMinY(const CCRect& rect)
|
||||
{
|
||||
return rect.origin.y;
|
||||
}
|
||||
|
|
|
@ -77,8 +77,8 @@ public:
|
|||
|
||||
public:
|
||||
//extension in CCGridAction
|
||||
void setAmplitudeRate(CGFloat amp);
|
||||
CGFloat getAmplitudeRate(void);
|
||||
void setAmplitudeRate(CCFloat amp);
|
||||
CCFloat getAmplitudeRate(void);
|
||||
|
||||
protected:
|
||||
ccTime m_elapsed;
|
||||
|
|
|
@ -31,11 +31,11 @@ THE SOFTWARE.
|
|||
namespace cocos2d {
|
||||
|
||||
struct CCAffineTransform {
|
||||
CGFloat a, b, c, d;
|
||||
CGFloat tx, ty;
|
||||
CCFloat a, b, c, d;
|
||||
CCFloat tx, ty;
|
||||
};
|
||||
|
||||
CC_DLL CCAffineTransform __CCAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty);
|
||||
CC_DLL CCAffineTransform __CCAffineTransformMake(CCFloat a, CCFloat b, CCFloat c, CCFloat d, CCFloat tx, CCFloat ty);
|
||||
#define CCAffineTransformMake __CCAffineTransformMake
|
||||
|
||||
CC_DLL CCPoint __CCPointApplyAffineTransform(const CCPoint& point, const CCAffineTransform& t);
|
||||
|
@ -48,8 +48,8 @@ CC_DLL CCAffineTransform CCAffineTransformMakeIdentity();
|
|||
CC_DLL CCRect CCRectApplyAffineTransform(const CCRect& rect, const CCAffineTransform& anAffineTransform);
|
||||
|
||||
CC_DLL CCAffineTransform CCAffineTransformTranslate(const CCAffineTransform& t, float tx, float ty);
|
||||
CC_DLL CCAffineTransform CCAffineTransformRotate(const CCAffineTransform& aTransform, CGFloat anAngle);
|
||||
CC_DLL CCAffineTransform CCAffineTransformScale(const CCAffineTransform& t, CGFloat sx, CGFloat sy);
|
||||
CC_DLL CCAffineTransform CCAffineTransformRotate(const CCAffineTransform& aTransform, CCFloat anAngle);
|
||||
CC_DLL CCAffineTransform CCAffineTransformScale(const CCAffineTransform& t, CCFloat sx, CCFloat sy);
|
||||
CC_DLL CCAffineTransform CCAffineTransformConcat(const CCAffineTransform& t1, const CCAffineTransform& t2);
|
||||
CC_DLL bool CCAffineTransformEqualToTransform(const CCAffineTransform& t1, const CCAffineTransform& t2);
|
||||
CC_DLL CCAffineTransform CCAffineTransformInvert(const CCAffineTransform& t);
|
||||
|
|
|
@ -358,8 +358,8 @@ public:
|
|||
Only available when compiled using SDK >= 4.0.
|
||||
@since v0.99.4
|
||||
*/
|
||||
void setContentScaleFactor(CGFloat scaleFactor);
|
||||
CGFloat getContentScaleFactor(void);
|
||||
void setContentScaleFactor(CCFloat scaleFactor);
|
||||
CCFloat getContentScaleFactor(void);
|
||||
|
||||
/** Will enable Retina Display on devices that supports it.
|
||||
It will enable Retina Display on iPhone4 and iPod Touch 4.
|
||||
|
@ -488,7 +488,7 @@ protected:
|
|||
CCSize m_obWinSizeInPixels;
|
||||
|
||||
/* content scale factor */
|
||||
CGFloat m_fContentScaleFactor;
|
||||
CCFloat m_fContentScaleFactor;
|
||||
|
||||
/* store the fps string */
|
||||
char *m_pszFPS;
|
||||
|
|
|
@ -22,14 +22,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __COCOS_CGGEMETRY_H__
|
||||
#define __COCOS_CGGEMETRY_H__
|
||||
#ifndef __CCGEMETRY_H__
|
||||
#define __CCGEMETRY_H__
|
||||
|
||||
#include "CCCommon.h"
|
||||
|
||||
namespace cocos2d {
|
||||
NS_CC_BEGIN
|
||||
|
||||
typedef float CGFloat;
|
||||
typedef float CCFloat;
|
||||
|
||||
class CC_DLL CCPoint
|
||||
{
|
||||
|
@ -72,22 +72,22 @@ public:
|
|||
|
||||
public:
|
||||
//! return the leftmost x-value of 'rect'
|
||||
static CGFloat CCRectGetMinX(const CCRect& rect);
|
||||
static CCFloat CCRectGetMinX(const CCRect& rect);
|
||||
|
||||
//! return the rightmost x-value of 'rect'
|
||||
static CGFloat CCRectGetMaxX(const CCRect& rect);
|
||||
static CCFloat CCRectGetMaxX(const CCRect& rect);
|
||||
|
||||
//! return the midpoint x-value of 'rect'
|
||||
static CGFloat CCRectGetMidX(const CCRect& rect);
|
||||
static CCFloat CCRectGetMidX(const CCRect& rect);
|
||||
|
||||
//! Return the bottommost y-value of `rect'
|
||||
static CGFloat CCRectGetMinY(const CCRect& rect);
|
||||
static CCFloat CCRectGetMinY(const CCRect& rect);
|
||||
|
||||
//! Return the topmost y-value of `rect'
|
||||
static CGFloat CCRectGetMaxY(const CCRect& rect);
|
||||
static CCFloat CCRectGetMaxY(const CCRect& rect);
|
||||
|
||||
//! Return the midpoint y-value of `rect'
|
||||
static CGFloat CCRectGetMidY(const CCRect& rect);
|
||||
static CCFloat CCRectGetMidY(const CCRect& rect);
|
||||
|
||||
static bool CCRectEqualToRect(const CCRect& rect1, const CCRect& rect2);
|
||||
|
||||
|
@ -110,6 +110,6 @@ const CCSize CCSizeZero = CCSizeMake(0,0);
|
|||
/* The "zero" rectangle -- equivalent to CCRectMake(0, 0, 0, 0). */
|
||||
const CCRect CCRectZero = CCRectMake(0,0,0,0);
|
||||
|
||||
}//namespace cocos2d
|
||||
NS_CC_END
|
||||
|
||||
#endif // __COCOS_CGGEMETRY_H__
|
||||
#endif // __CCGEMETRY_H__
|
||||
|
|
|
@ -89,7 +89,7 @@ ccpSub(const CCPoint& v1, const CCPoint& v2)
|
|||
@since v0.7.2
|
||||
*/
|
||||
static inline CCPoint
|
||||
ccpMult(const CCPoint& v, const CGFloat s)
|
||||
ccpMult(const CCPoint& v, const CCFloat s)
|
||||
{
|
||||
return ccp(v.x*s, v.y*s);
|
||||
}
|
||||
|
@ -105,20 +105,20 @@ ccpMidpoint(const CCPoint& v1, const CCPoint& v2)
|
|||
}
|
||||
|
||||
/** Calculates dot product of two points.
|
||||
@return CGFloat
|
||||
@return CCFloat
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CGFloat
|
||||
static inline CCFloat
|
||||
ccpDot(const CCPoint& v1, const CCPoint& v2)
|
||||
{
|
||||
return v1.x*v2.x + v1.y*v2.y;
|
||||
}
|
||||
|
||||
/** Calculates cross product of two points.
|
||||
@return CGFloat
|
||||
@return CCFloat
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CGFloat
|
||||
static inline CCFloat
|
||||
ccpCross(const CCPoint& v1, const CCPoint& v2)
|
||||
{
|
||||
return v1.x*v2.y - v1.y*v2.x;
|
||||
|
@ -175,10 +175,10 @@ ccpUnrotate(const CCPoint& v1, const CCPoint& v2)
|
|||
}
|
||||
|
||||
/** Calculates the square length of a CCPoint (not calling sqrt() )
|
||||
@return CGFloat
|
||||
@return CCFloat
|
||||
@since v0.7.2
|
||||
*/
|
||||
static inline CGFloat
|
||||
static inline CCFloat
|
||||
ccpLengthSQ(const CCPoint& v)
|
||||
{
|
||||
return ccpDot(v, v);
|
||||
|
@ -186,10 +186,10 @@ ccpLengthSQ(const CCPoint& v)
|
|||
|
||||
|
||||
/** Calculates the square distance between two points (not calling sqrt() )
|
||||
@return CGFloat
|
||||
@return CCFloat
|
||||
@since v1.1
|
||||
*/
|
||||
static inline CGFloat
|
||||
static inline CCFloat
|
||||
ccpDistanceSQ(const CCPoint p1, const CCPoint p2)
|
||||
{
|
||||
return ccpLengthSQ(ccpSub(p1, p2));
|
||||
|
@ -197,16 +197,16 @@ ccpDistanceSQ(const CCPoint p1, const CCPoint p2)
|
|||
|
||||
|
||||
/** Calculates distance between point an origin
|
||||
@return CGFloat
|
||||
@return CCFloat
|
||||
@since v0.7.2
|
||||
*/
|
||||
CGFloat CC_DLL ccpLength(const CCPoint& v);
|
||||
CCFloat CC_DLL ccpLength(const CCPoint& v);
|
||||
|
||||
/** Calculates the distance between two points
|
||||
@return CGFloat
|
||||
@return CCFloat
|
||||
@since v0.7.2
|
||||
*/
|
||||
CGFloat CC_DLL ccpDistance(const CCPoint& v1, const CCPoint& v2);
|
||||
CCFloat CC_DLL ccpDistance(const CCPoint& v1, const CCPoint& v2);
|
||||
|
||||
/** Returns point multiplied to a length of 1.
|
||||
@return CCPoint
|
||||
|
@ -218,13 +218,13 @@ CCPoint CC_DLL ccpNormalize(const CCPoint& v);
|
|||
@return CCPoint
|
||||
@since v0.7.2
|
||||
*/
|
||||
CCPoint CC_DLL ccpForAngle(const CGFloat a);
|
||||
CCPoint CC_DLL ccpForAngle(const CCFloat a);
|
||||
|
||||
/** Converts a vector to radians.
|
||||
@return CGFloat
|
||||
@return CCFloat
|
||||
@since v0.7.2
|
||||
*/
|
||||
CGFloat CC_DLL ccpToAngle(const CCPoint& v);
|
||||
CCFloat CC_DLL ccpToAngle(const CCPoint& v);
|
||||
|
||||
|
||||
/** Clamp a value between from and to.
|
||||
|
|
|
@ -31,13 +31,13 @@ namespace cocos2d {
|
|||
|
||||
#define kCCPointEpsilon FLT_EPSILON
|
||||
|
||||
CGFloat
|
||||
CCFloat
|
||||
ccpLength(const CCPoint& v)
|
||||
{
|
||||
return sqrtf(ccpLengthSQ(v));
|
||||
}
|
||||
|
||||
CGFloat
|
||||
CCFloat
|
||||
ccpDistance(const CCPoint& v1, const CCPoint& v2)
|
||||
{
|
||||
return ccpLength(ccpSub(v1, v2));
|
||||
|
@ -50,12 +50,12 @@ ccpNormalize(const CCPoint& v)
|
|||
}
|
||||
|
||||
CCPoint
|
||||
ccpForAngle(const CGFloat a)
|
||||
ccpForAngle(const CCFloat a)
|
||||
{
|
||||
return ccp(cosf(a), sinf(a));
|
||||
}
|
||||
|
||||
CGFloat
|
||||
CCFloat
|
||||
ccpToAngle(const CCPoint& v)
|
||||
{
|
||||
return atan2f(v.y, v.x);
|
||||
|
|
|
@ -1 +1 @@
|
|||
0b0b1c3e2c082dbaf555418c3d75baf3da8e1eaa
|
||||
2d74827a957b6bcc79f46daf5379ed30ac406da7
|
|
@ -43,8 +43,8 @@ bool ChipmunkPhysicsSprite::isDirty(void)
|
|||
|
||||
CCAffineTransform ChipmunkPhysicsSprite::nodeToParentTransform(void)
|
||||
{
|
||||
CGFloat x = body_->p.x;
|
||||
CGFloat y = body_->p.y;
|
||||
CCFloat x = body_->p.x;
|
||||
CCFloat y = body_->p.y;
|
||||
|
||||
if ( !getIsRelativeAnchorPoint() ) {
|
||||
x += m_tAnchorPointInPoints.x;
|
||||
|
@ -52,8 +52,8 @@ CCAffineTransform ChipmunkPhysicsSprite::nodeToParentTransform(void)
|
|||
}
|
||||
|
||||
// Make matrix
|
||||
CGFloat c = body_->rot.x;
|
||||
CGFloat s = body_->rot.y;
|
||||
CCFloat c = body_->rot.x;
|
||||
CCFloat s = body_->rot.y;
|
||||
|
||||
if( ! CCPoint::CCPointEqualToPoint(m_tAnchorPointInPoints, CCPointZero) ){
|
||||
x += c*-m_tAnchorPointInPoints.x + -s*-m_tAnchorPointInPoints.y;
|
||||
|
@ -152,7 +152,7 @@ void ChipmunkAccelTouchTestLayer::update(ccTime delta)
|
|||
{
|
||||
// Should use a fixed size step based on the animation interval.
|
||||
int steps = 2;
|
||||
CGFloat dt = CCDirector::sharedDirector()->getAnimationInterval()/(CGFloat)steps;
|
||||
CCFloat dt = CCDirector::sharedDirector()->getAnimationInterval()/(CCFloat)steps;
|
||||
|
||||
for(int i=0; i<steps; i++){
|
||||
cpSpaceStep(space_, dt);
|
||||
|
|
Loading…
Reference in New Issue