Merge remote branch 'upstream/gles20' into gles20

This commit is contained in:
johnangel 2012-10-08 16:35:43 +02:00
commit ad7dacc281
609 changed files with 12493 additions and 10301 deletions

7
.gitignore vendored
View File

@ -74,3 +74,10 @@ Device-Release/
# Ignore vim swaps
*.swp
# Ignore config files in javascript bindings generator
tools/tojs/user.cfg
# ... userconf.ini generated if running from tools/tojs
tools/tojs/userconf.ini
# ... userconf.ini generated if running from tools/jenkins_scripts/mac/android/
tools/jenkins_scripts/mac/android/userconf.ini

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "tools/cxx-generator"]
path = tools/cxx-generator
url = git://github.com/funkaster/cxx-generator.git
[submodule "scripting/javascript/bindings/generated"]
path = scripting/javascript/bindings/generated
url = git://github.com/folecr/cocos2dx-autogen-bindings.git

16
AUTHORS
View File

@ -12,6 +12,22 @@ Developers:
Rolando Abarca
Javascript Binding and testjs
Horcruxes
fix the bug that CCArray::createWithContentsOfFile() may not read file data on iOS
Hu Kaiou
contribute the new version of libcurl to support both armv7 & armv7s on iOS
fix some memory leak
ByungChoi
modify linux makefiles to fix compiling errors
edbartley
update MSVS and MAC projects to use project-relative path
Weeds
use fontconfig to enhance font rendering on linux
Nat Weiss (iphonegamekit.com)
author of Mac port

View File

@ -1,3 +1,37 @@
cocos2d-2.0-x-2.0.3 @Sep.26 2012
[all platforms]
Bug #1452: change CCRGBAProtocol to public in order for actions like CCTintTo to have an affect on the CCScale9Sprite
Bug #1454: make javascript binding work together with lua binding and c++ codes
Bug #1464: fix a crash caused by CCLabelBMFont
Bug #1478: fix a bug that TMX parser causes tileset images not to be loaded
Bug #1479: fix a bug that CCNotificationCenter does not check whether the object is valid before post notification
Bug #1485: fix potential memory leak in CCNotificationObserver
Feature #1458: add CCTableView
Feature #1460: min/max allowed value for CCControlSlider
Feature #1470: update CCBReader to cocosbuilder v2.1 beta
Feature #1483: synchronize CCControlExtension to newest version
Refactor #1477: abstracts Lua and JS binding protocol, some bugs fixes in lua-binding, adding custom menu on win32 and mac for switching resolutions
[iOS]
Bug #1482: fix a bug that orientation is wrong on iOS 6 SDK
Bug #1453: fix a bug that CCGL.h includes wrong path of a header file
Bug #1484: fix a minor memory-logic error in EditBoxImplIOS.mm
Feature #1455: add Xcode template for cocos2dx-js
[android]
Refactor #1481: refactor android Java+JNI
[mac os]
Bug #1456: remove code signing from MAC TestCpp project
[linux]
[win32]
Feature #1457: Add vs2012 sln
Feature #1474: popup a warning dialog instead of crash directly when OpenGL version is too old to run 2dx
[js-binding]
Feature #1451: merge new js-binding codes
Refactor #1476: update location of spidermonkey-android makefile
[lua]
Refactor #1480: Update lua-binding for overloaded functions
[tools]
Feature #1404: add scripts for jenkins-ci
cocos2d-2.0-x-2.0.2 @Aug.30 2012
[all platforms]
Bug #1298: fix a logical error of CCSequence

View File

@ -40,7 +40,7 @@ static bool s_bI9100 = false;
/**********************************************************************************
* jni
**********************************************************************************/
#define CLASS_NAME "org/cocos2dx/lib/Cocos2dxActivity"
#define CLASS_NAME "org/cocos2dx/lib/Cocos2dxHelper"
#define METHOD_NAME "getDeviceModel"
typedef struct JniMethodInfo_

View File

@ -5,7 +5,7 @@
#define LOG_TAG "libSimpleAudioEngine"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#define CLASS_NAME "org/cocos2dx/lib/Cocos2dxActivity"
#define CLASS_NAME "org/cocos2dx/lib/Cocos2dxHelper"
typedef struct JniMethodInfo_
{

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2010 Steve Oldmeadow
http://www.cocos2d-x.org
@ -40,7 +40,7 @@ public:
virtual long getClassTypeInfo() = 0;
};
static unsigned int getHashCodeByString(const char *key)
static inline unsigned int getHashCodeByString(const char *key)
{
unsigned int len = strlen(key);
const char *end=key+len;

View File

@ -1,8 +1,8 @@
CC = gcc
CXX = g++
TARGET = libcocosdenshion.so
CCFLAGS = -Wall -g -O2 -fPIC
CXXFLAGS = -Wall -g -O2 -fPIC
CCFLAGS = -Wall -fPIC
CXXFLAGS = -Wall -fPIC
VISIBILITY =
LBITS := $(shell getconf LONG_BIT)
@ -32,17 +32,26 @@ SHAREDLIBS_DIR = ../third_party/fmod/api/lib
SHAREDLIBS = -L$(SHAREDLIBS_DIR) -lfmodex
endif
debug: CCFLAGS += -g3 -O0
debug: CXXFLAGS += -g3 -O0
debug: DEFINES += -DDEBUG
debug: $(TARGET)
release: CCFLAGS += -O3
release: CXXFLAGS += -O3
release: DEFINES += -DNDEBUG
release: $(TARGET)
####### Build rules
$(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -shared -o $(TARGET) $(SHAREDLIBS) $(STATICLIBS)
####### Compile
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
%.o: %.c
$(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
clean:
rm -f $(OBJECTS) $(TARGET) core

View File

@ -35,6 +35,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCpp", "samples\TestCpp\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestJavascript", "samples\TestJavascript\proj.win32\TestJavascript.vcproj", "{D0F06A44-A245-4D13-A498-0120C203B539}"
ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
@ -53,6 +54,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestLua", "samples\TestLua\
EndProjectSection
EndProject
Global
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
@ -106,7 +110,4 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
EndGlobal

View File

@ -19,6 +19,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCpp", "samples\TestCpp\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestJavascript", "samples\TestJavascript\proj.win32\TestJavascript.vcxproj", "{D0F06A44-A245-4D13-A498-0120C203B539}"
ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
EndProjectSection
EndProject

View File

@ -82,12 +82,12 @@ platform/android/CCApplication.cpp \
platform/android/CCCommon.cpp \
platform/android/CCFileUtils.cpp \
platform/android/CCImage.cpp \
platform/android/jni/EditBoxJni.cpp \
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp \
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp \
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp \
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp \
platform/android/jni/JniHelper.cpp \
platform/android/jni/IMEJni.cpp \
platform/android/jni/MessageJni.cpp \
platform/android/jni/SensorJni.cpp \
platform/android/jni/SystemInfoJni.cpp \
platform/android/jni/TouchesJni.cpp \
script_support/CCScriptSupport.cpp \
shaders/ccShaders.cpp \

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -58,7 +58,7 @@ using the camera.
- It doesn't work on batched nodes like CCSprite objects when they are parented to a CCSpriteBatchNode object.
- It is recommended to use it ONLY if you are going to create 3D effects. For 2D effecs, use the action CCFollow or position/scale/rotate.
- It is recommended to use it ONLY if you are going to create 3D effects. For 2D effects, use the action CCFollow or position/scale/rotate.
*/
class CC_DLL CCCamera : public CCObject

View File

@ -70,24 +70,23 @@ using namespace std;
unsigned int g_uNumberOfDraws = 0;
NS_CC_BEGIN
// XXX it shoul be a Director ivar. Move it there once support for multiple directors is added
// XXX it should be a Director ivar. Move it there once support for multiple directors is added
// singleton stuff
static CCDisplayLinkDirector s_SharedDirector;
static CCDisplayLinkDirector *s_SharedDirector = NULL;
#define kDefaultFPS 60 // 60 frames per second
extern const char* cocos2dVersion(void);
CCDirector* CCDirector::sharedDirector(void)
{
static bool s_bFirstUseDirector = true;
if (s_bFirstUseDirector)
if (!s_SharedDirector)
{
s_bFirstUseDirector = false;
s_SharedDirector.init();
s_SharedDirector = new CCDisplayLinkDirector();
s_SharedDirector->init();
}
return &s_SharedDirector;
return s_SharedDirector;
}
CCDirector::CCDirector(void)
@ -136,7 +135,7 @@ bool CCDirector::init(void)
m_pobOpenGLView = NULL;
m_fContentScaleFactor = 1;
m_fContentScaleFactor = 1.0f;
m_bIsContentScaleSupported = false;
// scheduler
@ -162,7 +161,7 @@ bool CCDirector::init(void)
CCDirector::~CCDirector(void)
{
CCLOG("cocos2d: deallocing %p", this);
CCLOG("cocos2d: deallocing CCDirector %p", this);
CC_SAFE_RELEASE(m_pFPSLabel);
CC_SAFE_RELEASE(m_pSPFLabel);
@ -185,6 +184,8 @@ CCDirector::~CCDirector(void)
CC_SAFE_DELETE(m_pLastUpdate);
// delete fps string
delete []m_pszFPS;
s_SharedDirector = NULL;
}
void CCDirector::setGLDefaultValues(void)
@ -200,7 +201,7 @@ void CCDirector::setGLDefaultValues(void)
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}
// Draw the SCene
// Draw the Scene
void CCDirector::drawScene(void)
{
// calculate "global" dt
@ -290,16 +291,13 @@ void CCDirector::calculateDeltaTime(void)
*m_pLastUpdate = now;
}
// m_pobOpenGLView
void CCDirector::setOpenGLView(CCEGLView *pobOpenGLView)
{
CCAssert(pobOpenGLView, "opengl view should not be null");
if (m_pobOpenGLView != pobOpenGLView)
{
// because EAGLView is not kind of CCObject
// EAGLView is not a CCObject
delete m_pobOpenGLView; // [openGLView_ release]
m_pobOpenGLView = pobOpenGLView;
@ -643,6 +641,9 @@ void CCDirector::purgeDirector()
// OpenGL view
m_pobOpenGLView->end();
m_pobOpenGLView = NULL;
// delete CCDirector
release();
}
void CCDirector::setNextScene(void)
@ -817,7 +818,7 @@ bool CCDirector::enableRetinaDisplay(bool enabled)
return true;
}
// Already diabled?
// Already disabled?
if (!enabled && m_fContentScaleFactor == 1)
{
return false;
@ -945,7 +946,7 @@ CCAccelerometer* CCDirector::getAccelerometer()
* implementation of DisplayLinkDirector
**************************************************/
// should we afford 4 types of director ??
// should we implement 4 types of director ??
// I think DisplayLinkDirector is enough
// so we now only support DisplayLinkDirector
void CCDisplayLinkDirector::startAnimation(void)

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -58,7 +58,7 @@ typedef enum {
/// it calls "updateProjection" on the projection delegate.
kCCDirectorProjectionCustom,
/// Detault projection is 3D projection
/// Default projection is 3D projection
kCCDirectorProjectionDefault = kCCDirectorProjection3D,
} ccDirectorProjection;
@ -83,7 +83,7 @@ and when to execute the Scenes.
- setting the OpenGL pixel format (default on is RGB565)
- setting the OpenGL buffer depth (default one is 0-bit)
- setting the projection (default one is 3D)
- setting the orientation (default one is Protrait)
- setting the orientation (default one is Portrait)
Since the CCDirector is a singleton, the standard way to use it is by calling:
_ CCDirector::sharedDirector()->methodName();

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -54,7 +54,7 @@ static void lazy_init( void )
if( ! s_bInitialized ) {
//
// Position and 1 color passed as a uniform (to similate glColor4ub )
// Position and 1 color passed as a uniform (to simulate glColor4ub )
//
s_pShader = CCShaderCache::sharedShaderCache()->programForKey(kCCShader_Position_uColor);
@ -67,7 +67,7 @@ static void lazy_init( void )
}
}
// When back to foreground on android, we want to it to inilialize again
// When switching from backround to foreground on android, we want the params to be initialized again
void ccDrawInit()
{
s_bInitialized = false;
@ -186,30 +186,35 @@ void ccDrawPoly( const CCPoint *poli, unsigned int numberOfPoints, bool closePol
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
// XXX: Mac OpenGL error. arrays can't go out of scope before draw is executed
ccVertex2F* newPoli = new ccVertex2F[numberOfPoints];
// iPhone and 32-bit machines optimization
if( sizeof(CCPoint) == sizeof(ccVertex2F) )
{
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, poli);
if( closePolygon )
glDrawArrays(GL_LINE_LOOP, 0, (GLsizei) numberOfPoints);
else
glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) numberOfPoints);
}
else
{
// Mac on 64-bit
// XXX: Mac OpenGL error. arrays can't go out of scope before draw is executed
ccVertex2F* newPoli = new ccVertex2F[numberOfPoints];
for( unsigned int i=0; i<numberOfPoints;i++) {
newPoli[i].x = poli[i].x;
newPoli[i].y = poli[i].y;
}
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, newPoli);
if( closePolygon )
glDrawArrays(GL_LINE_LOOP, 0, (GLsizei) numberOfPoints);
else
glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) numberOfPoints);
CC_SAFE_DELETE_ARRAY(newPoli);
}
if( closePolygon )
glDrawArrays(GL_LINE_LOOP, 0, (GLsizei) numberOfPoints);
else
glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) numberOfPoints);
CC_SAFE_DELETE_ARRAY(newPoli);
CC_INCREMENT_GL_DRAWS(1);
}
@ -247,7 +252,7 @@ void ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4
CC_INCREMENT_GL_DRAWS(1);
}
void ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter)
void ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY)
{
lazy_init();
@ -263,8 +268,8 @@ void ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned in
for(unsigned int i = 0;i <= segments; i++) {
float rads = i*coef;
GLfloat j = radius * cosf(rads + angle) + center.x;
GLfloat k = radius * sinf(rads + angle) + center.y;
GLfloat j = radius * cosf(rads + angle) * scaleX + center.x;
GLfloat k = radius * sinf(rads + angle) * scaleY + center.y;
vertices[i*2] = j;
vertices[i*2+1] = k;
@ -286,6 +291,11 @@ void ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned in
CC_INCREMENT_GL_DRAWS(1);
}
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter)
{
ccDrawCircle(center, radius, angle, segments, drawLineToCenter, 1.0f, 1.0f);
}
void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, unsigned int segments)
{
lazy_init();

View File

@ -56,7 +56,7 @@ NS_CC_BEGIN
class CCPointArray;
/** initlialize context */
/** initialize context */
void CC_DLL ccDrawInit();
/** draws a point given x and y coordinate measured in points */
@ -78,16 +78,17 @@ void CC_DLL ccDrawRect( CCPoint origin, CCPoint destination );
*/
void CC_DLL ccDrawSolidRect( CCPoint origin, CCPoint destination, ccColor4F color );
/** draws a poligon given a pointer to CCPoint coordiantes and the number of vertices measured in points.
/** draws a polygon given a pointer to CCPoint coordinates and the number of vertices measured in points.
The polygon can be closed or open
*/
void CC_DLL ccDrawPoly( const CCPoint *vertices, unsigned int numOfVertices, bool closePolygon );
/** draws a solid polygon given a pointer to CGPoint coordiantes, the number of vertices measured in points, and a color.
/** draws a solid polygon given a pointer to CGPoint coordinates, the number of vertices measured in points, and a color.
*/
void CC_DLL ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4F color );
/** draws a circle given the center, radius and number of segments. */
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY);
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
/** draws a quad bezier path

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -375,7 +375,7 @@ void CCScheduler::priorityIn(tListEntry **ppList, CCObject *pTarget, int nPriori
pListElement->next = pListElement->prev = NULL;
pListElement->markedForDeletion = false;
// empey list ?
// empty list ?
if (! *ppList)
{
DL_APPEND(*ppList, pListElement);
@ -763,7 +763,7 @@ void CCScheduler::update(float dt)
dt *= m_fTimeScale;
}
// Iterate all over the Updates selectors
// Iterate over all the Updates' selectors
tListEntry *pEntry, *pTmp;
// updates with priority < 0
@ -799,7 +799,7 @@ void CCScheduler::update(float dt)
}
}
// Interate all over the custom selectors
// Iterate over all the custom selectors
for (tHashSelectorEntry *elt = m_pHashForSelectors; elt != NULL; )
{
m_pCurrentTarget = elt;
@ -838,7 +838,7 @@ void CCScheduler::update(float dt)
}
}
// Interate all over the script callbacks
// Iterate over all the script callbacks
if (m_pScriptHandlerEntries)
{
for (int i = m_pScriptHandlerEntries->count() - 1; i >= 0; i--)
@ -855,7 +855,7 @@ void CCScheduler::update(float dt)
}
}
// delete all updates that are morked for deletion
// delete all updates that are marked for deletion
// updates with priority < 0
DL_FOREACH_SAFE(m_pUpdatesNegList, pEntry, pTmp)
{

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -47,7 +47,7 @@ class CCSet;
//
// CCTimer
//
/** @brief Light weight timer */
/** @brief Light-weight timer */
class CC_DLL CCTimer : public CCObject
{
public:
@ -108,7 +108,7 @@ struct _hashUpdateEntry;
class CCArray;
/** @brief Scheduler is responsible of triggering the scheduled callbacks.
/** @brief Scheduler is responsible for triggering the scheduled callbacks.
You should not use NSTimer. Instead use this class.
There are 2 different types of callbacks (selectors):
@ -142,9 +142,9 @@ public:
/** The scheduled method will be called every 'interval' seconds.
If paused is YES, then it won't be called until it is resumed.
If 'interval' is 0, it will be called every frame, but if so, it recommened to use 'scheduleUpdateForTarget:' instead.
If 'interval' is 0, it will be called every frame, but if so, it's recommended to use 'scheduleUpdateForTarget:' instead.
If the selector is already scheduled, then only the interval parameter will be updated without re-scheduling it again.
repeat let the action be repeated repeat + 1 times, use kCCRepeatForever to let the action run continiously
repeat let the action be repeated repeat + 1 times, use kCCRepeatForever to let the action run continuously
delay is the amount of time the action will wait before it'll start
@since v0.99.3, repeat and delay added in v1.1

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.

View File

@ -234,7 +234,7 @@ public:
public:
/** creates the action with a set boundary,
It will work with no boundary if @param rect is equal to CCRectZero.
@deprecated: Please use create(CCNode*, const CCRect&) intead. This interface will be deprecated sooner or later.
@deprecated: Please use create(CCNode*, const CCRect&) instead. This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCFollow* actionWithTarget(CCNode *pFollowedNode, const CCRect& rect = CCRectZero);
/** creates the action with a set boundary,

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
http://www.cocos2d-x.org

View File

@ -26,7 +26,7 @@
* THE SOFTWARE.
*
*
* Orignal code by Radu Gruian: http://www.codeproject.com/Articles/30838/Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So
* Original code by Radu Gruian: http://www.codeproject.com/Articles/30838/Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So
*
* Adapted to cocos2d-x by Vit Valentin
*
@ -96,12 +96,12 @@ CCPointArray::CCPointArray() :m_pControlPoints(NULL){}
void CCPointArray::addControlPoint(CCPoint controlPoint)
{
// should create a new object of CCPoint
// because developer always use this function like this
// should create a new object: CCPoint
// because developers are accustomed to using
// addControlPoint(ccp(x, y))
// passing controlPoint is a temple object
// and CCArray::addObject() will retain the passing object, so it
// should be an object created in heap
// which assumes controlPoint is a temporary struct
// but CCArray::addObject() will retain the passed object, so temp
// should be an object created in the heap.
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
m_pControlPoints->addObject(temp);
temp->release();
@ -109,12 +109,12 @@ void CCPointArray::addControlPoint(CCPoint controlPoint)
void CCPointArray::insertControlPoint(CCPoint &controlPoint, unsigned int index)
{
// should create a new object of CCPoint
// because developer always use this function like this
// should create a new object: CCPoint
// because developers are accustomed to using
// insertControlPoint(ccp(x, y))
// passing controlPoint is a temple object
// and CCArray::insertObject() will retain the passing object, so it
// should be an object created in heap
// which assumes controlPoint is a temporary struct
// but CCArray::insertObject() will retain the passed object, so temp
// should be an object created in the heap.
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
m_pControlPoints->insertObject(temp, index);
temp->release();
@ -130,12 +130,12 @@ CCPoint CCPointArray::getControlPointAtIndex(unsigned int index)
void CCPointArray::replaceControlPoint(cocos2d::CCPoint &controlPoint, unsigned int index)
{
// should create a new object of CCPoint
// because developer always use this function like this
// should create a new object: CCPoint
// because developers are accustomed to using
// replaceControlPoint(ccp(x, y))
// passing controlPoint is a temple object
// and CCArray::insertObject() will retain the passing object, so it
// should be an object created in heap
// which assumes controlPoint is a temporary struct
// but CCArray::insertObject() will retain the passed object, so temp
// should be an object created in the heap.
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
m_pControlPoints->replaceObjectAtIndex(index, temp);
temp->release();

View File

@ -26,7 +26,7 @@
* THE SOFTWARE.
*
*
* Orignal code by Radu Gruian: http://www.codeproject.com/Articles/30838/Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So
* Original code by Radu Gruian: http://www.codeproject.com/Articles/30838/Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So
*
* Adapted to cocos2d-x by Vit Valentin
*

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2009 Jason Booth
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2009 Jason Booth
http://www.cocos2d-x.org
@ -320,7 +320,7 @@ protected:
/**
@brief Ease Elastic In action.
@warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
@warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
@since v0.8.2
@ingroup Actions
*/
@ -345,7 +345,7 @@ public:
/**
@brief Ease Elastic Out action.
@warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
@warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
@since v0.8.2
@ingroup Actions
*/
@ -371,7 +371,7 @@ public:
/**
@brief Ease Elastic InOut action.
@warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
@warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
@since v0.8.2
@ingroup Actions
*/
@ -440,7 +440,7 @@ public:
/**
@brief EaseBounceOut action.
@warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
@warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
@since v0.8.2
@ingroup Actions
*/
@ -462,7 +462,7 @@ public:
/**
@brief CCEaseBounceInOut action.
@warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
@warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
@since v0.8.2
@ingroup Actions
*/
@ -484,7 +484,7 @@ public:
/**
@brief CCEaseBackIn action.
@warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
@warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
@since v0.8.2
@ingroup Actions
*/
@ -506,7 +506,7 @@ public:
/**
@brief CCEaseBackOut action.
@warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
@warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
@since v0.8.2
@ingroup Actions
*/
@ -528,7 +528,7 @@ public:
/**
@brief CCEaseBackInOut action.
@warning This action doesn't use a bijective fucntion. Actions like Sequence might have an unexpected result when used with this action.
@warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
@since v0.8.2
@ingroup Actions
*/

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 On-Core
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 On-Core
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -384,7 +384,7 @@ bool CCRepeat::initWithAction(CCFiniteTimeAction *pAction, unsigned int times)
pAction->retain();
m_bActionInstant = dynamic_cast<CCActionInstant*>(pAction) ? true : false;
//a instant action needs to be executed one time less in the update method since it uses startWithTarget to execute the action
//an instant action needs to be executed one time less in the update method since it uses startWithTarget to execute the action
if (m_bActionInstant)
{
m_uTimes -=1;
@ -463,7 +463,7 @@ void CCRepeat::update(float dt)
m_uTotal++;
}
// don't set a instantaction back or update it, it has no use because it has no duration
// don't set an instant action back or update it, it has no use because it has no duration
if (!m_bActionInstant)
{
if (m_uTotal == m_uTimes)

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2011 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -116,7 +116,7 @@ public:
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actions(CCFiniteTimeAction *pAction1, ...);
/** helper contructor to create an array of sequenceable actions given an array
/** helper constructor to create an array of sequenceable actions given an array
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actionWithArray(CCArray *arrayOfActions);
@ -127,7 +127,7 @@ public:
/** helper constructor to create an array of sequenceable actions */
static CCFiniteTimeAction* create(CCFiniteTimeAction *pAction1, ...);
/** helper contructor to create an array of sequenceable actions given an array */
/** helper constructor to create an array of sequenceable actions given an array */
static CCFiniteTimeAction* create(CCArray *arrayOfActions);
/** creates the action */
static CCSequence* createWithTwoActions(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo);
@ -257,7 +257,7 @@ public:
*/
CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actions(CCFiniteTimeAction *pAction1, ...);
/** helper contructor to create an array of spawned actions given an array
/** helper constructor to create an array of spawned actions given an array
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCFiniteTimeAction* actionWithArray(CCArray *arrayOfActions);
@ -270,7 +270,7 @@ public:
/** helper constructor to create an array of spawned actions */
static CCFiniteTimeAction* create(CCFiniteTimeAction *pAction1, ...);
/** helper contructor to create an array of spawned actions given an array */
/** helper constructor to create an array of spawned actions given an array */
static CCFiniteTimeAction* create(CCArray *arrayOfActions);
/** creates the Spawn action */

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2009 Valentin Milea
Copyright (c) 2011 Zynga Inc.

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2009 Valentin Milea
Copyright (c) 2011 Zynga Inc.

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/
http://www.cocos2d-x.org
@ -96,7 +96,7 @@ void CCPageTurn3D::update(float time)
p.y = ( R + ay - ( r * (1 - cosBeta) * sinTheta));
// We scale z here to avoid the animation being
// too much bigger than the screen due to perspectve transform
// too much bigger than the screen due to perspective transform
p.z = (r * ( 1 - cosBeta ) * cosTheta) / 7;// "100" didn't work for
// Stop z coord from dropping beneath underlying page in a transition

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (C) 2010 Lam Pham
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (C) 2010 Lam Pham
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 On-Core
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright 2009 lhunath (Maarten Billemont)
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright 2009 lhunath (Maarten Billemont)
http://www.cocos2d-x.org
@ -50,7 +50,7 @@ public:
[target runAction:modifyWidth];
Another example: CCScaleTo action could be rewriten using CCPropertyAction:
Another example: CCScaleTo action could be rewritten using CCPropertyAction:
// scaleA and scaleB are equivalents
id scaleA = [CCScaleTo actionWithDuration:2 scale:3];

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -130,7 +130,7 @@ void CCAtlasNode::calculateMaxItems()
void CCAtlasNode::updateAtlasValues()
{
CCAssert(false, "CCAtlasNode:Abstract updateAtlasValue not overriden");
CCAssert(false, "CCAtlasNode:Abstract updateAtlasValue not overridden");
}
// CCAtlasNode - draw

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -98,7 +98,7 @@ public:
bool initWithTileFile(const char* tile, unsigned int tileWidth, unsigned int tileHeight, unsigned int itemsToRender);
/** updates the Atlas (indexed vertex array).
* Shall be overriden in subclasses
* Shall be overridden in subclasses
*/
virtual void updateAtlasValues();

View File

@ -99,6 +99,8 @@ CCNode::CCNode(void)
CCNode::~CCNode(void)
{
CCLOGINFO( "cocos2d: deallocing" );
unregisterScriptHandler();
CC_SAFE_RELEASE(m_pActionManager);
CC_SAFE_RELEASE(m_pScheduler);
@ -171,7 +173,7 @@ void CCNode::setZOrder(int z)
}
}
/// ertexZ getter
/// vertexZ getter
float CCNode::getVertexZ()
{
return m_fVertexZ;
@ -491,7 +493,7 @@ CCNode* CCNode::getChildByTag(int aTag)
}
/* "add" logic MUST only be on this method
* If a class want's to extend the 'addChild' behaviour it only needs
* If a class want's to extend the 'addChild' behavior it only needs
* to override this method
*/
void CCNode::addChild(CCNode *child, int zOrder, int tag)
@ -681,7 +683,7 @@ void CCNode::sortAllChildren()
{
//CCAssert(0);
// override me
// Only use- this function to draw your staff.
// Only use- this function to draw your stuff.
// DON'T draw your stuff outside this method
}

View File

@ -25,8 +25,8 @@
THE SOFTWARE.
****************************************************************************/
#ifndef __PLATFOMR_CCNODE_H__
#define __PLATFOMR_CCNODE_H__
#ifndef __PLATFORM_CCNODE_H__
#define __PLATFORM_CCNODE_H__
#include "ccMacros.h"
#include "cocoa/CCAffineTransform.h"
@ -65,7 +65,7 @@ enum {
kCCNodeOnExitTransitionDidStart
};
/** @brief CCNode is the main element. Anything thats gets drawn or contains things that get drawn is a CCNode.
/** @brief CCNode is the main element. Anything that gets drawn or contains things that get drawn is a CCNode.
The most popular CCNodes are: CCScene, CCLayer, CCSprite, CCMenu.
The main features of a CCNode are:
@ -239,7 +239,7 @@ public:
/** A weak reference to the parent */
CC_PROPERTY(CCNode *, m_pParent, Parent)
// If ture, the Anchor Point will be (0,0) when you position the CCNode.
// If true, the Anchor Point will be (0,0) when you position the CCNode.
// Used by CCLayer and CCScene
bool m_bIgnoreAnchorPointForPosition;
bool isIgnoreAnchorPointForPosition();
@ -325,7 +325,7 @@ public:
*/
static CCNode * create(void);
//scene managment
//scene management
/** callback that is called every time the CCNode enters the 'stage'.
If the CCNode enters the 'stage' with a transition, this callback is called when the transition starts.
@ -577,7 +577,7 @@ public:
*/
virtual CCAffineTransform parentToNodeTransform(void);
/** Retrusn the world affine transform matrix. The matrix is in Pixels.
/** Returns the world affine transform matrix. The matrix is in Pixels.
@since v0.7.1
*/
virtual CCAffineTransform nodeToWorldTransform(void);
@ -611,7 +611,7 @@ public:
*/
CCPoint convertTouchToNodeSpace(CCTouch * touch);
/** converts a CCTouch (world coordinates) into a local coordiante. This method is AR (Anchor Relative).
/** converts a CCTouch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
@since v0.7.1
*/
CCPoint convertTouchToNodeSpaceAR(CCTouch * touch);
@ -622,7 +622,7 @@ public:
NS_CC_END
#endif // __PLATFOMR_CCNODE_H__
#endif // __PLATFORM_CCNODE_H__

View File

@ -414,7 +414,7 @@ void CCArray::reverseObjects()
{
if (data->num > 1)
{
//floor it since in case of a oneven number the number of swaps stays the same
// floorf(), since in the case of an even number, the number of swaps stays the same
int count = (int) floorf(data->num/2.f);
unsigned int maxIndex = data->num - 1;

View File

@ -33,7 +33,7 @@ THE SOFTWARE.
*/
/** @def CCARRAY_FOREACH
A convience macro to iterate over a CCArray using. It is faster than the "fast enumeration" interface.
A convenience macro to iterate over a CCArray using. It is faster than the "fast enumeration" interface.
@since v0.99.4
*/
@ -139,7 +139,7 @@ public:
@brief Generate a CCArray pointer by file
@param pFileName The file name of *.plist file
@return The CCArray pointer generated from the file
@deprecated: Please use createWithContentsOfFile(const char*) intead. 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 CCArray* arrayWithContentsOfFile(const char* pFileName);

View File

@ -44,13 +44,16 @@ void CCAutoreleasePool::addObject(CCObject* pObject)
m_pManagedObjectArray->addObject(pObject);
CCAssert(pObject->m_uReference > 1, "reference count should be greater than 1");
++(pObject->m_uAutoReleaseCount);
pObject->release(); // no ref count, in this case autorelease pool added.
}
void CCAutoreleasePool::removeObject(CCObject* pObject)
{
m_pManagedObjectArray->removeObject(pObject, false);
for (int i = 0; i < pObject->m_uAutoReleaseCount; ++i)
{
m_pManagedObjectArray->removeObject(pObject, false);
}
}
void CCAutoreleasePool::clear()
@ -68,7 +71,7 @@ void CCAutoreleasePool::clear()
if(!pObj)
break;
pObj->m_bManaged = false;
--(pObj->m_uAutoReleaseCount);
//(*it)->release();
//delete (*it);
#ifdef _DEBUG

View File

@ -91,7 +91,10 @@ CCArray* CCDictionary::allKeysForObject(CCObject* object)
CCObject* CCDictionary::objectForKey(const std::string& key)
{
if (m_eDictType == kCCDictUnknown && m_eDictType == kCCDictUnknown) return NULL;
// if dictionary wasn't initialized, return NULL directly.
if (m_eDictType == kCCDictUnknown) return NULL;
// CCDictionary only supports one kind of key, string or integer.
// This method uses string as key, therefore we should make sure that the key type of this CCDictionary is string.
CCAssert(m_eDictType == kCCDictStr, "this dictionary does not use string as key.");
CCObject* pRetObject = NULL;
@ -106,7 +109,10 @@ CCObject* CCDictionary::objectForKey(const std::string& key)
CCObject* CCDictionary::objectForKey(int key)
{
if (m_eDictType == kCCDictUnknown && m_eDictType == kCCDictUnknown) return NULL;
// if dictionary wasn't initialized, return NULL directly.
if (m_eDictType == kCCDictUnknown) return NULL;
// CCDictionary only supports one kind of key, string or integer.
// This method uses integer as key, therefore we should make sure that the key type of this CCDictionary is integer.
CCAssert(m_eDictType == kCCDictInt, "this dictionary does not use integer as key.");
CCObject* pRetObject = NULL;
@ -264,7 +270,7 @@ void CCDictionary::removeAllObjects()
CCObject* CCDictionary::copyWithZone(CCZone* pZone)
{
CCAssert(pZone == NULL, "CCDirctionary should not be inherited.");
CCAssert(pZone == NULL, "CCDictionary should not be inherited.");
CCDictionary* pNewDict = new CCDictionary();
CCDictElement* pElement = NULL;

View File

@ -60,7 +60,7 @@ public:
strcpy(m_szKey, pStart);
}
CCDictElement(int iKey, CCObject* pObject)
CCDictElement(intptr_t iKey, CCObject* pObject)
{
init();
m_iKey = iKey;
@ -73,7 +73,7 @@ public:
return m_szKey;
}
inline int getIntKey() const
inline intptr_t getIntKey() const
{
CCAssert(m_szKey[0] == '\0', "Should not call this function for string dictionary");
return m_iKey;
@ -95,7 +95,7 @@ private:
private:
char m_szKey[MAX_KEY_LEN+1]; /** hash key of string type*/
int m_iKey; /** hash key of integer type */
intptr_t m_iKey; /** hash key of integer type */
CCObject* m_pObject;/** hash value */
public:
UT_hash_handle hh; /* makes this class hashable */

View File

@ -50,7 +50,7 @@ static inline void split(std::string src, const char* token, strArray& vect)
}
// first, judge whether the form of the string like this: {x,y}
// if the form is right,the string will be splited into the parameter strs;
// if the form is right,the string will be split into the parameter strs;
// or the parameter strs will be empty.
// if the form is right return true,else return false.
static bool splitWithForm(const char* pStr, strArray& strs)

View File

@ -38,22 +38,20 @@ CCObject* CCCopying::copyWithZone(CCZone *pZone)
}
CCObject::CCObject(void)
:m_uAutoReleaseCount(0)
,m_uReference(1) // when the object is created, the reference count of it is 1
,m_nLuaID(0)
{
static unsigned int uObjectCount = 0;
m_uID = ++uObjectCount;
m_nLuaID = 0;
// when the object is created, the refrence count of it is 1
m_uReference = 1;
m_bManaged = false;
}
CCObject::~CCObject(void)
{
// if the object is managed, we should remove it
// from pool manager
if (m_bManaged)
if (m_uAutoReleaseCount > 0)
{
CCPoolManager::sharedPoolManager()->removeObject(this);
}
@ -99,8 +97,6 @@ void CCObject::retain(void)
CCObject* CCObject::autorelease(void)
{
CCPoolManager::sharedPoolManager()->addObject(this);
m_bManaged = true;
return this;
}

View File

@ -53,10 +53,10 @@ public:
// Lua reference id
int m_nLuaID;
protected:
// count of refrence
// count of references
unsigned int m_uReference;
// is the object autoreleased
bool m_bManaged;
// count of autorelease
unsigned int m_uAutoReleaseCount;
public:
CCObject(void);
virtual ~CCObject(void);

View File

@ -45,7 +45,7 @@ public:
virtual ~CCSet(void);
/**
*@brief Return a copy of the CCSet, it will copy all the elelments.
*@brief Return a copy of the CCSet, it will copy all the elements.
*/
CCSet* copy();
/**
@ -73,7 +73,7 @@ public:
*/
CCSetIterator begin();
/**
*@brief Return the iterator that points to the poisition after the last element.
*@brief Return the iterator that points to the position after the last element.
*/
CCSetIterator end();
/**

View File

@ -219,7 +219,7 @@ CCString* CCString::createWithFormat(const char* format, ...)
CCString* CCString::stringWithContentsOfFile(const char* pszFileName)
{
return CCString::create(pszFileName);
return CCString::createWithContentsOfFile(pszFileName);
}
CCString* CCString::createWithContentsOfFile(const char* pszFileName)

View File

@ -84,7 +84,7 @@ public:
virtual CCObject* copyWithZone(CCZone* pZone);
virtual bool isEqual(const CCObject* pObject);
/* static funcitons */
/* static functions */
/** create a string with c string
* @return A CCString pointer which is an autorelease object pointer,
* it means that you needn't do a release operation unless you retain it.
@ -120,7 +120,7 @@ public:
*/
CC_DEPRECATED_ATTRIBUTE static CCString* stringWithContentsOfFile(const char* pszFileName);
/** create a string with std string, you can also pass a c string pointer because the default constuctor of std::string can access a c string pointer.
/** create a string with std string, you can also pass a c string pointer because the default constructor of std::string can access a c string pointer.
* @return A CCString pointer which is an autorelease object pointer,
* it means that you needn't do a release operation unless you retain it.
*/

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -30,7 +30,7 @@ NS_CC_BEGIN
const char* cocos2dVersion()
{
return "cocos2d-2.0-x-2.0.2";
return "cocos2d-2.0-x-2.0.3";
}
NS_CC_END

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 On-Core
http://www.cocos2d-x.org
@ -53,7 +53,7 @@ void CCGrabber::grab(CCTexture2D *pTexture)
GLuint status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
{
CCAssert(0, "Frame Grabber: could not attach texture to frmaebuffer");
CCAssert(0, "Frame Grabber: could not attach texture to framebuffer");
}
glBindFramebuffer(GL_FRAMEBUFFER, m_oldFBO);

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 On-Core
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 On-Core
http://www.cocos2d-x.org
@ -346,7 +346,7 @@ void CCGrid3D::blit(void)
// position
glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, m_pVertices);
// texCoods
// texCoords
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, m_pTexCoordinates);
glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, m_pIndices);
@ -551,7 +551,7 @@ void CCTiledGrid3D::blit(void)
// position
glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, m_pVertices);
// texCoods
// texCoords
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, m_pTexCoordinates);
glDrawElements(GL_TRIANGLES, (GLsizei)n*6, GL_UNSIGNED_SHORT, m_pIndices);

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 On-Core
http://www.cocos2d-x.org
@ -51,7 +51,7 @@ class CC_DLL CCGridBase : public CCObject
public:
virtual ~CCGridBase(void);
/** wheter or not the grid is active */
/** whether or not the grid is active */
inline bool isActive(void) { return m_bActive; }
void setActive(bool bActive);

12
cocos2dx/include/CCProtocols.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
http://www.cocos2d-x.org
@ -50,7 +50,7 @@ public:
virtual GLubyte getOpacity(void) = 0;
/** sets the opacity.
@warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed.
@warning If the the texture has premultiplied alpha then, the R, G and B channels will be modified.
Values goes from 0 to 255, where 255 means fully opaque.
*/
virtual void setOpacity(GLubyte opacity) = 0;
@ -59,7 +59,7 @@ public:
/** sets the premultipliedAlphaOpacity property.
If set to NO then opacity will be applied as: glColor(R,G,B,opacity);
If set to YES then oapcity will be applied as: glColor(opacity, opacity, opacity, opacity );
If set to YES then opacity will be applied as: glColor(opacity, opacity, opacity, opacity );
Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO
@since v0.8
*/
@ -72,7 +72,7 @@ public:
};
/**
@brief You can specify the blending fuction.
@brief You can specify the blending function.
@since v0.99.0
*/
class CC_DLL CCBlendProtocol
@ -91,7 +91,7 @@ public:
src=GL_ONE dst= GL_ONE_MINUS_SRC_ALPHA
else
src=GL_SRC_ALPHA dst= GL_ONE_MINUS_SRC_ALPHA
But you can change the blending funtion at any time.
But you can change the blending function at any time.
@since v0.8.0
*/
class CC_DLL CCTextureProtocol : public CCBlendProtocol
@ -119,7 +119,7 @@ public:
class CC_DLL CCDirectorDelegate
{
public:
/** Called by CCDirector when the porjection is updated, and "custom" projection is used
/** Called by CCDirector when the projection is updated, and "custom" projection is used
@since v0.99.5
*/
virtual void updateProjection(void) = 0;

23
cocos2dx/include/ccConfig.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -36,14 +36,14 @@ THE SOFTWARE.
/** @def CC_ENABLE_GL_STATE_CACHE
If enabled, cocos2d will maintain an OpenGL state cache internally to avoid unnecessary switches.
In order to use them, you have to use the following functions, insead of the the GL ones:
In order to use them, you have to use the following functions, instead of the the GL ones:
- ccGLUseProgram() instead of glUseProgram()
- ccGLDeleteProgram() instead of glDeleteProgram()
- ccGLBlendFunc() instead of glBlendFunc()
If this functionality is disabled, then ccGLUseProgram(), ccGLDeleteProgram(), ccGLBlendFunc() will call the GL ones, without using the cache.
It is recommened to enable whenever possible to improve speed.
It is recommended to enable whenever possible to improve speed.
If you are migrating your code from GL ES 1.1, then keep it disabled. Once all your code works as expected, turn it on.
@since v2.0.0
@ -77,7 +77,7 @@ To enabled set it to 1. Disabled by default.
#endif
/** @def CC_DIRECTOR_FPS_INTERVAL
Senconds between FPS updates.
Seconds between FPS updates.
0.5 seconds, means that the FPS number will be updated every 0.5 seconds.
Having a bigger number means a more reliable FPS
@ -165,9 +165,10 @@ Only valid for cocos2d-mac. Not supported on cocos2d-ios.
*/
#ifndef CC_TEXTURE_ATLAS_USE_VAO
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#define CC_TEXTURE_ATLAS_USE_VAO 1
#else
/* Some Windows display adapter driver cannot support VAO. */
/* Some android devices cannot support VAO very well, so we disable it by default for android platform. */
/* Blackberry also doesn't support this feature. */
#define CC_TEXTURE_ATLAS_USE_VAO 0
@ -190,7 +191,7 @@ Only valid for cocos2d-mac. Not supported on cocos2d-ios.
/** @def CC_SPRITE_DEBUG_DRAW
If enabled, all subclasses of CCSprite will draw a bounding box
Useful for debugging purposes only. It is recommened to leave it disabled.
Useful for debugging purposes only. It is recommended to leave it disabled.
To enable set it to a value different than 0. Disabled by default:
0 -- disabled
@ -206,7 +207,7 @@ Only valid for cocos2d-mac. Not supported on cocos2d-ios.
/** @def CC_SPRITEBATCHNODE_DEBUG_DRAW
If enabled, all subclasses of CCSprite that are rendered using an CCSpriteBatchNode draw a bounding box.
Useful for debugging purposes only. It is recommened to leave it disabled.
Useful for debugging purposes only. It is recommended to leave it disabled.
To enable set it to a value different than 0. Disabled by default.
*/
@ -216,7 +217,7 @@ To enable set it to a value different than 0. Disabled by default.
/** @def CC_LABELBMFONT_DEBUG_DRAW
If enabled, all subclasses of CCLabelBMFont will draw a bounding box
Useful for debugging purposes only. It is recommened to leave it disabled.
Useful for debugging purposes only. It is recommended to leave it disabled.
To enable set it to a value different than 0. Disabled by default.
*/
@ -226,7 +227,7 @@ To enable set it to a value different than 0. Disabled by default.
/** @def CC_LABELATLAS_DEBUG_DRAW
If enabled, all subclasses of LabeltAtlas will draw a bounding box
Useful for debugging purposes only. It is recommened to leave it disabled.
Useful for debugging purposes only. It is recommended to leave it disabled.
To enable set it to a value different than 0. Disabled by default.
*/
@ -235,9 +236,9 @@ To enable set it to a value different than 0. Disabled by default.
#endif
/** @def CC_ENABLE_PROFILERS
If enabled, will activate various profilers withing cocos2d. This statistical data will be output to the console
If enabled, will activate various profilers within cocos2d. This statistical data will be output to the console
once per second showing average time (in milliseconds) required to execute the specific routine(s).
Useful for debugging purposes only. It is recommened to leave it disabled.
Useful for debugging purposes only. It is recommended to leave it disabled.
To enable set it to a value different than 0. Disabled by default.
*/

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -163,7 +163,7 @@ CCSizeMake( (__size_in_points__).width * CC_CONTENT_SCALE_FACTOR(), (__size_in_p
void operator=(const TypeName&)
/**
Helper marcos which converts 4-byte little/big endian
Helper macros which converts 4-byte little/big endian
integral number to the machine native number representation
It should work same as apples CFSwapInt32LittleToHost(..)

View File

@ -28,6 +28,8 @@ THE SOFTWARE.
#include "platform/CCPlatformMacros.h"
#include <typeinfo>
#include <ctype.h>
#include <string.h>
NS_CC_BEGIN
@ -37,7 +39,7 @@ public:
virtual long getClassTypeInfo() = 0;
};
static unsigned int getHashCodeByString(const char *key)
static inline unsigned int getHashCodeByString(const char *key)
{
unsigned int len = strlen(key);
const char *end=key+len;

8
cocos2dx/include/ccTypes.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -254,7 +254,7 @@ typedef struct _ccV3F_C4B_T2F
// char __padding2__[4];
// tex coords (2F)
ccTex2F texCoords; // 8 byts
ccTex2F texCoords; // 8 bytes
} ccV3F_C4B_T2F;
//! 4 ccVertex2FTex2FColor4B Quad
@ -305,7 +305,7 @@ typedef struct _ccBlendFunc
GLenum dst;
} ccBlendFunc;
// XXX: If any of these enums are edited and/or reordered, udpate CCTexture2D.m
// XXX: If any of these enums are edited and/or reordered, update CCTexture2D.m
//! Vertical text alignment type
typedef enum
{
@ -314,7 +314,7 @@ typedef enum
kCCVerticalTextAlignmentBottom,
} CCVerticalTextAlignment;
// XXX: If any of these enums are edited and/or reordered, udpate CCTexture2D.m
// XXX: If any of these enums are edited and/or reordered, update CCTexture2D.m
//! Horizontal text alignment type
typedef enum
{

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -29,7 +29,7 @@ THE SOFTWARE.
// 0x00 HI ME LO
// 00 02 00 00
#define COCOS2D_VERSION 0x00020000
#define COCOS2D_VERSION 0x00020003
//
// all cocos2d include files

View File

@ -35,7 +35,7 @@ extern "C" {
#endif
/**
* A struture that represents an axis-aligned
* A structure that represents an axis-aligned
* bounding box.
*/
typedef struct kmAABB {

View File

@ -32,13 +32,13 @@
#endif
#endif // __arm__
// Matrixes are assumed to be stored in column major format according to OpenGL
// Matrices are assumed to be stored in column major format according to OpenGL
// specification.
// Multiplies two 4x4 matrices (a,b) outputing a 4x4 matrix (output)
// Multiplies two 4x4 matrices (a,b) outputting a 4x4 matrix (output)
void NEON_Matrix4Mul(const float* a, const float* b, float* output );
// Multiplies a 4x4 matrix (m) with a vector 4 (v), outputing a vector 4
// Multiplies a 4x4 matrix (m) with a vector 4 (v), outputting a vector 4
void NEON_Matrix4Vector4Mul(const float* m, const float* v, float* output);

View File

@ -62,7 +62,7 @@ CC_DLL kmPlane* const kmPlaneFromPoints(kmPlane* pOut, const struct kmVec3* p1,
CC_DLL kmVec3* const kmPlaneIntersectLine(struct kmVec3* pOut, const kmPlane* pP, const struct kmVec3* pV1, const struct kmVec3* pV2);
CC_DLL kmPlane* const kmPlaneNormalize(kmPlane* pOut, const kmPlane* pP);
CC_DLL kmPlane* const kmPlaneScale(kmPlane* pOut, const kmPlane* pP, kmScalar s);
CC_DLL const POINT_CLASSIFICATION kmPlaneClassifyPoint(const kmPlane* pIn, const kmVec3* pP); /** Classifys a point against a plane */
CC_DLL const POINT_CLASSIFICATION kmPlaneClassifyPoint(const kmPlane* pIn, const kmVec3* pP); /** Classifies a point against a plane */
#ifdef __cplusplus
}

View File

@ -100,7 +100,7 @@ void kmGLPushMatrix(void)
void kmGLPopMatrix(void)
{
assert(initialized && "Cannot Pop empty matrix stack");
//No need to lazy initialize, you shouldnt be popping first anyway!
//No need to lazy initialize, you shouldn't be popping first anyway!
km_mat4_stack_pop(current_stack, NULL);
}

View File

@ -55,7 +55,7 @@ const kmScalar kmMat3Determinant(const kmMat3* pIn)
m = | 1 4 7 | 1 4 |
| 2 5 8 | 2 5 |
now sum up the products of the diagonals going to the right (i.e. 0,4,8)
and substract the products of the other diagonals (i.e. 2,4,6)
and subtract the products of the other diagonals (i.e. 2,4,6)
*/
output = pIn->mat[0] * pIn->mat[4] * pIn->mat[8] + pIn->mat[1] * pIn->mat[5] * pIn->mat[6] + pIn->mat[2] * pIn->mat[3] * pIn->mat[7];

View File

@ -41,7 +41,7 @@ public:
// The back key clicked
virtual void keyBackClicked() {}
// The menu key clicked. only avialble on wophone & android
// The menu key clicked. only available on wophone & android
virtual void keyMenuClicked() {};
};

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -931,7 +931,7 @@ void CCLabelBMFont::createFontChars()
// Color MUST be set before opacity, since opacity might change color if OpacityModifyRGB is on
fontChar->setColor(m_tColor);
// only apply opaccity if it is different than 255 )
// only apply opacity if it is different than 255 )
// to prevent modifying the color too (issue #610)
if( m_cOpacity != 255 )
{

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -93,7 +93,7 @@ typedef struct _BMFontPadding {
*/
class CC_DLL CCBMFontConfiguration : public CCObject
{
// XXX: Creating a public interface so that the bitmapFontArray[] is accesible
// XXX: Creating a public interface so that the bitmapFontArray[] is accessible
public://@public
// BMFont definitions
struct _FontDefHashElement* m_pFontDefDictionary;
@ -142,7 +142,7 @@ Features:
- scaled
- translated
- tinted
- chage the opacity
- change the opacity
- It can be used as part of a menu item.
- anchorPoint can be used to align the "label"
- Supports AngelCode text format
@ -202,11 +202,11 @@ public:
@since v0.99.3
*/
static void purgeCachedData();
/** creates a bitmap font altas with an initial string and the FNT file
/** creates a bitmap font atlas with an initial string and the FNT file
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCLabelBMFont * labelWithString(const char *str, const char *fntFile, float width = kCCLabelAutomaticWidth, CCTextAlignment alignment = kCCTextAlignmentLeft, CCPoint imageOffset = CCPointZero);
/** creates a bitmap font altas with an initial string and the FNT file */
/** creates a bitmap font atlas with an initial string and the FNT file */
static CCLabelBMFont * create(const char *str, const char *fntFile, float width, CCTextAlignment alignment, CCPoint imageOffset);
static CCLabelBMFont * create(const char *str, const char *fntFile, float width, CCTextAlignment alignment) {
@ -231,7 +231,7 @@ public:
static CCLabelBMFont * create();
bool init();
/** init a bitmap font altas with an initial string and the FNT file */
/** init a bitmap font atlas with an initial string and the FNT file */
bool initWithString(const char *str, const char *fntFile, float width = kCCLabelAutomaticWidth, CCTextAlignment alignment = kCCTextAlignmentLeft, CCPoint imageOffset = CCPointZero);
/** updates the font chars based on the string to render */

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
http://www.cocos2d-x.org
@ -227,7 +227,7 @@ void CCLabelTTF::setDimensions(const CCSize &dim)
{
m_tDimensions = dim;
// Force udpate
// Force update
if (m_string.size() > 0)
{
this->updateTexture();

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
http://www.cocos2d-x.org

View File

@ -1,4 +1,3 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
@ -98,18 +97,18 @@ CCLayer *CCLayer::create()
void CCLayer::registerWithTouchDispatcher()
{
CCDirector* pDirector = CCDirector::sharedDirector();
CCTouchDispatcher* pDispatcher = CCDirector::sharedDirector()->getTouchDispatcher();
if (m_pScriptHandlerEntry)
{
if (m_pScriptHandlerEntry->isMultiTouches())
{
pDirector->getTouchDispatcher()->addStandardDelegate(this, 0);
pDispatcher->addStandardDelegate(this, 0);
LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler());
}
else
{
pDirector->getTouchDispatcher()->addTargetedDelegate(this,
pDispatcher->addTargetedDelegate(this,
m_pScriptHandlerEntry->getPriority(),
m_pScriptHandlerEntry->getSwallowsTouches());
LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler());
@ -117,7 +116,7 @@ void CCLayer::registerWithTouchDispatcher()
return;
}
pDirector->getTouchDispatcher()->addStandardDelegate(this, 0);
pDispatcher->addStandardDelegate(this, 0);
}
void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches)
@ -129,12 +128,8 @@ void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int
void CCLayer::unregisterScriptTouchHandler(void)
{
if (m_pScriptHandlerEntry)
{
m_pScriptHandlerEntry->release();
m_pScriptHandlerEntry = NULL;
CC_SAFE_RELEASE_NULL(m_pScriptHandlerEntry);
}
}
int CCLayer::excuteScriptTouchHandler(int nEventType, CCTouch *pTouch)
{
@ -166,8 +161,7 @@ void CCLayer::setTouchEnabled(bool enabled)
else
{
// have problems?
CCDirector* pDirector = CCDirector::sharedDirector();
pDirector->getTouchDispatcher()->removeDelegate(this);
CCDirector::sharedDirector()->getTouchDispatcher()->removeDelegate(this);
}
}
}
@ -247,7 +241,7 @@ void CCLayer::onEnter()
pDirector->getAccelerometer()->setDelegate(this);
}
// add this layer to concern the kaypad msg
// add this layer to concern the keypad msg
if (m_bIsKeypadEnabled)
{
pDirector->getKeypadDispatcher()->addDelegate(this);
@ -260,7 +254,8 @@ void CCLayer::onExit()
if( m_bIsTouchEnabled )
{
pDirector->getTouchDispatcher()->removeDelegate(this);
unregisterScriptTouchHandler();
// [lua]:don't unregister script touch handler, or the handler will be destroyed
// unregisterScriptTouchHandler();
}
// remove this layer from the delegates who concern Accelerometer Sensor
@ -269,7 +264,7 @@ void CCLayer::onExit()
pDirector->getAccelerometer()->setDelegate(NULL);
}
// remove this layer from the delegates who concern the kaypad msg
// remove this layer from the delegates who concern the keypad msg
if (m_bIsKeypadEnabled)
{
pDirector->getKeypadDispatcher()->removeDelegate(this);

View File

@ -293,7 +293,7 @@ public:
/**
* lua script can not init with undetermined number of variables
* so add these functinons to be used with lua.
* so add these functions to be used with lua.
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCLayerMultiplex * layerWithLayer(CCLayer* layer);
@ -303,7 +303,7 @@ public:
/**
* lua script can not init with undetermined number of variables
* so add these functinons to be used with lua.
* so add these functions to be used with lua.
*/
static CCLayerMultiplex * createWithLayer(CCLayer* layer);

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -130,7 +130,7 @@ public:
/** called after the transition finishes */
void finish(void);
/** used by some transitions to hide the outter scene */
/** used by some transitions to hide the outer scene */
void hideOutShowIn(void);
protected:
@ -266,7 +266,7 @@ public:
/** initializes the scenes */
virtual void initScenes(void);
/** returns the action that will be performed by the incomming and outgoing scene */
/** returns the action that will be performed by the incoming and outgoing scene */
virtual CCActionInterval* action(void);
virtual void onEnter();
@ -290,7 +290,7 @@ public:
/** initializes the scenes */
virtual void initScenes(void);
/** returns the action that will be performed by the incomming and outgoing scene */
/** returns the action that will be performed by the incoming and outgoing scene */
virtual CCActionInterval* action(void);
TRANSITION_CREATE_FUNC(CCTransitionSlideInR);
@ -310,7 +310,7 @@ public:
/** initializes the scenes */
virtual void initScenes(void);
/** returns the action that will be performed by the incomming and outgoing scene */
/** returns the action that will be performed by the incoming and outgoing scene */
virtual CCActionInterval* action(void);
TRANSITION_CREATE_FUNC(CCTransitionSlideInB);
@ -330,7 +330,7 @@ public:
/** initializes the scenes */
virtual void initScenes(void);
/** returns the action that will be performed by the incomming and outgoing scene */
/** returns the action that will be performed by the incoming and outgoing scene */
virtual CCActionInterval* action(void);
TRANSITION_CREATE_FUNC(CCTransitionSlideInT);

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/
http://www.cocos2d-x.org

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 Lam Pham
Copyright (c) 2012 Ricardo Quesada

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2009 Lam Pham
Copyright (c) 2012 Ricardo Quesada
@ -59,7 +59,7 @@ protected:
/** CCTransitionRadialCCW transition.
A counter colock-wise radial transition to the next scene
A counter clock-wise radial transition to the next scene
*/
class CC_DLL CCTransitionProgressRadialCCW : public CCTransitionProgress
{
@ -73,7 +73,7 @@ protected:
/** CCTransitionRadialCW transition.
A counter colock-wise radial transition to the next scene
A counter clock-wise radial transition to the next scene
*/
class CC_DLL CCTransitionProgressRadialCW : public CCTransitionProgress
{
@ -86,7 +86,7 @@ protected:
};
/** CCTransitionProgressHorizontal transition.
A colock-wise radial transition to the next scene
A clock-wise radial transition to the next scene
*/
class CC_DLL CCTransitionProgressHorizontal : public CCTransitionProgress
{

View File

@ -51,7 +51,7 @@ enum {
*
* Features and Limitation:
* - You can add MenuItem objects in runtime using addChild:
* - But the only accecpted children are MenuItem objects
* - But the only accepted children are MenuItem objects
*/
class CC_DLL CCMenu : public CCLayer, public CCRGBAProtocol
{

View File

@ -129,14 +129,14 @@ public:
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCMenuItemLabel * itemWithLabel(CCNode*label, CCObject* target, SEL_MenuHandler selector);
/** creates a CCMenuItemLabel with a Label. Target and selector will be nill
/** creates a CCMenuItemLabel with a Label. Target and selector will be nil
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCMenuItemLabel* itemWithLabel(CCNode *label);
/** creates a CCMenuItemLabel with a Label, target and selector */
static CCMenuItemLabel * create(CCNode*label, CCObject* target, SEL_MenuHandler selector);
/** creates a CCMenuItemLabel with a Label. Target and selector will be nill */
/** creates a CCMenuItemLabel with a Label. Target and selector will be nil */
static CCMenuItemLabel* create(CCNode *label);
/** initializes a CCMenuItemLabel with a Label, target and selector */
@ -373,7 +373,7 @@ public:
/** @brief A CCMenuItemToggle
A simple container class that "toggles" it's inner items
The inner itmes can be any MenuItem
The inner items can be any MenuItem
*/
class CC_DLL CCMenuItemToggle : public CCMenuItem, public CCRGBAProtocol
{

View File

@ -299,7 +299,7 @@ void CCMotionStreak::update(float delta)
m_pPointVertexes[m_uNuPoints] = m_tPositionR;
m_pPointState[m_uNuPoints] = 1.0f;
// Color asignation
// Color assignment
const unsigned int offset = m_uNuPoints*8;
*((ccColor3B*)(m_pColorPointer + offset)) = m_tColor;
*((ccColor3B*)(m_pColorPointer + offset+4)) = m_tColor;

View File

@ -87,7 +87,7 @@ public:
virtual void setOpacityModifyRGB(bool bValue);
virtual bool isOpacityModifyRGB(void);
/** When fast mode is enbled, new points are added faster but with lower precision */
/** When fast mode is enabled, new points are added faster but with lower precision */
inline bool isFastMode() { return m_bFastMode; }
inline void setFastMode(bool bFastMode) { m_bFastMode = bFastMode; }

View File

@ -118,7 +118,7 @@ void CCProgressTimer::setSprite(CCSprite *pSprite)
m_pSprite = pSprite;
setContentSize(m_pSprite->getContentSize());
// Everytime we set a new sprite, we free the current vertex data
// Every time we set a new sprite, we free the current vertex data
if (m_pVertexData)
{
CC_SAFE_FREE(m_pVertexData);

View File

@ -45,7 +45,7 @@ typedef enum {
} CCProgressTimerType;
/**
@brief CCProgresstimer is a subclass of CCNode.
@brief CCProgressTimer is a subclass of CCNode.
It renders the inner sprite according to the percentage.
The progress can be Radial, Horizontal or vertical.
@since v0.99.1

View File

@ -431,7 +431,7 @@ CCImage* CCRenderTexture::newCCImage()
const CCSize& s = m_pTexture->getContentSizeInPixels();
// to get the image size to save
// if the saving image domain exeeds the buffer texture domain,
// if the saving image domain exceeds the buffer texture domain,
// it should be cut
int nSavedBufferWidth = (int)s.width;
int nSavedBufferHeight = (int)s.height;
@ -458,7 +458,7 @@ CCImage* CCRenderTexture::newCCImage()
this->end();
// to get the actual texture data
// #640 the image read from rendertexture is upseted
// #640 the image read from rendertexture is dirty
for (int i = 0; i < nSavedBufferHeight; ++i)
{
memcpy(&pBuffer[i * nSavedBufferWidth * 4],

View File

@ -44,7 +44,7 @@ typedef enum eImageFormat
/**
@brief CCRenderTexture is a generic rendering target. To render things into it,
simply construct a render target, call begin on it, call visit on any cocos
scenes or objects to render them, and call end. For convienience, render texture
scenes or objects to render them, and call end. For convenience, render texture
adds a sprite as it's display child with the results, so you can simply add
the render texture to your scene and treat it like any other CocosNode.
There are also functions for saving the render texture to disk in PNG or JPG format.

View File

@ -135,7 +135,7 @@ void CCParticleBatchNode::visit()
// with the exception that it doesn't call visit on it's children
//
// The alternative is to have a void CCSprite#visit, but
// although this is less mantainable, is faster
// although this is less maintainable, is faster
//
if (!m_bIsVisible)
{
@ -185,7 +185,7 @@ void CCParticleBatchNode::addChild(CCNode * child, int zOrder, int tag)
setBlendFunc(pChild->getBlendFunc());
}
CCAssert( m_tBlendFunc.src == pChild->getBlendFunc().src && m_tBlendFunc.dst == pChild->getBlendFunc().dst, "Can't add a PaticleSystem that uses a differnt blending function");
CCAssert( m_tBlendFunc.src == pChild->getBlendFunc().src && m_tBlendFunc.dst == pChild->getBlendFunc().dst, "Can't add a PaticleSystem that uses a different blending function");
//no lazy sorting, so don't call super addChild, call helper instead
unsigned int pos = addChildHelper(pChild,zOrder,tag);
@ -388,7 +388,7 @@ void CCParticleBatchNode::removeChild(CCNode* child, bool cleanup)
// after memmove of data, empty the quads at the end of array
m_pTextureAtlas->fillWithEmptyQuadsFromIndex(m_pTextureAtlas->getTotalQuads(), pChild->getTotalParticles());
// paticle could be reused for self rendering
// particle could be reused for self rendering
pChild->setBatchNode(NULL);
updateAllAtlasIndexes();
@ -469,7 +469,7 @@ void CCParticleBatchNode::insertChild(CCParticleSystem* pSystem, unsigned int in
m_pTextureAtlas->moveQuadsFromIndex(index, index+pSystem->getTotalParticles());
}
// increase totalParticles here for new particles, update method of particlesystem will fill the quads
// increase totalParticles here for new particles, update method of particle-system will fill the quads
m_pTextureAtlas->increaseTotalQuadsWith(pSystem->getTotalParticles());
updateAllAtlasIndexes();

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
@ -263,7 +263,7 @@ bool CCParticleGalaxy::initWithTotalParticles(unsigned int numberOfParticles)
modeA.radialAccel = -80;
modeA.radialAccelVar = 0;
// Gravity Mode: tagential
// Gravity Mode: tangential
modeA.tangentialAccel = 80;
modeA.tangentialAccelVar = 0;
@ -337,7 +337,7 @@ bool CCParticleFlower::initWithTotalParticles(unsigned int numberOfParticles)
modeA.radialAccel = -60;
modeA.radialAccelVar = 0;
// Gravity Mode: tagential
// Gravity Mode: tangential
modeA.tangentialAccel = 15;
modeA.tangentialAccelVar = 0;
@ -410,7 +410,7 @@ bool CCParticleMeteor::initWithTotalParticles(unsigned int numberOfParticles)
modeA.radialAccel = 0;
modeA.radialAccelVar = 0;
// Gravity Mode: tagential
// Gravity Mode: tangential
modeA.tangentialAccel = 0;
modeA.tangentialAccelVar = 0;
@ -484,7 +484,7 @@ bool CCParticleSpiral::initWithTotalParticles(unsigned int numberOfParticles)
modeA.radialAccel = -380;
modeA.radialAccelVar = 0;
// Gravity Mode: tagential
// Gravity Mode: tangential
modeA.tangentialAccel = 45;
modeA.tangentialAccelVar = 0;
@ -557,7 +557,7 @@ bool CCParticleExplosion::initWithTotalParticles(unsigned int numberOfParticles)
modeA.radialAccel = 0;
modeA.radialAccelVar = 0;
// Gravity Mode: tagential
// Gravity Mode: tangential
modeA.tangentialAccel = 0;
modeA.tangentialAccelVar = 0;
@ -700,7 +700,7 @@ bool CCParticleSnow::initWithTotalParticles(unsigned int numberOfParticles)
modeA.radialAccel = 0;
modeA.radialAccelVar = 1;
// Gravity mode: tagential
// Gravity mode: tangential
modeA.tangentialAccel = 0;
modeA.tangentialAccelVar = 1;
@ -768,7 +768,7 @@ bool CCParticleRain::initWithTotalParticles(unsigned int numberOfParticles)
modeA.radialAccel = 0;
modeA.radialAccelVar = 1;
// Gravity Mode: tagential
// Gravity Mode: tangential
modeA.tangentialAccel = 0;
modeA.tangentialAccelVar = 1;

View File

@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.

View File

@ -37,7 +37,7 @@ THE SOFTWARE.
// http://particledesigner.71squared.com/
//
// IMPORTANT: Particle Designer is supported by cocos2d, but
// 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d,
// 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guaranteed in cocos2d,
// cocos2d uses a another approach, but the results are almost identical.
//
@ -73,7 +73,7 @@ NS_CC_BEGIN
// http://particledesigner.71squared.com/
//
// IMPORTANT: Particle Designer is supported by cocos2d, but
// 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d,
// 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guaranteed in cocos2d,
// cocos2d uses a another approach, but the results are almost identical.
//
@ -392,12 +392,12 @@ bool CCParticleSystem::initWithTotalParticles(unsigned int numberOfParticles)
m_bIsAutoRemoveOnFinish = false;
// Optimization: compile udpateParticle method
// Optimization: compile updateParticle method
//updateParticleSel = @selector(updateQuadWithParticle:newPosition:);
//updateParticleImp = (CC_UPDATE_PARTICLE_IMP) [self methodForSelector:updateParticleSel];
//for batchNode
m_bTransformSystemDirty = false;
// udpate after action in run!
// update after action in run!
this->scheduleUpdateWithPriority(1);
return true;
@ -734,12 +734,12 @@ void CCParticleSystem::updateQuadWithParticle(tCCParticle* particle, const CCPoi
{
CC_UNUSED_PARAM(particle);
CC_UNUSED_PARAM(newPosition);
// should be overriden
// should be overridden
}
void CCParticleSystem::postStep()
{
// should be overriden
// should be overridden
}
// ParticleSystem - CCTexture protocol

View File

@ -131,7 +131,7 @@ class CCTexture2D;
/** @brief Particle System base class.
Attributes of a Particle System:
- emmision rate of the particles
- emission rate of the particles
- Gravity Mode (Mode A):
- gravity
- direction
@ -155,7 +155,7 @@ Attributes of a Particle System:
- texture
cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).
'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d,
'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guaranteed in cocos2d,
cocos2d uses a another approach, but the results are almost identical.
cocos2d supports all the variables used by Particle Designer plus a bit more:
@ -208,7 +208,7 @@ protected:
float endRadius;
/** The ending radius variance of the particles. Only available in 'Radius' mode. */
float endRadiusVar;
/** Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode. */
/** Number of degrees to rotate a particle around the source pos per second. Only available in 'Radius' mode. */
float rotatePerSecond;
/** Variance in degrees for rotatePerSecond. Only available in 'Radius' mode. */
float rotatePerSecondVar;
@ -245,7 +245,7 @@ protected:
bool m_bIsActive;
/** Quantity of particles that are being simulated at the moment */
CC_PROPERTY_READONLY(unsigned int, m_uParticleCount, ParticleCount)
/** How many seconds the emitter wil run. -1 means 'forever' */
/** How many seconds the emitter will run. -1 means 'forever' */
CC_PROPERTY(float, m_fDuration, Duration)
/** sourcePosition of the emitter */
CC_PROPERTY_PASS_BY_REF(CCPoint, m_tSourcePosition, SourcePosition)
@ -368,7 +368,7 @@ public:
CCParticleSystem();
virtual ~CCParticleSystem();
/** creates an initializes a CCParticleSystem from a plist file.
This plist files can be creted manually or with Particle Designer:
This plist files can be created manually or with Particle Designer:
http://particledesigner.71squared.com/
@deprecated: This interface will be deprecated sooner or later.
@since v0.99.3
@ -376,7 +376,7 @@ public:
CC_DEPRECATED_ATTRIBUTE static CCParticleSystem * particleWithFile(const char *plistFile);
/** creates an initializes a CCParticleSystem from a plist file.
This plist files can be creted manually or with Particle Designer:
This plist files can be created manually or with Particle Designer:
http://particledesigner.71squared.com/
@since v2.0
*/
@ -388,7 +388,7 @@ public:
/** initializes a CCParticleSystem*/
bool init();
/** initializes a CCParticleSystem from a plist file.
This plist files can be creted manually or with Particle Designer:
This plist files can be created manually or with Particle Designer:
http://particledesigner.71squared.com/
@since v0.99.3
*/
@ -412,9 +412,9 @@ public:
//! whether or not the system is full
bool isFull();
//! should be overriden by subclasses
//! should be overridden by subclasses
virtual void updateQuadWithParticle(tCCParticle* particle, const CCPoint& newPosition);
//! should be overriden by subclasses
//! should be overridden by subclasses
virtual void postStep();
virtual void update(float dt);

View File

@ -120,6 +120,18 @@ CCParticleSystemQuad * CCParticleSystemQuad::create(const char *plistFile)
return pRet;
}
CCParticleSystemQuad * CCParticleSystemQuad::createWithTotalParticles(unsigned int numberOfParticles) {
CCParticleSystemQuad *pRet = new CCParticleSystemQuad();
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return pRet;
}
// pointRect should be in Texture coordinates, not pixel coordinates
void CCParticleSystemQuad::initTexCoordsWithRect(const CCRect& pointRect)
{
@ -381,7 +393,7 @@ void CCParticleSystemQuad::draw()
void CCParticleSystemQuad::setTotalParticles(unsigned int tp)
{
// If we are setting the total numer of particles to a number higher
// If we are setting the total number of particles to a number higher
// than what is allocated, we need to allocate new arrays
if( tp > m_uAllocatedParticles )
{

Some files were not shown because too many files have changed in this diff Show More