diff --git a/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id b/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id index 7e2a12a92c..6bd7470d8b 100644 --- a/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -1ab0fd6fdad74af8ce054c089d8571a05a7a04d8 \ No newline at end of file +d4930675bbb21e1d9e49d7df7515af349e2ffdb7 \ No newline at end of file diff --git a/cocos2dx/Android.mk b/cocos2dx/Android.mk index 915a53087a..39fb290244 100644 --- a/cocos2dx/Android.mk +++ b/cocos2dx/Android.mk @@ -82,7 +82,6 @@ platform/CCImageCommonWebp.cpp \ platform/CCSAXParser.cpp \ platform/CCThread.cpp \ platform/CCFileUtils.cpp \ -platform/platform.cpp \ platform/CCEGLViewProtocol.cpp \ platform/android/CCDevice.cpp \ platform/android/CCEGLView.cpp \ diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index 1bdec1e4aa..278706cb5b 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -24,11 +24,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ +// cocos2d includes +#include "CCDirector.h" + // standard includes #include -// cocos2d includes -#include "CCDirector.h" #include "ccFPSImages.h" #include "draw_nodes/CCDrawingPrimitives.h" #include "CCConfiguration.h" @@ -43,7 +44,6 @@ THE SOFTWARE. #include "textures/CCTextureCache.h" #include "sprite_nodes/CCSpriteFrameCache.h" #include "cocoa/CCAutoreleasePool.h" -#include "platform/platform.h" #include "platform/CCFileUtils.h" #include "CCApplication.h" #include "label_nodes/CCLabelBMFont.h" @@ -134,7 +134,7 @@ bool Director::init(void) _drawsLabel = NULL; _totalFrames = _frames = 0; _FPS = new char[10]; - _lastUpdate = new struct cc_timeval(); + _lastUpdate = new struct timeval; // paused ? _paused = false; @@ -311,9 +311,9 @@ void Director::drawScene(void) void Director::calculateDeltaTime(void) { - struct cc_timeval now; + struct timeval now; - if (Time::gettimeofdayCocos2d(&now, NULL) != 0) + if (gettimeofday(&now, NULL) != 0) { CCLOG("error in gettimeofday"); _deltaTime = 0; @@ -794,7 +794,7 @@ void Director::resume(void) setAnimationInterval(_oldAnimationInterval); - if (Time::gettimeofdayCocos2d(_lastUpdate, NULL) != 0) + if (gettimeofday(_lastUpdate, NULL) != 0) { CCLOG("cocos2d: Director: Error in gettimeofday"); } @@ -841,8 +841,8 @@ void Director::showStats(void) void Director::calculateMPF() { - struct cc_timeval now; - Time::gettimeofdayCocos2d(&now, NULL); + struct timeval now; + gettimeofday(&now, NULL); _secondsPerFrame = (now.tv_sec - _lastUpdate->tv_sec) + (now.tv_usec - _lastUpdate->tv_usec) / 1000000.0f; } @@ -1050,7 +1050,7 @@ Accelerometer* Director::getAccelerometer() // so we now only support DisplayLinkDirector void DisplayLinkDirector::startAnimation(void) { - if (Time::gettimeofdayCocos2d(_lastUpdate, NULL) != 0) + if (gettimeofday(_lastUpdate, NULL) != 0) { CCLOG("cocos2d: DisplayLinkDirector: Error on gettimeofday"); } diff --git a/cocos2dx/CCDirector.h b/cocos2dx/CCDirector.h index 0e3ffa1bea..17008baa4a 100644 --- a/cocos2dx/CCDirector.h +++ b/cocos2dx/CCDirector.h @@ -28,6 +28,7 @@ THE SOFTWARE. #define __CCDIRECTOR_H__ #include "platform/CCPlatformMacros.h" + #include "cocoa/CCObject.h" #include "ccTypes.h" #include "cocoa/CCGeometry.h" @@ -405,7 +406,7 @@ protected: Array* _scenesStack; /* last time the main loop was updated */ - struct cc_timeval *_lastUpdate; + struct timeval *_lastUpdate; /* whether or not the next delta time will be zero */ bool _nextDeltaTimeZero; diff --git a/cocos2dx/effects/CCGrabber.cpp b/cocos2dx/effects/CCGrabber.cpp index 95a8d36336..6e505c715e 100644 --- a/cocos2dx/effects/CCGrabber.cpp +++ b/cocos2dx/effects/CCGrabber.cpp @@ -25,7 +25,6 @@ THE SOFTWARE. #include "CCGrabber.h" #include "ccMacros.h" #include "textures/CCTexture2D.h" -#include "platform/platform.h" NS_CC_BEGIN diff --git a/cocos2dx/include/cocos2d.h b/cocos2dx/include/cocos2d.h index 67c003d0ff..4029dbad47 100755 --- a/cocos2dx/include/cocos2d.h +++ b/cocos2dx/include/cocos2d.h @@ -130,7 +130,6 @@ THE SOFTWARE. #include "platform/CCImage.h" #include "platform/CCSAXParser.h" #include "platform/CCThread.h" -#include "platform/platform.h" #include "platform/CCPlatformConfig.h" #include "platform/CCPlatformMacros.h" diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index dda4ac645b..16da223a0c 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -32,7 +32,6 @@ http://www.angelcode.com/products/bmfont/ (Free, Windows only) ****************************************************************************/ #include "CCLabelBMFont.h" #include "cocoa/CCString.h" -#include "platform/platform.h" #include "cocoa/CCDictionary.h" #include "CCConfiguration.h" #include "draw_nodes/CCDrawingPrimitives.h" diff --git a/cocos2dx/misc_nodes/CCRenderTexture.cpp b/cocos2dx/misc_nodes/CCRenderTexture.cpp index c72d44c947..7143a38542 100644 --- a/cocos2dx/misc_nodes/CCRenderTexture.cpp +++ b/cocos2dx/misc_nodes/CCRenderTexture.cpp @@ -26,7 +26,6 @@ THE SOFTWARE. #include "CCConfiguration.h" #include "misc_nodes/CCRenderTexture.h" #include "CCDirector.h" -#include "platform/platform.h" #include "platform/CCImage.h" #include "shaders/CCGLProgram.h" #include "shaders/ccGLStateCache.h" diff --git a/cocos2dx/particle_nodes/CCParticleSystem.cpp b/cocos2dx/particle_nodes/CCParticleSystem.cpp index 96754b381b..913549293e 100644 --- a/cocos2dx/particle_nodes/CCParticleSystem.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystem.cpp @@ -49,7 +49,6 @@ THE SOFTWARE. #include "support/base64.h" #include "platform/CCFileUtils.h" #include "platform/CCImage.h" -#include "platform/platform.h" #include "support/zip_support/ZipUtils.h" #include "CCDirector.h" #include "support/CCProfiling.h" diff --git a/cocos2dx/platform/platform.cpp b/cocos2dx/platform/platform.cpp deleted file mode 100644 index aa2e8ccc08..0000000000 --- a/cocos2dx/platform/platform.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org - -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 "platform.h" - -#include "CCStdC.h" - -NS_CC_BEGIN - -int Time::gettimeofdayCocos2d(struct cc_timeval *tp, void *tzp) -{ - CC_UNUSED_PARAM(tzp); - if (tp) - { - gettimeofday((struct timeval *)tp, 0); - } - return 0; -} - -double Time::timersubCocos2d(struct cc_timeval *start, struct cc_timeval *end) -{ - if (! start || ! end) - { - return 0; - } - - return ((end->tv_sec*1000.0+end->tv_usec/1000.0) - (start->tv_sec*1000.0+start->tv_usec/1000.0)); -} - -NS_CC_END diff --git a/cocos2dx/platform/platform.h b/cocos2dx/platform/platform.h deleted file mode 100644 index d457109566..0000000000 --- a/cocos2dx/platform/platform.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org - -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 __PLATFORM_H__ -#define __PLATFORM_H__ - -#include "CCThread.h" -#include "CCPlatformMacros.h" - -NS_CC_BEGIN - -/** - * @addtogroup platform - * @{ - */ - -struct CC_DLL cc_timeval -{ -#ifdef __native_client__ - time_t tv_sec; // seconds -#else - long tv_sec; // seconds -#endif - int tv_usec; // microSeconds -}; - -class CC_DLL Time -{ -public: - static int gettimeofdayCocos2d(struct cc_timeval *tp, void *tzp); - static double timersubCocos2d(struct cc_timeval *start, struct cc_timeval *end); -}; - -// end of platform group -/// @} - -NS_CC_END - -#endif // __PLATFORM_H__ diff --git a/cocos2dx/proj.linux/Makefile b/cocos2dx/proj.linux/Makefile index 6659f2ac69..b077cf08b0 100644 --- a/cocos2dx/proj.linux/Makefile +++ b/cocos2dx/proj.linux/Makefile @@ -63,7 +63,6 @@ SOURCES = ../actions/CCAction.cpp \ ../particle_nodes/CCParticleBatchNode.cpp \ ../platform/CCSAXParser.cpp \ ../platform/CCThread.cpp \ -../platform/platform.cpp \ ../platform/CCImageCommonWebp.cpp \ ../platform/CCEGLViewProtocol.cpp \ ../platform/CCFileUtils.cpp \ diff --git a/cocos2dx/proj.nacl/Makefile b/cocos2dx/proj.nacl/Makefile index d44de4199c..f5a37dda8c 100644 --- a/cocos2dx/proj.nacl/Makefile +++ b/cocos2dx/proj.nacl/Makefile @@ -57,7 +57,6 @@ SOURCES = ../actions/CCAction.cpp \ ../particle_nodes/CCParticleBatchNode.cpp \ ../platform/CCSAXParser.cpp \ ../platform/CCThread.cpp \ -../platform/platform.cpp \ ../platform/CCImageCommonWebp.cpp \ ../platform/CCEGLViewProtocol.cpp \ ../platform/CCFileUtils.cpp \ diff --git a/cocos2dx/support/CCProfiling.cpp b/cocos2dx/support/CCProfiling.cpp index 12a334f4a7..011c1cfcce 100644 --- a/cocos2dx/support/CCProfiling.cpp +++ b/cocos2dx/support/CCProfiling.cpp @@ -141,7 +141,7 @@ void ProfilingBeginTimingBlock(const char *timerName) timer = p->createAndAddTimerWithName(timerName); } - gettimeofday((struct timeval *)&timer->_startTime, NULL); + gettimeofday(&timer->_startTime, NULL); timer->numberOfCalls++; } @@ -156,7 +156,8 @@ void ProfilingEndTimingBlock(const char *timerName) struct timeval currentTime; gettimeofday(¤tTime, NULL); - double duration = Time::timersubCocos2d((struct cc_timeval *)&timer->_startTime, (struct cc_timeval *)¤tTime); + double duration = (currentTime.tv_sec*1000.0 + currentTime.tv_usec/1000.0) - + (timer->_startTime.tv_sec*1000.0 + timer->_startTime.tv_usec/1000.0); // milliseconds timer->_averageTime = (timer->_averageTime + duration) / 2.0f; diff --git a/cocos2dx/support/CCProfiling.h b/cocos2dx/support/CCProfiling.h index 56df4393d7..673980e603 100644 --- a/cocos2dx/support/CCProfiling.h +++ b/cocos2dx/support/CCProfiling.h @@ -27,7 +27,6 @@ THE SOFTWARE. #include "ccConfig.h" #include "cocoa/CCObject.h" -#include "platform/platform.h" #include "cocoa/CCDictionary.h" #include @@ -76,14 +75,14 @@ public: bool initWithName(const char* timerName); ~ProfilingTimer(void); const char* description(void) const; - inline struct cc_timeval * getStartTime(void) { return &_startTime; }; + inline struct timeval * getStartTime(void) { return &_startTime; }; inline void setAverageTime(double value) { _averageTime = value; } inline double getAverageTime(void) { return _averageTime; } /** resets the timer properties */ void reset(); std::string _nameStr; - struct cc_timeval _startTime; + struct timeval _startTime; double _averageTime; double minTime; double maxTime; diff --git a/cocos2dx/textures/CCTexture2D.cpp b/cocos2dx/textures/CCTexture2D.cpp index 9866329fc7..6784a61bdc 100644 --- a/cocos2dx/textures/CCTexture2D.cpp +++ b/cocos2dx/textures/CCTexture2D.cpp @@ -34,7 +34,6 @@ THE SOFTWARE. #include "ccConfig.h" #include "ccMacros.h" #include "CCConfiguration.h" -#include "platform/platform.h" #include "platform/CCImage.h" #include "CCGL.h" #include "support/ccUtils.h" diff --git a/cocos2dx/textures/CCTextureCache.cpp b/cocos2dx/textures/CCTextureCache.cpp index 381687fd64..089e4835f2 100644 --- a/cocos2dx/textures/CCTextureCache.cpp +++ b/cocos2dx/textures/CCTextureCache.cpp @@ -33,7 +33,6 @@ THE SOFTWARE. #include "CCTexture2D.h" #include "ccMacros.h" #include "CCDirector.h" -#include "platform/platform.h" #include "platform/CCFileUtils.h" #include "platform/CCThread.h" #include "support/ccUtils.h" diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXXMLParser.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXXMLParser.cpp index 9927f411de..631dddd5af 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXXMLParser.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXXMLParser.cpp @@ -33,7 +33,6 @@ THE SOFTWARE. #include "platform/CCFileUtils.h" #include "support/zip_support/ZipUtils.h" #include "support/base64.h" -#include "platform/platform.h" using namespace std; /* diff --git a/samples/Cpp/TestCpp/Classes/TextureCacheTest/TextureCacheTest.h b/samples/Cpp/TestCpp/Classes/TextureCacheTest/TextureCacheTest.h index 1e69a0c7ab..fed36cad2d 100644 --- a/samples/Cpp/TestCpp/Classes/TextureCacheTest/TextureCacheTest.h +++ b/samples/Cpp/TestCpp/Classes/TextureCacheTest/TextureCacheTest.h @@ -4,7 +4,6 @@ #include "cocos2d.h" #include "../testBasic.h" -#include "platform/platform.h" class TextureCacheTest : public Layer {