cocos2d-x  2.2.3-gd2.113-rev1ec524e
Loading...
Searching...
No Matches
Data Structures

NA NA. More...

Files

file  CCVertex.h
 

Namespaces

namespace  cocos2d
 

Classes

class  CCArray
 NA. More...
 
class  CCBool
 
class  CCDataVisitor
 Visitor that helps to perform action that depends on polymorphic object type. More...
 
class  CCPrettyPrinter
 NA NA. More...
 
class  CCDictElement
 CCDictElement is used for traversing CCDictionary. More...
 
class  CCDictionary
 CCDictionary is a class like NSDictionary in Obj-C . More...
 
class  CCDouble
 
class  CCFloat
 
class  CCPoint
 NA. More...
 
class  CCSize
 NA. More...
 
class  CCRect
 NA. More...
 
class  CCInteger
 
class  CCSet
 
class  CCString
 
class  CCZone
 NA NA. More...
 

Macros

#define CCARRAY_FOREACH(__array__, __object__)
 A convenience macro to iterate over a CCArray using. More...
 
#define CCARRAY_FOREACH_REVERSE(__array__, __object__)
 
#define CCARRAY_VERIFY_TYPE(__array__, __type__)   void(0)
 
#define arrayMakeObjectsPerformSelector(pArray, func, elementType)
 
#define arrayMakeObjectsPerformSelectorWithObject(pArray, func, pObject, elementType)
 
#define CCDICT_FOREACH(__dict__, __el__)
 The macro for traversing dictionary. More...
 
#define CCPointMake(x, y)   CCPoint((float)(x), (float)(y))
 
#define CCSizeMake(width, height)   CCSize((float)(width), (float)(height))
 
#define CCRectMake(x, y, width, height)   CCRect((float)(x), (float)(y), (float)(width), (float)(height))
 
#define CCStringMake(str)   CCString::create(str)
 
#define ccs   CCStringMake
 
#define ccp(__X__, __Y__)   cocos2d::CCPointMake((float)(__X__), (float)(__Y__))
 Helper macro that creates a CCPoint. More...
 

Typedefs

typedef std::set< CCObject * >::iterator CCSetIterator
 

Functions

CCRect CC_DLL CCRectFromString (const char *pszContent)
 Returns a Core Graphics rectangle structure corresponding to the data in a given string. More...
 
CCPoint CC_DLL CCPointFromString (const char *pszContent)
 Returns a Core Graphics point structure corresponding to the data in a given string. More...
 
CCSize CC_DLL CCSizeFromString (const char *pszContent)
 Returns a Core Graphics size structure corresponding to the data in a given string. More...
 
float CC_DLL ccpLength (const CCPoint &v)
 Calculates distance between point an origin. More...
 
float CC_DLL ccpDistance (const CCPoint &v1, const CCPoint &v2)
 Calculates the distance between two points. More...
 
CCPoint CC_DLL ccpNormalize (const CCPoint &v)
 Returns point multiplied to a length of 1. More...
 
CCPoint CC_DLL ccpForAngle (const float a)
 Converts radians to a normalized vector. More...
 
float CC_DLL ccpToAngle (const CCPoint &v)
 Converts a vector to radians. More...
 
float CC_DLL clampf (float value, float min_inclusive, float max_inclusive)
 Clamp a value between from and to. More...
 
CCPoint CC_DLL ccpClamp (const CCPoint &p, const CCPoint &from, const CCPoint &to)
 Clamp a point between from and to. More...
 
CCPoint CC_DLL ccpFromSize (const CCSize &s)
 Quickly convert CCSize to a CCPoint. More...
 
CCPoint CC_DLL ccpCompOp (const CCPoint &p, float(*opFunc)(float))
 Run a math operation function on each point component absf, fllorf, ceilf, roundf any function that has the signature: float func(float); For example: let's try to take the floor of x,y ccpCompOp(p,floorf);. More...
 
CCPoint CC_DLL ccpLerp (const CCPoint &a, const CCPoint &b, float alpha)
 Linear Interpolation between two points a and b. More...
 
bool CC_DLL ccpFuzzyEqual (const CCPoint &a, const CCPoint &b, float variance)
 
CCPoint CC_DLL ccpCompMult (const CCPoint &a, const CCPoint &b)
 Multiplies a and b components, a.x*b.x, a.y*b.y. More...
 
float CC_DLL ccpAngleSigned (const CCPoint &a, const CCPoint &b)
 
float CC_DLL ccpAngle (const CCPoint &a, const CCPoint &b)
 
CCPoint CC_DLL ccpRotateByAngle (const CCPoint &v, const CCPoint &pivot, float angle)
 Rotates a point counter clockwise by the angle around a pivot. More...
 
bool CC_DLL ccpLineIntersect (const CCPoint &p1, const CCPoint &p2, const CCPoint &p3, const CCPoint &p4, float *s, float *t)
 A general line-line intersection test. More...
 
bool CC_DLL ccpSegmentIntersect (const CCPoint &A, const CCPoint &B, const CCPoint &C, const CCPoint &D)
 
CCPoint CC_DLL ccpIntersectPoint (const CCPoint &A, const CCPoint &B, const CCPoint &C, const CCPoint &D)
 
void CC_DLL ccVertexLineToPolygon (CCPoint *points, float stroke, ccVertex2F *vertices, unsigned int offset, unsigned int nuPoints)
 converts a line to a polygon More...
 
bool CC_DLL ccVertexLineIntersect (float Ax, float Ay, float Bx, float By, float Cx, float Cy, float Dx, float Dy, float *T)
 returns whether or not the line intersects More...
 

Variables

class CC_DLL CCSize
 
const CCPoint CCPointZero = CCPoint((float)( 0 ), (float)( 0 ))
 
const CCSize CCSizeZero = CCSize((float)( 0 ), (float)( 0 ))
 
const CCRect CCRectZero = CCRect((float)( 0 ), (float)( 0 ), (float)( 0 ), (float)( 0 ))
 

Detailed Description

NA NA.

@ js NA

NA.

Macro Definition Documentation

◆ arrayMakeObjectsPerformSelector

#define arrayMakeObjectsPerformSelector (   pArray,
  func,
  elementType 
)
Value:
do { \
if(pArray && pArray->count() > 0) \
{ \
CCObject* child; \
CCARRAY_FOREACH(pArray, child) \
{ \
elementType pNode = (elementType) child; \
if(pNode) \
{ \
pNode->func(); \
} \
} \
} \
} \
while(false)

◆ arrayMakeObjectsPerformSelectorWithObject

#define arrayMakeObjectsPerformSelectorWithObject (   pArray,
  func,
  pObject,
  elementType 
)
Value:
do { \
if(pArray && pArray->count() > 0) \
{ \
CCObject* child = NULL; \
CCARRAY_FOREACH(pArray, child) \
{ \
elementType pNode = (elementType) child; \
if(pNode) \
{ \
pNode->func(pObject); \
} \
} \
} \
} \
while(false)
#define NULL
Definition: CCPlatformDefine.h:30

◆ CCARRAY_FOREACH

#define CCARRAY_FOREACH (   __array__,
  __object__ 
)
Value:
if ((__array__) && (__array__)->data->num > 0) \
for(CCObject** __arr__ = (__array__)->data->arr, **__end__ = (__array__)->data->arr + (__array__)->data->num-1; \
__arr__ <= __end__ && (((__object__) = *__arr__) != NULL/* || true*/); \
__arr__++)

A convenience macro to iterate over a CCArray using.

It is faster than the "fast enumeration" interface.

Since
v0.99.4

◆ CCARRAY_FOREACH_REVERSE

#define CCARRAY_FOREACH_REVERSE (   __array__,
  __object__ 
)
Value:
if ((__array__) && (__array__)->data->num > 0) \
for(CCObject** __arr__ = (__array__)->data->arr + (__array__)->data->num-1, **__end__ = (__array__)->data->arr; \
__arr__ >= __end__ && (((__object__) = *__arr__) != NULL/* || true*/); \
__arr__--)

◆ CCARRAY_VERIFY_TYPE

#define CCARRAY_VERIFY_TYPE (   __array__,
  __type__ 
)    void(0)

◆ CCDICT_FOREACH

#define CCDICT_FOREACH (   __dict__,
  __el__ 
)
Value:
CCDictElement* pTmp##__dict__##__el__ = NULL; \
if (__dict__) \
HASH_ITER(hh, (__dict__)->m_pElements, __el__, pTmp##__dict__##__el__)

The macro for traversing dictionary.

Note
It's faster than getting all keys and traversing keys to get objects by objectForKey. It's also safe to remove elements while traversing.

◆ ccp

#define ccp (   __X__,
  __Y__ 
)    cocos2d::CCPointMake((float)(__X__), (float)(__Y__))

Helper macro that creates a CCPoint.

Returns
CCPoint
Since
v0.7.2

◆ CCPointMake

#define CCPointMake (   x,
 
)    CCPoint((float)(x), (float)(y))

◆ CCRectMake

#define CCRectMake (   x,
  y,
  width,
  height 
)    CCRect((float)(x), (float)(y), (float)(width), (float)(height))

◆ ccs

#define ccs   CCStringMake

◆ CCSizeMake

#define CCSizeMake (   width,
  height 
)    CCSize((float)(width), (float)(height))

◆ CCStringMake

#define CCStringMake (   str)    CCString::create(str)

Typedef Documentation

◆ CCSetIterator

typedef std::set<CCObject*>::iterator CCSetIterator

Function Documentation

◆ ccpAngle()

float CC_DLL ccpAngle ( const CCPoint a,
const CCPoint b 
)
Returns
the angle in radians between two vector directions
Since
v0.99.1

◆ ccpAngleSigned()

float CC_DLL ccpAngleSigned ( const CCPoint a,
const CCPoint b 
)
Returns
the signed angle in radians between two vector directions
Since
v0.99.1

◆ ccpClamp()

CCPoint CC_DLL ccpClamp ( const CCPoint p,
const CCPoint from,
const CCPoint to 
)

Clamp a point between from and to.

Since
v0.99.1

◆ ccpCompMult()

CCPoint CC_DLL ccpCompMult ( const CCPoint a,
const CCPoint b 
)

Multiplies a and b components, a.x*b.x, a.y*b.y.

Returns
a component-wise multiplication
Since
v0.99.1

◆ ccpCompOp()

CCPoint CC_DLL ccpCompOp ( const CCPoint p,
float(*)(float)  opFunc 
)

Run a math operation function on each point component absf, fllorf, ceilf, roundf any function that has the signature: float func(float); For example: let's try to take the floor of x,y ccpCompOp(p,floorf);.

Since
v0.99.1

◆ ccpDistance()

float CC_DLL ccpDistance ( const CCPoint v1,
const CCPoint v2 
)

Calculates the distance between two points.

Returns
float
Since
v0.7.2

◆ ccpForAngle()

CCPoint CC_DLL ccpForAngle ( const float  a)

Converts radians to a normalized vector.

Returns
CCPoint
Since
v0.7.2

◆ ccpFromSize()

CCPoint CC_DLL ccpFromSize ( const CCSize s)

Quickly convert CCSize to a CCPoint.

Since
v0.99.1

◆ ccpFuzzyEqual()

bool CC_DLL ccpFuzzyEqual ( const CCPoint a,
const CCPoint b,
float  variance 
)
Returns
if points have fuzzy equality which means equal with some degree of variance.
Since
v0.99.1

◆ ccpIntersectPoint()

CCPoint CC_DLL ccpIntersectPoint ( const CCPoint A,
const CCPoint B,
const CCPoint C,
const CCPoint D 
)

◆ ccpLength()

float CC_DLL ccpLength ( const CCPoint v)

Calculates distance between point an origin.

Returns
float
Since
v0.7.2

◆ ccpLerp()

CCPoint CC_DLL ccpLerp ( const CCPoint a,
const CCPoint b,
float  alpha 
)

Linear Interpolation between two points a and b.

Returns
alpha == 0 ? a alpha == 1 ? b otherwise a value between a..b
Since
v0.99.1

◆ ccpLineIntersect()

bool CC_DLL ccpLineIntersect ( const CCPoint p1,
const CCPoint p2,
const CCPoint p3,
const CCPoint p4,
float *  s,
float *  t 
)

A general line-line intersection test.

Parameters
p1is the startpoint for the first line P1 = (p1 - p2)
p2is the endpoint for the first line P1 = (p1 - p2)
p3is the startpoint for the second line P2 = (p3 - p4)
p4is the endpoint for the second line P2 = (p3 - p4)
sis the range for a hitpoint in P1 (pa = p1 + s*(p2 - p1))
tis the range for a hitpoint in P3 (pa = p2 + t*(p4 - p3))
Returns
bool indicating successful intersection of a line note that to truly test intersection for segments we have to make sure that s & t lie within [0..1] and for rays, make sure s & t > 0 the hit point is p3 + t * (p4 - p3); the hit point also is p1 + s * (p2 - p1);
Since
v0.99.1

◆ ccpNormalize()

CCPoint CC_DLL ccpNormalize ( const CCPoint v)

Returns point multiplied to a length of 1.

Returns
CCPoint
Since
v0.7.2

◆ CCPointFromString()

CCPoint CC_DLL CCPointFromString ( const char *  pszContent)

Returns a Core Graphics point structure corresponding to the data in a given string.

Parameters
pszContentA string object whose contents are of the form "{x,y}", where x is the x coordinate and y is the y coordinate. The x and y values can represent integer or float values. An example of a valid string is "{3.0,2.5}". The string is not localized, so items are always separated with a comma.
Returns
A Core Graphics structure that represents a point. If the string is not well-formed, the function returns CCPointZero.

◆ ccpRotateByAngle()

CCPoint CC_DLL ccpRotateByAngle ( const CCPoint v,
const CCPoint pivot,
float  angle 
)

Rotates a point counter clockwise by the angle around a pivot.

Parameters
vis the point to rotate
pivotis the pivot, naturally
angleis the angle of rotation cw in radians
Returns
the rotated point
Since
v0.99.1

◆ ccpSegmentIntersect()

bool CC_DLL ccpSegmentIntersect ( const CCPoint A,
const CCPoint B,
const CCPoint C,
const CCPoint D 
)

◆ ccpToAngle()

float CC_DLL ccpToAngle ( const CCPoint v)

Converts a vector to radians.

Returns
float
Since
v0.7.2

◆ CCRectFromString()

CCRect CC_DLL CCRectFromString ( const char *  pszContent)

Returns a Core Graphics rectangle structure corresponding to the data in a given string.

Parameters
pszContentA string object whose contents are of the form "{{x,y},{w, h}}", where x is the x coordinate, y is the y coordinate, w is the width, and h is the height. These components can represent integer or float values. An example of a valid string is "{{3,2},{4,5}}". The string is not localized, so items are always separated with a comma.
Returns
A Core Graphics structure that represents a rectangle. If the string is not well-formed, the function returns CCRectZero.

◆ CCSizeFromString()

CCSize CC_DLL CCSizeFromString ( const char *  pszContent)

Returns a Core Graphics size structure corresponding to the data in a given string.

Parameters
pszContentA string object whose contents are of the form "{w, h}", where w is the width and h is the height. The w and h values can be integer or float values. An example of a valid string is "{3.0,2.5}". The string is not localized, so items are always separated with a comma.
Returns
A Core Graphics structure that represents a size. If the string is not well-formed, the function returns CCSizeZero.

◆ ccVertexLineIntersect()

bool CC_DLL ccVertexLineIntersect ( float  Ax,
float  Ay,
float  Bx,
float  By,
float  Cx,
float  Cy,
float  Dx,
float  Dy,
float *  T 
)

returns whether or not the line intersects

◆ ccVertexLineToPolygon()

void CC_DLL ccVertexLineToPolygon ( CCPoint points,
float  stroke,
ccVertex2F vertices,
unsigned int  offset,
unsigned int  nuPoints 
)

converts a line to a polygon

◆ clampf()

float CC_DLL clampf ( float  value,
float  min_inclusive,
float  max_inclusive 
)

Clamp a value between from and to.

Since
v0.99.1

Variable Documentation

◆ CCPointZero

const CCPoint CCPointZero = CCPoint((float)( 0 ), (float)( 0 ))

◆ CCRectZero

const CCRect CCRectZero = CCRect((float)( 0 ), (float)( 0 ), (float)( 0 ), (float)( 0 ))

◆ CCSize

class CC_DLL CCSize

◆ CCSizeZero

const CCSize CCSizeZero = CCSize((float)( 0 ), (float)( 0 ))