diff --git a/cocos/2d/CCActionCamera.cpp b/cocos/2d/CCActionCamera.cpp index c044bdd21a..45560f7ede 100644 --- a/cocos/2d/CCActionCamera.cpp +++ b/cocos/2d/CCActionCamera.cpp @@ -33,6 +33,12 @@ NS_CC_BEGIN // // CameraAction // +ActionCamera::ActionCamera() +{ + kmVec3Fill(&_center, 0, 0, 0); + kmVec3Fill(&_eye, 0, 0, FLT_EPSILON); + kmVec3Fill(&_up, 0, 1, 0); +} void ActionCamera::startWithTarget(Node *target) { ActionInterval::startWithTarget(target); @@ -54,53 +60,39 @@ ActionCamera * ActionCamera::reverse() const void ActionCamera::restore() { - _eyeX = _eyeY = 0.0f; - _eyeZ = FLT_EPSILON; + kmVec3Fill(&_center, 0, 0, 0); + kmVec3Fill(&_eye, 0, 0, FLT_EPSILON); + kmVec3Fill(&_up, 0, 1, 0); +} - _centerX = _centerY = _centerZ = 0.0f; - - _upX = 0.0f; - _upY = 1.0f; - _upZ = 0.0f; +void ActionCamera::setEye(const kmVec3& eye) +{ + _eye = eye; + updateTransform(); } void ActionCamera::setEye(float x, float y, float z) { - _eyeX = x; - _eyeY = y; - _eyeZ = z; - + kmVec3Fill(&_eye, x, y, z); updateTransform(); } -void ActionCamera::setCenter(float centerX, float centerY, float centerZ) +void ActionCamera::setCenter(const kmVec3& center) { - _centerX = centerX; - _centerY = centerY; - _centerZ = centerZ; - + _center = center; updateTransform(); } -void ActionCamera::setUp(float upX, float upY, float upZ) +void ActionCamera::setUp(const kmVec3& up) { - _upX = upX; - _upY = upY; - _upZ = upZ; - + _up = up; updateTransform(); } void ActionCamera::updateTransform() { - kmVec3 eye, center, up; - - kmVec3Fill(&eye, _eyeX, _eyeY , _eyeZ); - kmVec3Fill(¢er, _centerX, _centerY, _centerZ); - kmVec3Fill(&up, _upX, _upY, _upZ); - kmMat4 lookupMatrix; - kmMat4LookAt(&lookupMatrix, &eye, ¢er, &up); + kmMat4LookAt(&lookupMatrix, &_eye, &_center, &_up); Point anchorPoint = _target->getAnchorPointInPoints(); @@ -199,9 +191,9 @@ void OrbitCamera::update(float dt) float za = _radZ + _radDeltaZ * dt; float xa = _radX + _radDeltaX * dt; - float i = sinf(za) * cosf(xa) * r + _centerX; - float j = sinf(za) * sinf(xa) * r + _centerY; - float k = cosf(za) * r + _centerZ; + float i = sinf(za) * cosf(xa) * r + _center.x; + float j = sinf(za) * sinf(xa) * r + _center.y; + float k = cosf(za) * r + _center.z; setEye(i,j,k); } @@ -211,9 +203,9 @@ void OrbitCamera::sphericalRadius(float *newRadius, float *zenith, float *azimut float r; // radius float s; - float x = _eyeX - _centerX; - float y = _eyeY - _centerY; - float z = _eyeZ - _centerZ; + float x = _eye.x - _center.x; + float y = _eye.y - _center.y; + float z = _eye.z - _center.z; r = sqrtf( powf(x,2) + powf(y,2) + powf(z,2)); s = sqrtf( powf(x,2) + powf(y,2)); diff --git a/cocos/2d/CCActionCamera.h b/cocos/2d/CCActionCamera.h index c5515dfcff..2c42590080 100644 --- a/cocos/2d/CCActionCamera.h +++ b/cocos/2d/CCActionCamera.h @@ -50,17 +50,7 @@ public: /** * @js ctor */ - ActionCamera() - :_centerX(0) - ,_centerY(0) - ,_centerZ(0) - ,_eyeX(0) - ,_eyeY(0) - ,_eyeZ(FLT_EPSILON) - ,_upX(0) - ,_upY(1) - ,_upZ(0) - {} + ActionCamera(); /** * @js NA * @lua NA @@ -72,23 +62,28 @@ public: virtual ActionCamera * reverse() const override; virtual ActionCamera *clone() const override; + /* sets the Eye value of the Camera */ + void setEye(const kmVec3 &eye); + void setEye(float x, float y, float z); + /* returns the Eye value of the Camera */ + const kmVec3& getEye() const { return _eye; } + /* sets the Center value of the Camera */ + void setCenter(const kmVec3 ¢er); + /* returns the Center value of the Camera */ + const kmVec3& getCenter() const { return _center; } + /* sets the Up value of the Camera */ + void setUp(const kmVec3 &up); + /* Returns the Up value of the Camera */ + const kmVec3& getUp() const { return _up; } + protected: void restore(); - void setEye(float x, float y, float z); - void setCenter(float x, float y, float z); - void setUp(float x, float y, float z); void updateTransform(); - float _centerX; - float _centerY; - float _centerZ; - float _eyeX; - float _eyeY; - float _eyeZ; - float _upX; - float _upY; - float _upZ; + kmVec3 _center; + kmVec3 _eye; + kmVec3 _up; }; /** diff --git a/cocos/2d/CCDirector.cpp b/cocos/2d/CCDirector.cpp index 428772a367..d3c53b6f3e 100644 --- a/cocos/2d/CCDirector.cpp +++ b/cocos/2d/CCDirector.cpp @@ -61,6 +61,7 @@ THE SOFTWARE. #include "CCEventCustom.h" #include "CCFontFreeType.h" #include "CCRenderer.h" +#include "CCConsole.h" #include "renderer/CCFrustum.h" /** Position of the FPS @@ -116,9 +117,6 @@ bool Director::init(void) _scenesStack.reserve(15); - // projection delegate if "Custom" projection is used - _projectionDelegate = nullptr; - // FPS _accumDt = 0.0f; _frameRate = 0.0f; @@ -131,16 +129,16 @@ bool Director::init(void) // paused ? _paused = false; - + // purge ? _purgeDirectorInNextLoop = false; - _winSizeInPoints = Size::ZERO; + _winSizeInPoints = Size::ZERO; _openGLView = nullptr; - + _cullingFrustum = new Frustum(); - + _contentScaleFactor = 1.0f; // scheduler @@ -163,15 +161,15 @@ bool Director::init(void) //init TextureCache initTextureCache(); - // Renderer _renderer = new Renderer; + _console = new Console; // create autorelease pool PoolManager::sharedPoolManager()->push(); return true; } - + Director::~Director(void) { CCLOGINFO("deallocing Director: %p", this); @@ -179,7 +177,7 @@ Director::~Director(void) CC_SAFE_RELEASE(_FPSLabel); CC_SAFE_RELEASE(_SPFLabel); CC_SAFE_RELEASE(_drawsLabel); - + CC_SAFE_RELEASE(_runningScene); CC_SAFE_RELEASE(_notificationNode); CC_SAFE_RELEASE(_scheduler); @@ -192,6 +190,7 @@ Director::~Director(void) delete _eventProjectionChanged; delete _renderer; + delete _console; // pop the autorelease pool PoolManager::sharedPoolManager()->pop(); @@ -284,17 +283,17 @@ void Director::drawScene() } kmGLPushMatrix(); - + //construct the frustum { kmMat4 view; kmMat4 projection; kmGLGetMatrix(KM_GL_PROJECTION, &projection); kmGLGetMatrix(KM_GL_MODELVIEW, &view); - + _cullingFrustum->setupFromMatrix(view, projection); } - + // draw the scene if (_runningScene) { @@ -307,7 +306,7 @@ void Director::drawScene() { _notificationNode->visit(); } - + if (_displayStats) { showStats(); @@ -325,7 +324,7 @@ void Director::drawScene() { _openGLView->swapBuffers(); } - + if (_displayStats) { calculateMPF(); @@ -386,16 +385,16 @@ void Director::setOpenGLView(EGLView *openGLView) // set size _winSizeInPoints = _openGLView->getDesignResolutionSize(); - + createStatsLabel(); - + if (_openGLView) { setGLDefaultValues(); - } - + } + _renderer->initGLView(); - + CHECK_GL_ERROR_DEBUG(); // _touchDispatcher->setDispatchEvents(true); @@ -481,13 +480,12 @@ void Director::setProjection(Projection projection) kmGLMultMatrix(&matrixLookup); break; } - + case Projection::CUSTOM: - if (_projectionDelegate) - _projectionDelegate->updateProjection(); - + // Projection Delegate is no longer needed + // since the event "PROJECTION CHANGED" is emitted break; - + default: CCLOG("cocos2d: Director: unrecognized projection"); break; @@ -549,10 +547,10 @@ static void GLToClipTransform(kmMat4 *transformOut) { kmMat4 projection; kmGLGetMatrix(KM_GL_PROJECTION, &projection); - + kmMat4 modelview; kmGLGetMatrix(KM_GL_MODELVIEW, &modelview); - + kmMat4Multiply(transformOut, &projection, &modelview); } @@ -560,19 +558,19 @@ Point Director::convertToGL(const Point& uiPoint) { kmMat4 transform; GLToClipTransform(&transform); - + kmMat4 transformInv; kmMat4Inverse(&transformInv, &transform); - + // Calculate z=0 using -> transform*[0, 0, 0, 1]/w kmScalar zClip = transform.mat[14]/transform.mat[15]; - + Size glSize = _openGLView->getDesignResolutionSize(); kmVec3 clipCoord = {2.0f*uiPoint.x/glSize.width - 1.0f, 1.0f - 2.0f*uiPoint.y/glSize.height, zClip}; - + kmVec3 glCoord; kmVec3TransformCoord(&glCoord, &clipCoord, &transformInv); - + return Point(glCoord.x, glCoord.y); } @@ -580,12 +578,12 @@ Point Director::convertToUI(const Point& glPoint) { kmMat4 transform; GLToClipTransform(&transform); - + kmVec3 clipCoord; // Need to calculate the zero depth from the transform. kmVec3 glCoord = {glPoint.x, glPoint.y, 0.0}; kmVec3TransformCoord(&clipCoord, &glCoord, &transform); - + Size glSize = _openGLView->getDesignResolutionSize(); return Point(glSize.width*(clipCoord.x*0.5 + 0.5), glSize.height*(-clipCoord.y*0.5 + 0.5)); } @@ -606,7 +604,7 @@ Size Director::getVisibleSize() const { return _openGLView->getVisibleSize(); } - else + else { return Size::ZERO; } @@ -618,7 +616,7 @@ Point Director::getVisibleOrigin() const { return _openGLView->getVisibleOrigin(); } - else + else { return Point::ZERO; } @@ -973,11 +971,6 @@ void Director::createStatsLabel() _FPSLabel->setPosition(CC_DIRECTOR_STATS_POSITION); } -float Director::getContentScaleFactor() const -{ - return _contentScaleFactor; -} - void Director::setContentScaleFactor(float scaleFactor) { if (scaleFactor != _contentScaleFactor) @@ -987,11 +980,6 @@ void Director::setContentScaleFactor(float scaleFactor) } } -Node* Director::getNotificationNode() -{ - return _notificationNode; -} - void Director::setNotificationNode(Node *node) { CC_SAFE_RELEASE(_notificationNode); @@ -999,16 +987,6 @@ void Director::setNotificationNode(Node *node) CC_SAFE_RETAIN(_notificationNode); } -DirectorDelegate* Director::getDelegate() const -{ - return _projectionDelegate; -} - -void Director::setDelegate(DirectorDelegate* delegate) -{ - _projectionDelegate = delegate; -} - void Director::setScheduler(Scheduler* scheduler) { if (_scheduler != scheduler) @@ -1019,11 +997,6 @@ void Director::setScheduler(Scheduler* scheduler) } } -Scheduler* Director::getScheduler() const -{ - return _scheduler; -} - void Director::setActionManager(ActionManager* actionManager) { if (_actionManager != actionManager) @@ -1034,16 +1007,6 @@ void Director::setActionManager(ActionManager* actionManager) } } -ActionManager* Director::getActionManager() const -{ - return _actionManager; -} - -EventDispatcher* Director::getEventDispatcher() const -{ - return _eventDispatcher; -} - void Director::setEventDispatcher(EventDispatcher* dispatcher) { if (_eventDispatcher != dispatcher) @@ -1054,12 +1017,6 @@ void Director::setEventDispatcher(EventDispatcher* dispatcher) } } -Renderer* Director::getRenderer() const -{ - return _renderer; -} - - /*************************************************** * implementation of DisplayLinkDirector **************************************************/ diff --git a/cocos/2d/CCDirector.h b/cocos/2d/CCDirector.h index 10f46bb539..23bc8cda42 100644 --- a/cocos/2d/CCDirector.h +++ b/cocos/2d/CCDirector.h @@ -60,6 +60,7 @@ class EventListenerCustom; class TextureCache; class Frustum; class Renderer; +class Console; /** @brief Class that creates and handles the main Window and manages how @@ -186,21 +187,9 @@ public: Useful to hook a notification object, like Notifications (http://github.com/manucorporat/CCNotifications) @since v0.99.5 */ - Node* getNotificationNode(); + Node* getNotificationNode() const { return _notificationNode; } void setNotificationNode(Node *node); - /** Director delegate. It shall implement the DirectorDelegate protocol - @since v0.99.5 - * @js NA - * @lua NA - */ - DirectorDelegate* getDelegate() const; - /** - * @js NA - * @lua NA - */ - void setDelegate(DirectorDelegate* delegate); - // window size /** returns the size of the OpenGL view in points. @@ -340,7 +329,7 @@ public: @since v0.99.4 */ void setContentScaleFactor(float scaleFactor); - float getContentScaleFactor() const; + float getContentScaleFactor() const { return _contentScaleFactor; } /** Get the Culling Frustum @@ -351,7 +340,7 @@ public: /** Gets the Scheduler associated with this director @since v2.0 */ - Scheduler* getScheduler() const; + Scheduler* getScheduler() const { return _scheduler; } /** Sets the Scheduler associated with this director @since v2.0 @@ -361,7 +350,7 @@ public: /** Gets the ActionManager associated with this director @since v2.0 */ - ActionManager* getActionManager() const; + ActionManager* getActionManager() const { return _actionManager; } /** Sets the ActionManager associated with this director @since v2.0 @@ -371,7 +360,7 @@ public: /** Gets the EventDispatcher associated with this director @since v3.0 */ - EventDispatcher* getEventDispatcher() const; + EventDispatcher* getEventDispatcher() const { return _eventDispatcher; } /** Sets the EventDispatcher associated with this director @since v3.0 @@ -381,7 +370,12 @@ public: /** Returns the Renderer @since v3.0 */ - Renderer* getRenderer() const; + Renderer* getRenderer() const { return _renderer; } + + /** Returns the Console + @since v3.0 + */ + Console* getConsole() const { return _console; } /* Gets delta time since last tick to main loop */ float getDeltaTime() const; @@ -492,10 +486,11 @@ protected: /* This object will be visited after the scene. Useful to hook a notification node */ Node *_notificationNode; - /* Projection protocol delegate */ - DirectorDelegate *_projectionDelegate; - + /* Renderer for the Director */ Renderer *_renderer; + + /* Console for the director */ + Console *_console; // EGLViewProtocol will recreate stats labels to fit visible rect friend class EGLViewProtocol; diff --git a/cocos/2d/CCLayer.cpp b/cocos/2d/CCLayer.cpp index b8b69f0976..1bae6e040c 100644 --- a/cocos/2d/CCLayer.cpp +++ b/cocos/2d/CCLayer.cpp @@ -569,16 +569,11 @@ void LayerColor::draw() _customCommand.func = CC_CALLBACK_0(LayerColor::onDraw, this); Director::getInstance()->getRenderer()->addCommand(&_customCommand); - kmMat4 p, mvp; - kmGLGetMatrix(KM_GL_PROJECTION, &p); - kmGLGetMatrix(KM_GL_MODELVIEW, &mvp); - kmMat4Multiply(&mvp, &p, &mvp); - for(int i = 0; i < 4; ++i) { kmVec3 pos; pos.x = _squareVertices[i].x; pos.y = _squareVertices[i].y; pos.z = _vertexZ; - kmVec3TransformCoord(&pos, &pos, &mvp); + kmVec3TransformCoord(&pos, &pos, &_modelViewTransform); _noMVPVertices[i] = Vertex3F(pos.x,pos.y,pos.z); } diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 6e38937d19..3b7ce1c47c 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -103,7 +103,7 @@ Node::Node(void) , _anchorPointInPoints(Point::ZERO) , _anchorPoint(Point::ZERO) , _contentSize(Size::ZERO) -, _additionalTransformDirty(false) +, _useAdditionalTransform(false) , _transformDirty(true) , _inverseDirty(true) // children (lazy allocs) @@ -1189,10 +1189,9 @@ const kmMat4& Node::getNodeToParentTransform() const // vertex Z _transform.mat[14] = _vertexZ; - if (_additionalTransformDirty) + if (_useAdditionalTransform) { kmMat4Multiply(&_transform, &_transform, &_additionalTransform); - _additionalTransformDirty = false; } _transformDirty = false; @@ -1211,14 +1210,14 @@ void Node::setAdditionalTransform(const AffineTransform& additionalTransform) { CGAffineToGL(additionalTransform, _additionalTransform.mat); _transformDirty = true; - _additionalTransformDirty = true; + _useAdditionalTransform = true; } void Node::setAdditionalTransform(const kmMat4& additionalTransform) { _additionalTransform = additionalTransform; _transformDirty = true; - _additionalTransformDirty = true; + _useAdditionalTransform = true; } diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 09da015dd6..3069fb0a84 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -1266,7 +1266,9 @@ public: Point convertTouchToNodeSpaceAR(Touch * touch) const; /** - * Sets the additional transform. + * Sets an additional transform matrix to the node. + * + * In order to remove it, set the Identity Matrix to the additional transform. * * @note The additional transform will be concatenated at the end of getNodeToParentTransform. * It could be used to simulate `parent-child` relationship between two nodes (e.g. one is in BatchNode, another isn't). @@ -1289,7 +1291,7 @@ public: spriteA->setPosition(Point(200, 200)); // Gets the spriteA's transform. - AffineTransform t = spriteA->getNodeToParentTransform(); + auto t = spriteA->getNodeToParentTransform(); // Sets the additional transform to spriteB, spriteB's postion will based on its pseudo parent i.e. spriteA. spriteB->setAdditionalTransform(t); @@ -1421,12 +1423,13 @@ protected: Size _contentSize; ///< untransformed size of the node + kmMat4 _modelViewTransform; ///< ModelView transform of the Node. + // "cache" variables are allowed to be mutable mutable kmMat4 _additionalTransform; ///< transform mutable kmMat4 _transform; ///< transform mutable kmMat4 _inverse; ///< inverse transform - kmMat4 _modelViewTransform; ///< ModelView transform of the Node. - mutable bool _additionalTransformDirty; ///< The flag to check whether the additional transform is dirty + bool _useAdditionalTransform; ///< The flag to check whether the additional transform is dirty mutable bool _transformDirty; ///< transform dirty flag mutable bool _inverseDirty; ///< inverse transform dirty flag diff --git a/cocos/2d/ccMacros.h b/cocos/2d/ccMacros.h index 8196fbac0c..e15f4907a3 100644 --- a/cocos/2d/ccMacros.h +++ b/cocos/2d/ccMacros.h @@ -32,7 +32,7 @@ THE SOFTWARE. #define _USE_MATH_DEFINES #endif -#include "platform/CCCommon.h" +#include "CCConsole.h" #include "CCStdC.h" #ifndef CCASSERT diff --git a/cocos/2d/ccUTF8.cpp b/cocos/2d/ccUTF8.cpp index ceb240d2e6..6e70a313d5 100644 --- a/cocos/2d/ccUTF8.cpp +++ b/cocos/2d/ccUTF8.cpp @@ -25,6 +25,7 @@ #include "ccUTF8.h" #include "platform/CCCommon.h" +#include "CCConsole.h" NS_CC_BEGIN diff --git a/cocos/2d/platform/CCCommon.h b/cocos/2d/platform/CCCommon.h index eb4f6fa9cb..fa300cd4fe 100644 --- a/cocos/2d/platform/CCCommon.h +++ b/cocos/2d/platform/CCCommon.h @@ -35,14 +35,6 @@ NS_CC_BEGIN * @{ */ -/// The max length of CCLog message. -static const int kMaxLogLen = 16*1024; - -/** -@brief Output Debug message. -*/ -void CC_DLL log(const char * format, ...) CC_FORMAT_PRINTF(1, 2); - /** * lua can not deal with ... */ diff --git a/cocos/2d/platform/android/CCCommon.cpp b/cocos/2d/platform/android/CCCommon.cpp index a24c002463..b48aff2e5c 100644 --- a/cocos/2d/platform/android/CCCommon.cpp +++ b/cocos/2d/platform/android/CCCommon.cpp @@ -33,28 +33,6 @@ NS_CC_BEGIN #define MAX_LEN (cocos2d::kMaxLogLen + 1) -// XXX deprecated -void CCLog(const char * pszFormat, ...) -{ - va_list args; - va_start(args, pszFormat); - __android_log_vprint(ANDROID_LOG_DEBUG, "cocos2d-x debug info", pszFormat, args); - va_end(args); - -} - -void log(const char * pszFormat, ...) -{ - char buf[MAX_LEN]; - - va_list args; - va_start(args, pszFormat); - vsnprintf(buf, MAX_LEN, pszFormat, args); - va_end(args); - - __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf); -} - void MessageBox(const char * pszMsg, const char * pszTitle) { showDialogJNI(pszMsg, pszTitle); diff --git a/cocos/2d/platform/ios/CCCommon.mm b/cocos/2d/platform/ios/CCCommon.mm index 0afbb57e73..28d0dd0e22 100644 --- a/cocos/2d/platform/ios/CCCommon.mm +++ b/cocos/2d/platform/ios/CCCommon.mm @@ -29,34 +29,11 @@ #include #import +#include "CCDirector.h" +#include "CCConsole.h" NS_CC_BEGIN -// XXX deprecated -void CCLog(const char * format, ...) -{ - printf("cocos2d: "); - char buf[kMaxLogLen+1] = {0}; - va_list ap; - va_start(ap, format); - vsnprintf(buf, kMaxLogLen, format, ap); - va_end(ap); - printf("%s", buf); - printf("\n"); -} - -void log(const char * format, ...) -{ - printf("cocos2d: "); - char buf[kMaxLogLen+1] = {0}; - va_list ap; - va_start(ap, format); - vsnprintf(buf, kMaxLogLen, format, ap); - va_end(ap); - printf("%s", buf); - printf("\n"); -} - // ios no MessageBox, use log instead void MessageBox(const char * msg, const char * title) { diff --git a/cocos/2d/platform/linux/CCCommon.cpp b/cocos/2d/platform/linux/CCCommon.cpp index 4b94bcd8e0..c48307192b 100644 --- a/cocos/2d/platform/linux/CCCommon.cpp +++ b/cocos/2d/platform/linux/CCCommon.cpp @@ -24,60 +24,18 @@ THE SOFTWARE. ****************************************************************************/ #include "platform/CCCommon.h" #include "CCStdC.h" +#include "CCConsole.h" NS_CC_BEGIN -#define MAX_LEN (cocos2d::kMaxLogLen + 1) - -// XXX deprecated -void CCLog(const char * pszFormat, ...) +void MessageBox(const char * msg, const char * title) { - char szBuf[MAX_LEN]; - - va_list ap; - va_start(ap, pszFormat); - vsnprintf(szBuf, MAX_LEN, pszFormat, ap); - va_end(ap); - - // Strip any trailing newlines from log message. - size_t len = strlen(szBuf); - while (len && szBuf[len-1] == '\n') - { - szBuf[len-1] = '\0'; - len--; - } - - fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf); + log("%s: %s", title, msg); } -void log(const char * pszFormat, ...) +void LuaLog(const char * format) { - char szBuf[MAX_LEN]; - - va_list ap; - va_start(ap, pszFormat); - vsnprintf(szBuf, MAX_LEN, pszFormat, ap); - va_end(ap); - - // Strip any trailing newlines from log message. - size_t len = strlen(szBuf); - while (len && szBuf[len-1] == '\n') - { - szBuf[len-1] = '\0'; - len--; - } - - fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf); -} - -void MessageBox(const char * pszMsg, const char * pszTitle) -{ - log("%s: %s", pszTitle, pszMsg); -} - -void LuaLog(const char * pszFormat) -{ - puts(pszFormat); + puts(format); } NS_CC_END diff --git a/cocos/2d/platform/mac/CCCommon.mm b/cocos/2d/platform/mac/CCCommon.mm index 3e6cb32295..52e4fb7beb 100644 --- a/cocos/2d/platform/mac/CCCommon.mm +++ b/cocos/2d/platform/mac/CCCommon.mm @@ -33,36 +33,6 @@ THE SOFTWARE. NS_CC_BEGIN -// XXX deprecated -void CCLog(const char * format, ...) -{ - printf("Cocos2d: "); - char buf[kMaxLogLen]; - - va_list ap; - va_start(ap, format); - vsnprintf(buf, kMaxLogLen, format, ap); - va_end(ap); - printf("%s", buf); - printf("\n"); - fflush(stdout); -} - -void log(const char * format, ...) -{ - printf("Cocos2d: "); - char buf[kMaxLogLen]; - - va_list ap; - va_start(ap, format); - vsnprintf(buf, kMaxLogLen, format, ap); - va_end(ap); - printf("%s", buf); - printf("\n"); - fflush(stdout); -} - - void LuaLog(const char * format) { puts(format); diff --git a/cocos/2d/platform/win32/CCCommon.cpp b/cocos/2d/platform/win32/CCCommon.cpp index 58651989de..3aa3d6458f 100644 --- a/cocos/2d/platform/win32/CCCommon.cpp +++ b/cocos/2d/platform/win32/CCCommon.cpp @@ -29,43 +29,6 @@ NS_CC_BEGIN #define MAX_LEN (cocos2d::kMaxLogLen + 1) -// XXX deprecated -void CCLog(const char * pszFormat, ...) -{ - char szBuf[MAX_LEN]; - - va_list ap; - va_start(ap, pszFormat); - vsnprintf_s(szBuf, MAX_LEN, MAX_LEN, pszFormat, ap); - va_end(ap); - - WCHAR wszBuf[MAX_LEN] = {0}; - MultiByteToWideChar(CP_UTF8, 0, szBuf, -1, wszBuf, sizeof(wszBuf)); - OutputDebugStringW(wszBuf); - OutputDebugStringA("\n"); - - WideCharToMultiByte(CP_ACP, 0, wszBuf, sizeof(wszBuf), szBuf, sizeof(szBuf), NULL, FALSE); - printf("%s\n", szBuf); -} - -void log(const char * pszFormat, ...) -{ - char szBuf[MAX_LEN]; - - va_list ap; - va_start(ap, pszFormat); - vsnprintf_s(szBuf, MAX_LEN, MAX_LEN, pszFormat, ap); - va_end(ap); - - WCHAR wszBuf[MAX_LEN] = {0}; - MultiByteToWideChar(CP_UTF8, 0, szBuf, -1, wszBuf, sizeof(wszBuf)); - OutputDebugStringW(wszBuf); - OutputDebugStringA("\n"); - - WideCharToMultiByte(CP_ACP, 0, wszBuf, sizeof(wszBuf), szBuf, sizeof(szBuf), NULL, FALSE); - printf("%s\n", szBuf); -} - void MessageBox(const char * pszMsg, const char * pszTitle) { MessageBoxA(NULL, pszMsg, pszTitle, MB_OK); diff --git a/cocos/2d/renderer/CCFrustum.cpp b/cocos/2d/renderer/CCFrustum.cpp index b03c9771ee..cc26b67cab 100644 --- a/cocos/2d/renderer/CCFrustum.cpp +++ b/cocos/2d/renderer/CCFrustum.cpp @@ -23,7 +23,7 @@ ****************************************************************************/ #include "CCFrustum.h" -#include "platform/CCCommon.h" +#include "CCConsole.h" #include diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 6eb9256a67..58636d15cf 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -49,6 +49,7 @@ #include "CCDirector.h" #include "CCScheduler.h" #include "CCScene.h" +#include "CCPlatformConfig.h" NS_CC_BEGIN @@ -108,43 +109,94 @@ static const char* inet_ntop(int af, const void* src, char* dst, int cnt) } #endif + +// +// Free functions to log +// + +// XXX: Deprecated +void CCLog(const char * format, ...) +{ + va_list args; + va_start(args, format); + log(format, args); + va_end(args); +} + +void log(const char * format, ...) +{ + va_list args; + va_start(args, format); + log(format, args); + va_end(args); +} + +void log(const char *format, va_list args) +{ + char buf[MAX_LOG_LENGTH]; + + vsnprintf(buf, MAX_LOG_LENGTH-3, format, args); + strcat(buf, "\n"); + +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf); + +#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 + WCHAR wszBuf[MAX_LOG_LENGTH] = {0}; + MultiByteToWideChar(CP_UTF8, 0, szBuf, -1, wszBuf, sizeof(wszBuf)); + OutputDebugStringW(wszBuf); + OutputDebugStringA("\n"); + + WideCharToMultiByte(CP_ACP, 0, wszBuf, sizeof(wszBuf), szBuf, sizeof(szBuf), NULL, FALSE); + printf("%s\n", szBuf); + +#else + // Linux, Mac, iOS, etc + fprintf(stdout, "cocos2d: %s", buf); + fflush(stdout); +#endif + + Director::getInstance()->getConsole()->log(buf); +} + + // // Console code // -Console* Console::create() -{ - auto ret = new Console; - - ret->autorelease(); - return ret; -} - Console::Console() : _listenfd(-1) , _running(false) , _endThread(false) -, _maxCommands(5) , _userCommands(nullptr) , _maxUserCommands(0) +, _sendDebugStrings(false) { // VS2012 doesn't support initializer list, so we create a new array and assign its elements to '_command'. Command commands[] = { - { "fps on", [](int fd, const char* command) { - Director *dir = Director::getInstance(); - Scheduler *sched = dir->getScheduler(); - sched->performFunctionInCocosThread( std::bind(&Director::setDisplayStats, dir, true)); - } }, - { "fps off", [](int fd, const char* command) { - Director *dir = Director::getInstance(); - Scheduler *sched = dir->getScheduler(); - sched->performFunctionInCocosThread( std::bind(&Director::setDisplayStats, dir, false)); - } }, - { "scene graph", std::bind(&Console::commandSceneGraph, this, std::placeholders::_1, std::placeholders::_2) }, - { "exit", std::bind(&Console::commandExit, this, std::placeholders::_1, std::placeholders::_2) }, - { "help", std::bind(&Console::commandHelp, this, std::placeholders::_1, std::placeholders::_2) } }; + { "debug msg on", [&](int fd, const char* command) { + _sendDebugStrings = true; + } }, + { "debug msg off", [&](int fd, const char* command) { + _sendDebugStrings = false; + } }, + { "exit", std::bind(&Console::commandExit, this, std::placeholders::_1, std::placeholders::_2) }, + { "fps on", [](int fd, const char* command) { + Director *dir = Director::getInstance(); + Scheduler *sched = dir->getScheduler(); + sched->performFunctionInCocosThread( std::bind(&Director::setDisplayStats, dir, true)); + } }, + { "fps off", [](int fd, const char* command) { + Director *dir = Director::getInstance(); + Scheduler *sched = dir->getScheduler(); + sched->performFunctionInCocosThread( std::bind(&Director::setDisplayStats, dir, false)); + } }, + { "help", std::bind(&Console::commandHelp, this, std::placeholders::_1, std::placeholders::_2) }, + { "scene graph", std::bind(&Console::commandSceneGraph, this, std::placeholders::_1, std::placeholders::_2) }, + }; - for (size_t i = 0; i < sizeof(commands)/sizeof(commands[0]) && i < sizeof(_commands)/sizeof(_commands[0]); ++i) + _maxCommands = sizeof(commands)/sizeof(commands[0]); + for (int i = 0; i < _maxCommands; ++i) { _commands[i] = commands[i]; } @@ -152,7 +204,7 @@ Console::Console() Console::~Console() { - cancel(); + stop(); } bool Console::listenOnTCP(int port) @@ -206,14 +258,14 @@ bool Console::listenOnTCP(int port) char buf[INET_ADDRSTRLEN] = ""; struct sockaddr_in *sin = (struct sockaddr_in*) res->ai_addr; if( inet_ntop(res->ai_family, &sin->sin_addr, buf, sizeof(buf)) != NULL ) - log("Console: listening on %s : %d", buf, ntohs(sin->sin_port)); + cocos2d::log("Console: listening on %s : %d", buf, ntohs(sin->sin_port)); else perror("inet_ntop"); } else if (res->ai_family == AF_INET6) { char buf[INET6_ADDRSTRLEN] = ""; struct sockaddr_in6 *sin = (struct sockaddr_in6*) res->ai_addr; if( inet_ntop(res->ai_family, &sin->sin6_addr, buf, sizeof(buf)) != NULL ) - log("Console: listening on %s : %d", buf, ntohs(sin->sin6_port)); + cocos2d::log("Console: listening on %s : %d", buf, ntohs(sin->sin6_port)); else perror("inet_ntop"); } @@ -226,14 +278,18 @@ bool Console::listenOnTCP(int port) bool Console::listenOnFileDescriptor(int fd) { - CCASSERT(!_running, "already running"); + if(_running) { + cocos2d::log("Console already started. 'stop' it before calling 'listen' again"); + return false; + } + _listenfd = fd; _thread = std::thread( std::bind( &Console::loop, this) ); return true; } -void Console::cancel() +void Console::stop() { if( _running ) { _endThread = true; @@ -312,7 +368,7 @@ bool Console::parseCommand(int fd) } } - if(!found) { + if(!found && strcmp(_buffer, "\r\n")!=0) { const char err[] = "Unknown command. Type 'help' for options\n"; write(fd, err, sizeof(err)); } @@ -376,6 +432,15 @@ void Console::addClient() } } +void Console::log(const char* buf) +{ + if( _sendDebugStrings ) { + _DebugStringsMutex.lock(); + _DebugStrings.push_back(buf); + _DebugStringsMutex.unlock(); + } +} + // // Main Loop // @@ -402,40 +467,55 @@ void Console::loop() timeout_copy = timeout; int nready = select(_maxfd+1, ©_set, NULL, NULL, &timeout_copy); - if( nready == -1 ) { - /* error ?*/ + if( nready == -1 ) + { + /* error */ if(errno != EINTR) log("Abnormal error in select()\n"); continue; - - } else if( nready == 0 ) { - /* timeout ? */ - continue; } - - // new client - if(FD_ISSET(_listenfd, ©_set)) { - addClient(); - if(--nready <= 0) - continue; + else if( nready == 0 ) + { + /* timeout. do somethig ? */ } - - // data from client - std::vector to_remove; - for(const auto &fd: _fds) { - if(FD_ISSET(fd,©_set)) { - if( ! parseCommand(fd) ) { - to_remove.push_back(fd); - } + else + { + /* new client */ + if(FD_ISSET(_listenfd, ©_set)) { + addClient(); if(--nready <= 0) - break; + continue; + } + + /* data from client */ + std::vector to_remove; + for(const auto &fd: _fds) { + if(FD_ISSET(fd,©_set)) { + if( ! parseCommand(fd) ) { + to_remove.push_back(fd); + } + if(--nready <= 0) + break; + } + } + + /* remove closed conections */ + for(int fd: to_remove) { + FD_CLR(fd, &_read_set); + _fds.erase(std::remove(_fds.begin(), _fds.end(), fd), _fds.end()); } } - // remove closed conections - for(int fd: to_remove) { - FD_CLR(fd, &_read_set); - _fds.erase(std::remove(_fds.begin(), _fds.end(), fd), _fds.end()); + /* Any message for the remote console ? send it! */ + if( !_DebugStrings.empty() ) { + _DebugStringsMutex.lock(); + for(const auto &str : _DebugStrings) { + for(const auto &fd : _fds) { + write(fd, str.c_str(), str.length()); + } + } + _DebugStrings.clear(); + _DebugStringsMutex.unlock(); } } diff --git a/cocos/base/CCConsole.h b/cocos/base/CCConsole.h index 1334ec9506..eb27bcfb34 100644 --- a/cocos/base/CCConsole.h +++ b/cocos/base/CCConsole.h @@ -28,6 +28,7 @@ #if defined(_MSC_VER) || defined(__MINGW32__) #include +#include //typedef SSIZE_T ssize_t; // ssize_t was redefined as int in libwebsockets.h. // Therefore, to avoid conflict, we needs the same definition. @@ -39,13 +40,26 @@ typedef int ssize_t; #include #include #include +#include +#include + +#include #include "ccMacros.h" -#include "CCObject.h" +#include "CCPlatformMacros.h" NS_CC_BEGIN +/// The max length of CCLog message. +static const int MAX_LOG_LENGTH = 16*1024; + +/** + @brief Output Debug message. + */ +void CC_DLL log(const char * format, ...) CC_FORMAT_PRINTF(1, 2); +void CC_DLL log(const char * format, va_list args); + /** Console is helper class that lets the developer control the game from TCP connection. Console will spawn a new thread that will listen to a specified TCP port. Console has a basic token parser. Each token is associated with an std::function. @@ -55,17 +69,19 @@ NS_CC_BEGIN scheduler->performFunctionInCocosThread( ... ); ``` */ -class CC_DLL Console : public Object +class CC_DLL Console { public: - struct Command { const char *name; std::function callback; }; - /** creates a new instnace of the Console */ - static Console* create(); + /** Constructor */ + Console(); + + /** Destructor */ + virtual ~Console(); /** starts listening to specifed TCP port */ bool listenOnTCP(int port); @@ -73,18 +89,17 @@ public: /** starts listening to specifed file descriptor */ bool listenOnFileDescriptor(int fd); - /** cancels the Console. Cancel will be called at destruction time as well */ - void cancel(); + /** stops the Console. 'stop' will be called at destruction time as well */ + void stop(); /** sets user tokens */ void setUserCommands( Command* commands, int numberOfCommands); + /** log something in the console */ + void log(const char *buf); + protected: - Console(); - virtual ~Console(); - void loop(); - ssize_t readline(int fd); bool parseCommand(int fd); void sendPrompt(int fd); @@ -108,11 +123,17 @@ protected: char _buffer[512]; - struct Command _commands[15]; + struct Command _commands[64]; int _maxCommands; struct Command *_userCommands; int _maxUserCommands; + + // strings generated by cocos2d sent to the remote console + bool _sendDebugStrings; + std::mutex _DebugStringsMutex; + std::vector _DebugStrings; + private: CC_DISALLOW_COPY_AND_ASSIGN(Console); }; diff --git a/cocos/base/CCObject.h b/cocos/base/CCObject.h index 28bb7da247..2280508856 100644 --- a/cocos/base/CCObject.h +++ b/cocos/base/CCObject.h @@ -28,6 +28,7 @@ THE SOFTWARE. #include "CCDataVisitor.h" #include "ccMacros.h" +#include "CCConsole.h" #ifdef EMSCRIPTEN #include diff --git a/cocos/scripting/auto-generated b/cocos/scripting/auto-generated index f893f6202c..f41186e7ef 160000 --- a/cocos/scripting/auto-generated +++ b/cocos/scripting/auto-generated @@ -1 +1 @@ -Subproject commit f893f6202c6f249f52660876278a1742ba12aefa +Subproject commit f41186e7ef4209597d8c81952c3535b02305a79c diff --git a/cocos/scripting/javascript/bindings/ScriptingCore.cpp b/cocos/scripting/javascript/bindings/ScriptingCore.cpp index 68ad517f8e..6510b90167 100644 --- a/cocos/scripting/javascript/bindings/ScriptingCore.cpp +++ b/cocos/scripting/javascript/bindings/ScriptingCore.cpp @@ -200,12 +200,12 @@ void js_log(const char *format, ...) { if (_js_log_buf == NULL) { - _js_log_buf = (char *)calloc(sizeof(char), kMaxLogLen+1); - _js_log_buf[kMaxLogLen] = '\0'; + _js_log_buf = (char *)calloc(sizeof(char), MAX_LOG_LENGTH+1); + _js_log_buf[MAX_LOG_LENGTH] = '\0'; } va_list vl; va_start(vl, format); - int len = vsnprintf(_js_log_buf, kMaxLogLen, format, vl); + int len = vsnprintf(_js_log_buf, MAX_LOG_LENGTH, format, vl); va_end(vl); if (len > 0) { diff --git a/extensions/physics-nodes/CCPhysicsSprite.cpp b/extensions/physics-nodes/CCPhysicsSprite.cpp index fa3772fc70..93ce054384 100644 --- a/extensions/physics-nodes/CCPhysicsSprite.cpp +++ b/extensions/physics-nodes/CCPhysicsSprite.cpp @@ -19,10 +19,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#if (CC_ENABLE_CHIPMUNK_INTEGRATION || CC_ENABLE_BOX2D_INTEGRATION) #include "CCPhysicsSprite.h" -#if defined(CC_ENABLE_CHIPMUNK_INTEGRATION) && defined(CC_ENABLE_BOX2D_INTEGRATION) +#if (CC_ENABLE_CHIPMUNK_INTEGRATION && CC_ENABLE_BOX2D_INTEGRATION) #error "Either Chipmunk or Box2d should be enabled, but not both at the same time" #endif @@ -406,3 +407,4 @@ const kmMat4& PhysicsSprite::getNodeToParentTransform() const } NS_CC_EXT_END +#endif //(CC_ENABLE_CHIPMUNK_INTEGRATION || CC_ENABLE_BOX2D_INTEGRATION) diff --git a/extensions/physics-nodes/CCPhysicsSprite.h b/extensions/physics-nodes/CCPhysicsSprite.h index 50eb8a4158..fcedfca031 100644 --- a/extensions/physics-nodes/CCPhysicsSprite.h +++ b/extensions/physics-nodes/CCPhysicsSprite.h @@ -19,6 +19,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#if (CC_ENABLE_CHIPMUNK_INTEGRATION || CC_ENABLE_BOX2D_INTEGRATION) + #ifndef __PHYSICSNODES_CCPHYSICSSPRITE_H__ #define __PHYSICSNODES_CCPHYSICSSPRITE_H__ @@ -132,3 +134,4 @@ protected: NS_CC_EXT_END #endif // __PHYSICSNODES_CCPHYSICSSPRITE_H__ +#endif //(CC_ENABLE_CHIPMUNK_INTEGRATION || CC_ENABLE_BOX2D_INTEGRATION) diff --git a/samples/Cpp/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.cpp b/samples/Cpp/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.cpp index 3cf942b540..c05bb831cd 100644 --- a/samples/Cpp/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #include "ActionsEaseTest.h" #include "../testResource.h" diff --git a/samples/Cpp/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.h b/samples/Cpp/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.h index 7751439668..443c532f32 100644 --- a/samples/Cpp/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.h +++ b/samples/Cpp/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #ifndef _ACTIONS__EASE_TEST_H_ #define _ACTIONS__EASE_TEST_H_ diff --git a/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp b/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp index e6c552db69..42f3774e3b 100644 --- a/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #include "ActionsProgressTest.h" #include "../testResource.h" diff --git a/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.h b/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.h index 1d63fea276..9e16818164 100644 --- a/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.h +++ b/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #ifndef _ACTIONS__PROGRESS_TEST_H_ #define _ACTIONS_PROGRESS_TEST_H_ diff --git a/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp b/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp index 229d6f11e6..fa40b74f0a 100644 --- a/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #include "ActionsTest.h" #include "../testResource.h" #include "cocos2d.h" diff --git a/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.h b/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.h index b5be2b348b..949ad43a38 100644 --- a/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.h +++ b/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #ifndef _ActionsTest_H_ #define _ActionsTest_H_ diff --git a/samples/Cpp/TestCpp/Classes/AppDelegate.cpp b/samples/Cpp/TestCpp/Classes/AppDelegate.cpp index 3243c8f05c..285d9b17ae 100644 --- a/samples/Cpp/TestCpp/Classes/AppDelegate.cpp +++ b/samples/Cpp/TestCpp/Classes/AppDelegate.cpp @@ -82,6 +82,10 @@ bool AppDelegate::applicationDidFinishLaunching() scene->addChild(layer); director->runWithScene(scene); + // Enable Remote Console + auto console = director->getConsole(); + console->listenOnTCP(5678); + return true; } diff --git a/samples/Cpp/TestCpp/Classes/ConsoleTest/ConsoleTest.cpp b/samples/Cpp/TestCpp/Classes/ConsoleTest/ConsoleTest.cpp index d5827c25cb..c4269ea2e9 100644 --- a/samples/Cpp/TestCpp/Classes/ConsoleTest/ConsoleTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ConsoleTest/ConsoleTest.cpp @@ -133,13 +133,11 @@ void ConsoleTestScene::runThisTest() ConsoleTCP::ConsoleTCP() { - _console = Console::create(); - _console->retain(); + _console = Director::getInstance()->getConsole(); } ConsoleTCP::~ConsoleTCP() { - _console->release(); } void ConsoleTCP::onEnter() @@ -167,8 +165,7 @@ std::string ConsoleTCP::subtitle() const ConsoleCustomCommand::ConsoleCustomCommand() { - _console = Console::create(); - _console->retain(); + _console = Director::getInstance()->getConsole(); static struct Console::Command commands[] = { {"hello", [](int fd, const char* command) { @@ -183,7 +180,6 @@ ConsoleCustomCommand::ConsoleCustomCommand() ConsoleCustomCommand::~ConsoleCustomCommand() { - _console->release(); } void ConsoleCustomCommand::onEnter() diff --git a/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp b/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp index e91fcdb3f6..f4da9b94c8 100644 --- a/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp +++ b/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #include "MenuTest.h" #include "../testResource.h" diff --git a/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.h b/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.h index db6e0a918d..1910968546 100644 --- a/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.h +++ b/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #ifndef _MENU_TEST_H_ #define _MENU_TEST_H_ diff --git a/samples/Cpp/TestCpp/Classes/NodeTest/NodeTest.cpp b/samples/Cpp/TestCpp/Classes/NodeTest/NodeTest.cpp index 843b72bbb6..4d69c14542 100644 --- a/samples/Cpp/TestCpp/Classes/NodeTest/NodeTest.cpp +++ b/samples/Cpp/TestCpp/Classes/NodeTest/NodeTest.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #include "NodeTest.h" #include "../testResource.h" @@ -1021,7 +1046,18 @@ CameraTest2::CameraTest2() _sprite2->setPosition( Point(3*s.width/4, s.height/2) ); _sprite2->setScale(0.5); - scheduleUpdate(); + kmVec3 eye, center, up; + + kmVec3Fill(&eye, 150, 0, 200); + kmVec3Fill(¢er, 0, 0, 0); + kmVec3Fill(&up, 0, 1, 0); + + kmMat4 lookupMatrix; + kmMat4LookAt(&lookupMatrix, &eye, ¢er, &up); + + _sprite1->setAdditionalTransform(lookupMatrix); + _sprite2->setAdditionalTransform(lookupMatrix); + } std::string CameraTest2::title() const @@ -1034,22 +1070,6 @@ std::string CameraTest2::subtitle() const return "Both images should look the same"; } -void CameraTest2::update(float dt) -{ - kmVec3 eye, center, up; - - kmVec3Fill(&eye, 150, 0, 200); - kmVec3Fill(¢er, 0, 0, 0); - kmVec3Fill(&up, 0, 1, 0); - - - kmMat4 lookupMatrix; - kmMat4LookAt(&lookupMatrix, &eye, ¢er, &up); - - _sprite1->setAdditionalTransform(lookupMatrix); - _sprite2->setAdditionalTransform(lookupMatrix); -} - /// /// main /// diff --git a/samples/Cpp/TestCpp/Classes/NodeTest/NodeTest.h b/samples/Cpp/TestCpp/Classes/NodeTest/NodeTest.h index 7a6a63d7c2..2207c65f7c 100644 --- a/samples/Cpp/TestCpp/Classes/NodeTest/NodeTest.h +++ b/samples/Cpp/TestCpp/Classes/NodeTest/NodeTest.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #ifndef _NODE_TEST_H_ #define _NODE_TEST_H_ @@ -184,7 +209,6 @@ public: virtual void onExit() override; protected: - virtual void update(float dt) override; CameraTest2(); Sprite *_sprite1; diff --git a/samples/Cpp/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id b/samples/Cpp/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id index d3578f7962..8f885e907c 100644 --- a/samples/Cpp/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id +++ b/samples/Cpp/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id @@ -1 +1 @@ -e14a3c9f23fccd862ac2ffcba41ee7094ab54981 \ No newline at end of file +689b357d7acda141d13a3dfc4cb52aabb274f6cd \ No newline at end of file diff --git a/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp b/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp index 7a096c25cb..95bcb47323 100644 --- a/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp +++ b/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + // local import #include "Texture2dTest.h" #include "../testResource.h" diff --git a/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.h b/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.h index cafc812e77..c331e0d254 100644 --- a/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.h +++ b/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #ifndef __TEXTURE2D_TEST_H__ #define __TEXTURE2D_TEST_H__ diff --git a/samples/Cpp/TestCpp/Classes/TransitionsTest/TransitionsTest.cpp b/samples/Cpp/TestCpp/Classes/TransitionsTest/TransitionsTest.cpp index 728901b809..7c71d0799e 100644 --- a/samples/Cpp/TestCpp/Classes/TransitionsTest/TransitionsTest.cpp +++ b/samples/Cpp/TestCpp/Classes/TransitionsTest/TransitionsTest.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #include "TransitionsTest.h" #include "../testResource.h" #include "CCConfiguration.h" diff --git a/samples/Cpp/TestCpp/Classes/TransitionsTest/TransitionsTest.h b/samples/Cpp/TestCpp/Classes/TransitionsTest/TransitionsTest.h index ccf7ba3100..c923409816 100644 --- a/samples/Cpp/TestCpp/Classes/TransitionsTest/TransitionsTest.h +++ b/samples/Cpp/TestCpp/Classes/TransitionsTest/TransitionsTest.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + #ifndef _TRANSITIONS_TEST_H_ #define _TRANSITIONS_TEST_H_ diff --git a/tools/jenkins-scripts/ghprb.py b/tools/jenkins-scripts/pull-request-builder.py similarity index 100% rename from tools/jenkins-scripts/ghprb.py rename to tools/jenkins-scripts/pull-request-builder.py diff --git a/tools/project-creator/module/ui.py b/tools/project-creator/module/ui.py index 7ad74f302d..98d261cbf0 100644 --- a/tools/project-creator/module/ui.py +++ b/tools/project-creator/module/ui.py @@ -120,23 +120,23 @@ class TkCocosDialog(Frame): self.rowconfigure(5, weight=1) # project name frame - self.labName = Label(self, text="projectName:") + self.labName = Label(self, text="Project Name:") self.strName = StringVar() self.strName.set("MyGame") self.editName = Entry(self, textvariable=self.strName) self.labName.grid(sticky=W, pady=4, padx=5) - self.editName.grid(row=0, column=1, columnspan=3,padx=5, pady=2,sticky=E+W) + self.editName.grid(row=0, column=1, columnspan=4,padx=5, pady=2,sticky=E+W) # package name frame - self.labPackage = Label(self, text="packageName:") + self.labPackage = Label(self, text="Package Name:") self.strPackage=StringVar() self.strPackage.set("com.MyCompany.AwesomeGame") self.editPackage = Entry(self, textvariable=self.strPackage) self.labPackage.grid(row=1, column=0,sticky=W, padx=5) - self.editPackage.grid(row=1, column=1, columnspan=3,padx=5, pady=2,sticky=E+W) + self.editPackage.grid(row=1, column=1, columnspan=4,padx=5, pady=2,sticky=E+W) # project path frame - self.labPath = Label(self, text="projectPath:") + self.labPath = Label(self, text="Project Path:") self.editPath = Entry(self) self.btnPath = Button(self, text="...", width = 6, command = self.pathCallback) self.labPath.grid(row=2, column=0,sticky=W, pady=4, padx=5) @@ -144,12 +144,12 @@ class TkCocosDialog(Frame): self.btnPath.grid(row=2, column=4,) # language frame - self.labLanguage = Label(self, text="language:") + self.labLanguage = Label(self, text="Language:") self.var=IntVar() self.var.set(1) - self.checkcpp = Radiobutton(self, text="cpp", variable=self.var, value=1) - self.checklua = Radiobutton(self, text="lua", variable=self.var, value=2) - self.checkjs = Radiobutton(self, text="javascript", variable=self.var, value=3) + self.checkcpp = Radiobutton(self, text="C++", variable=self.var, value=1) + self.checklua = Radiobutton(self, text="Lua", variable=self.var, value=2) + self.checkjs = Radiobutton(self, text="JavaScript", variable=self.var, value=3) self.labLanguage.grid(row=3, column=0,sticky=W, padx=5) self.checkcpp.grid(row=3, column=1,sticky=N+W) self.checklua.grid(row=3, column=2,padx=5,sticky=N+W) @@ -158,12 +158,12 @@ class TkCocosDialog(Frame): # show progress self.progress = Scale(self, state= DISABLED, from_=0, to=100, orient=HORIZONTAL) self.progress.set(0) - self.progress.grid(row=4, column=0, columnspan=4,padx=5, pady=2,sticky=E+W+S+N) + self.progress.grid(row=4, column=0, columnspan=5,padx=5, pady=2,sticky=E+W+S+N) # msg text frame self.text=Text(self,background = '#d9efff') self.text.bind("", lambda e : "break") - self.text.grid(row=5, column=0, columnspan=4, rowspan=1, padx=5, sticky=E+W+S+N) + self.text.grid(row=5, column=0, columnspan=5, rowspan=1, padx=5, sticky=E+W+S+N) # new project button self.btnCreate = Button(self, text="create", command = self.createBtnCallback) @@ -176,7 +176,7 @@ class TkCocosDialog(Frame): scnHeight = self.parent.winfo_screenheight() tmpcnf = '%dx%d+%d+%d'%(curWidth, curHeight, int((scnWidth-curWidth)/2), int((scnHeight-curHeight)/2)) self.parent.geometry(tmpcnf) - self.parent.title("CocosCreateProject") + self.parent.title("Cocos Project Creator") #fix size #self.parent.maxsize(curWidth, curHeight)