├── .gitignore ├── Classes ├── AppDelegate.cpp ├── AppDelegate.h ├── HelloWorldScene.cpp ├── HelloWorldScene.h ├── PanZoomLayer.cpp └── PanZoomLayer.h ├── README.md ├── Resources ├── CloseNormal.png ├── CloseSelected.png ├── Fishfam_base_TH8.jpg ├── HelloWorld.png ├── HelloWorld2.png └── runatic2.png ├── proj.android ├── .classpath ├── .cproject ├── .project ├── AndroidManifest.xml ├── README.md ├── ant.properties ├── build.xml ├── build_native.sh ├── jni │ ├── Android.mk │ ├── Application.mk │ └── hellocpp │ │ └── main.cpp ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── icon.png │ ├── drawable-ldpi │ │ └── icon.png │ ├── drawable-mdpi │ │ └── icon.png │ └── values │ │ └── strings.xml └── src │ └── my │ └── test │ └── smooth │ └── smooth_panning_zoom.java └── proj.win32 ├── main.cpp ├── main.h ├── smooth_panning_zoom.sln ├── smooth_panning_zoom.vcxproj ├── smooth_panning_zoom.vcxproj.filters └── smooth_panning_zoom.vcxproj.user /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | 15 | 16 | *.sdf 17 | *.suo 18 | *.opensdf 19 | 20 | *.class 21 | *.dex 22 | *.ap_ 23 | *.cache 24 | *.jar 25 | 26 | 27 | **/proj.win32/Debug.win32/ 28 | proj.win32/Debug.win32/ 29 | 30 | **/proj.win32/Release.win32/ 31 | proj.win32/Release.win32/ 32 | 33 | 34 | **/proj.android/assets/ 35 | **/proj.android/obj/ 36 | 37 | 38 | **/proj.linux/ 39 | **/proj.linux/* -------------------------------------------------------------------------------- /Classes/AppDelegate.cpp: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "HelloWorldScene.h" 3 | 4 | USING_NS_CC; 5 | 6 | AppDelegate::AppDelegate() { 7 | 8 | } 9 | 10 | AppDelegate::~AppDelegate() 11 | { 12 | } 13 | 14 | bool AppDelegate::applicationDidFinishLaunching() { 15 | // initialize director 16 | CCDirector* pDirector = CCDirector::sharedDirector(); 17 | CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); 18 | 19 | pDirector->setOpenGLView(pEGLView); 20 | 21 | // turn on display FPS 22 | pDirector->setDisplayStats(true); 23 | 24 | // set FPS. the default value is 1.0/60 if you don't call this 25 | pDirector->setAnimationInterval(1.0 / 60); 26 | 27 | // create a scene. it's an autorelease object 28 | CCScene *pScene = HelloWorld::scene(); 29 | 30 | // run 31 | pDirector->runWithScene(pScene); 32 | 33 | return true; 34 | } 35 | 36 | // This function will be called when the app is inactive. When comes a phone call,it's be invoked too 37 | void AppDelegate::applicationDidEnterBackground() { 38 | CCDirector::sharedDirector()->stopAnimation(); 39 | 40 | // if you use SimpleAudioEngine, it must be pause 41 | // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); 42 | } 43 | 44 | // this function will be called when the app is active again 45 | void AppDelegate::applicationWillEnterForeground() { 46 | CCDirector::sharedDirector()->startAnimation(); 47 | 48 | // if you use SimpleAudioEngine, it must resume here 49 | // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); 50 | } 51 | -------------------------------------------------------------------------------- /Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #ifndef _APP_DELEGATE_H_ 2 | #define _APP_DELEGATE_H_ 3 | 4 | #include "cocos2d.h" 5 | 6 | /** 7 | @brief The cocos2d Application. 8 | 9 | The reason for implement as private inheritance is to hide some interface call by CCDirector. 10 | */ 11 | class AppDelegate : private cocos2d::CCApplication 12 | { 13 | public: 14 | AppDelegate(); 15 | virtual ~AppDelegate(); 16 | 17 | /** 18 | @brief Implement CCDirector and CCScene init code here. 19 | @return true Initialize success, app continue. 20 | @return false Initialize failed, app terminate. 21 | */ 22 | virtual bool applicationDidFinishLaunching(); 23 | 24 | /** 25 | @brief The function be called when the application enter background 26 | @param the pointer of the application 27 | */ 28 | virtual void applicationDidEnterBackground(); 29 | 30 | /** 31 | @brief The function be called when the application enter foreground 32 | @param the pointer of the application 33 | */ 34 | virtual void applicationWillEnterForeground(); 35 | }; 36 | 37 | #endif // _APP_DELEGATE_H_ 38 | 39 | -------------------------------------------------------------------------------- /Classes/HelloWorldScene.cpp: -------------------------------------------------------------------------------- 1 | #include "HelloWorldScene.h" 2 | #include "PanZoomLayer.h" 3 | 4 | USING_NS_CC; 5 | 6 | CCScene* HelloWorld::scene() 7 | { 8 | // 'scene' is an autorelease object 9 | CCScene *scene = CCScene::create(); 10 | 11 | // 'layer' is an autorelease object 12 | HelloWorld *layer = HelloWorld::create(); 13 | 14 | // add layer as a child to scene 15 | scene->addChild(layer); 16 | 17 | // return the scene 18 | return scene; 19 | } 20 | 21 | // on "init" you need to initialize your instance 22 | bool HelloWorld::init() 23 | { 24 | ////////////////////////////// 25 | // 1. super init first 26 | if ( !CCLayer::init() ) 27 | { 28 | return false; 29 | } 30 | 31 | CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); 32 | CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin(); 33 | 34 | ///////////////////////////// 35 | // 2. add a menu item with "X" image, which is clicked to quit the program 36 | // you may modify it. 37 | 38 | // add a "close" icon to exit the progress. it's an autorelease object 39 | CCMenuItemImage *pCloseItem = CCMenuItemImage::create( 40 | "CloseNormal.png", 41 | "CloseSelected.png", 42 | this, 43 | menu_selector(HelloWorld::menuCloseCallback)); 44 | 45 | pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 , 46 | origin.y + pCloseItem->getContentSize().height/2)); 47 | 48 | // create menu, it's an autorelease object 49 | CCMenu* pMenu = CCMenu::create(pCloseItem, NULL); 50 | pMenu->setPosition(CCPointZero); 51 | this->addChild(pMenu, 1); 52 | 53 | ///////////////////////////// 54 | // 3. add your codes below... 55 | 56 | // add a label shows "Hello World" 57 | // create and initialize a label 58 | 59 | CCSprite *map = CCSprite::create( "Fishfam_base_TH8.jpg" ); 60 | map->setOpacity( 150 ); 61 | map->setAnchorPoint( ccp( 0, 0 ) ); 62 | map->setPosition( map->getContentSize() * -0.5 ); 63 | 64 | 65 | PanZoomLayer *pzLayer = PanZoomLayer::create(); 66 | this->addChild( pzLayer ); 67 | 68 | pzLayer->SetPanBoundsRect( CCRectMake( 69 | map->getContentSize().width * -0.5, 70 | map->getContentSize().height * -0.5, 71 | map->getContentSize().width * 1.0, 72 | map->getContentSize().height * 1.0) ); 73 | pzLayer->setScale( 2.0 ); 74 | 75 | pzLayer->addChild( map, -1 ); 76 | //map->setPosition( pzLayer->getContentSize() * 0.5 ); 77 | 78 | CCSprite *mark = CCSprite::create( "HelloWorld.png" ); 79 | map->addChild( mark ); 80 | mark->setPosition( map->getContentSize() * 0.5 ); 81 | 82 | return true; 83 | } 84 | 85 | 86 | void HelloWorld::menuCloseCallback(CCObject* pSender) 87 | { 88 | #if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) 89 | CCMessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert"); 90 | #else 91 | CCDirector::sharedDirector()->end(); 92 | #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) 93 | exit(0); 94 | #endif 95 | #endif 96 | } 97 | -------------------------------------------------------------------------------- /Classes/HelloWorldScene.h: -------------------------------------------------------------------------------- 1 | #ifndef __HELLOWORLD_SCENE_H__ 2 | #define __HELLOWORLD_SCENE_H__ 3 | 4 | #include "cocos2d.h" 5 | 6 | class HelloWorld : public cocos2d::CCLayer 7 | { 8 | public: 9 | // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone 10 | virtual bool init(); 11 | 12 | // there's no 'id' in cpp, so we recommend returning the class instance pointer 13 | static cocos2d::CCScene* scene(); 14 | 15 | // a selector callback 16 | void menuCloseCallback(CCObject* pSender); 17 | 18 | // implement the "static node()" method manually 19 | CREATE_FUNC(HelloWorld); 20 | }; 21 | 22 | #endif // __HELLOWORLD_SCENE_H__ 23 | -------------------------------------------------------------------------------- /Classes/PanZoomLayer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "PanZoomLayer.h" 3 | 4 | PanZoomLayer::PanZoomLayer() 5 | { 6 | 7 | } 8 | 9 | 10 | PanZoomLayer::~PanZoomLayer() 11 | { 12 | 13 | } 14 | 15 | 16 | PanZoomLayer* PanZoomLayer::create() 17 | { 18 | PanZoomLayer *pRet = new PanZoomLayer; 19 | if( pRet && pRet->init() ) 20 | { 21 | pRet->autorelease(); 22 | return pRet; 23 | } 24 | 25 | CC_SAFE_DELETE( pRet ); 26 | return NULL; 27 | } 28 | 29 | 30 | bool PanZoomLayer::init() 31 | { 32 | if( CCLayerColor::initWithColor( ccc4( 0, 0, 255, 0 ) ) == false ) 33 | return false; 34 | 35 | this->setAnchorPoint( ccp( 0, 0 ) ); 36 | 37 | _touches = CCArray::create(); 38 | _touches->retain(); 39 | 40 | _accelerationFactor = 0.0f; 41 | _productFactor = 55.0f; 42 | 43 | _maxScale = 2.5f; 44 | _minScale = 1.0f; 45 | 46 | _isHolding = false; 47 | 48 | return true; 49 | } 50 | 51 | 52 | void PanZoomLayer::onEnter() 53 | { 54 | CCLayer::onEnter(); 55 | CCDirector::sharedDirector()->getScheduler()->scheduleUpdateForTarget(this, 0, false); 56 | 57 | this->setTouchEnabled( true ); 58 | } 59 | 60 | 61 | void PanZoomLayer::onExit() 62 | { 63 | CCDirector::sharedDirector()->getScheduler()->unscheduleAllForTarget( this ); 64 | CCLayer::onExit(); 65 | 66 | _touches->removeAllObjects(); 67 | CC_SAFE_RELEASE_NULL( _touches ); 68 | } 69 | 70 | void PanZoomLayer::update( float dt ) 71 | { 72 | // Skip smoothe panning when dt is high value 73 | if( dt > 1.0f / 55 ) 74 | return; 75 | 76 | CCLayerColor::update( dt ); 77 | 78 | if( _touches->count() == 1 ) 79 | { 80 | _accelerationFactor *= 40 * dt * 0.95f; 81 | } 82 | else if( _touches->count() == 0 ) 83 | { 84 | _accelerationFactor = fabs( _accelerationFactor - 0 ); 85 | if( _accelerationFactor < FLT_EPSILON ) 86 | return; 87 | 88 | if( _accelerationFactor < 0.004f ) 89 | { 90 | _accelerationFactor = 0; 91 | } 92 | else 93 | { 94 | double d = dt * 60; 95 | if( d > 0.99 ) 96 | d = 0.99; 97 | double i = (0 - _accelerationFactor) * 0.025 * d; 98 | 99 | _accelerationFactor = ( _accelerationFactor + i ) * d; 100 | 101 | CCPoint adder = _deltaSum; 102 | adder.x *= this->getContentSize().width; 103 | adder.y *= this->getContentSize().height; 104 | 105 | this->setPosition( this->getPosition() + adder * 2.5 * _accelerationFactor ); 106 | } 107 | } 108 | } 109 | 110 | 111 | void PanZoomLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent) 112 | { 113 | if( _isHolding ) return; 114 | 115 | CCTouch *pTouch; 116 | CCSetIterator setIter; 117 | int cnt = 0; 118 | for (setIter = pTouches->begin(); setIter != pTouches->end(); ++setIter) 119 | { 120 | pTouch = (CCTouch *)(*setIter); 121 | _touches->addObject(pTouch); 122 | } 123 | 124 | _deltaSum = ccp( 0, 0 ); 125 | _accelerationFactor = 0; 126 | CCTime::gettimeofdayCocos2d( &_timeStamp, NULL ); 127 | } 128 | 129 | 130 | void PanZoomLayer::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) 131 | { 132 | if( _isHolding ) return; 133 | 134 | if( _touches->count() == 1 ) 135 | { 136 | CCTouch *touch = (CCTouch*)_touches->objectAtIndex( 0 ); 137 | CCPoint curTouchPosition = CCDirector::sharedDirector()->convertToGL( touch->getLocationInView() ); 138 | CCPoint prevTouchPosition = CCDirector::sharedDirector()->convertToGL( touch->getPreviousLocationInView() ); 139 | CCPoint deltaPosition = curTouchPosition - prevTouchPosition; 140 | this->setPosition( this->getPosition() + deltaPosition ); 141 | 142 | float prevAngle = CC_RADIANS_TO_DEGREES( _prevDeltaPoint.getAngle() ); 143 | float angle = CC_RADIANS_TO_DEGREES( deltaPosition.getAngle() ); 144 | if( fabs( prevAngle - angle ) <= 30 ) 145 | { 146 | _deltaSum = ccp( 0, 0 ); 147 | } 148 | 149 | _prevDeltaPoint = deltaPosition; 150 | 151 | _deltaSum.x = _deltaSum.x + deltaPosition.x / this->getContentSize().width; 152 | _deltaSum.y = _deltaSum.y + deltaPosition.y / this->getContentSize().height; 153 | 154 | _accelerationFactor += _deltaSum.getLength() * 4.0; 155 | } 156 | else if( _touches->count() >= 2 ) 157 | { 158 | // Get the two first touches 159 | CCTouch *touch1 = (CCTouch*)_touches->objectAtIndex(0); 160 | CCTouch *touch2 = (CCTouch*)_touches->objectAtIndex(1); 161 | 162 | // Get current and previous positions of the touches 163 | CCPoint curPosTouch1 = CCDirector::sharedDirector()->convertToGL(touch1->getLocationInView()); 164 | CCPoint curPosTouch2 = CCDirector::sharedDirector()->convertToGL(touch2->getLocationInView()); 165 | CCPoint prevPosTouch1 = CCDirector::sharedDirector()->convertToGL(touch1->getPreviousLocationInView()); 166 | CCPoint prevPosTouch2 = CCDirector::sharedDirector()->convertToGL(touch2->getPreviousLocationInView()); 167 | 168 | // Calculate current and previous positions of the layer relative the anchor point 169 | CCPoint curPosLayer = ccpMidpoint(curPosTouch1, curPosTouch2); 170 | CCPoint prevPosLayer = ccpMidpoint(prevPosTouch1, prevPosTouch2); 171 | 172 | // Calculate new scale 173 | float prevScale = this->getScale(); 174 | float curScale = this->getScale() * ccpDistance(curPosTouch1, curPosTouch2) / ccpDistance(prevPosTouch1, prevPosTouch2); 175 | 176 | this->setScale( curScale ); 177 | 178 | if( this->getScale() != prevScale ) 179 | { 180 | CCPoint realCurPosLayer = this->convertToNodeSpaceAR(curPosLayer); 181 | float deltaX = (realCurPosLayer.x) * (this->getScale() - prevScale); 182 | float deltaY = (realCurPosLayer.y) * (this->getScale() - prevScale); 183 | 184 | this->setPosition(ccp(this->getPosition().x - deltaX, this->getPosition().y - deltaY)); 185 | } 186 | 187 | // If current and previous position of the multitouch's center aren't equal -> change position of the layer 188 | if (!prevPosLayer.equals(curPosLayer)) 189 | { 190 | this->setPosition(ccp(this->getPosition().x + curPosLayer.x - prevPosLayer.x, 191 | this->getPosition().y + curPosLayer.y - prevPosLayer.y)); 192 | } 193 | } 194 | } 195 | 196 | 197 | void PanZoomLayer::ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent) 198 | { 199 | if( _isHolding ) return; 200 | 201 | CCTouch *pTouch; 202 | CCSetIterator setIter; 203 | for (setIter = pTouches->begin(); setIter != pTouches->end(); ++setIter) 204 | { 205 | pTouch = (CCTouch *)(*setIter); 206 | _touches->removeObject(pTouch); 207 | } 208 | } 209 | 210 | 211 | void PanZoomLayer::setPosition( CCPoint position ) 212 | { 213 | CCNode::setPosition( position ); 214 | 215 | if( _panBoundsRect.equals( CCRectZero ) == false ) 216 | { 217 | CCRect boundBox; 218 | boundBox.origin = this->getPosition() / this->getScale(); 219 | boundBox.size = this->getContentSize() / this->getScale(); 220 | //CCLog( "boundBox : origin(%.1f, %.1f), size(%.1f, %.1f)", boundBox.origin.x, boundBox.origin.y, boundBox.size.width, boundBox.size.height ); 221 | 222 | // OpenGL coordinate system 223 | float left = boundBox.getMinX(); 224 | float right = boundBox.getMaxX(); 225 | float top = boundBox.getMaxY(); 226 | float bottom = boundBox.getMinY(); 227 | //CCLog( "left,right(%.1f, %.1f), top,bottom(%.1f, %.1f)", left, right, top, bottom ); 228 | 229 | float min_x = _panBoundsRect.getMinX() + boundBox.size.width; 230 | float max_x = _panBoundsRect.getMaxX() + boundBox.size.width; 231 | float min_y = _panBoundsRect.getMinY() + boundBox.size.height; 232 | float max_y = _panBoundsRect.getMaxY() + boundBox.size.height; 233 | //CCLog( "min(%.1f, %.1f), max(%.1f, %.1f)", min_x, min_y, max_x, max_y ); 234 | 235 | float scale = this->getScale(); 236 | float arLeft = min_x * scale; 237 | float arRight = max_x * scale - this->getContentSize().width; 238 | float arTop = max_y * scale - this->getContentSize().height; 239 | float arBottom = min_y * scale; 240 | 241 | if( left < min_x ) 242 | { 243 | CCNode::setPosition( arLeft, this->getPosition().y ); 244 | } 245 | 246 | if( right > max_x ) 247 | { 248 | CCNode::setPosition( arRight, this->getPosition().y ); 249 | } 250 | 251 | if( top > max_y ) 252 | { 253 | CCNode::setPosition( this->getPosition().x, arTop ); 254 | } 255 | 256 | if( bottom < min_y ) 257 | { 258 | CCNode::setPosition( this->getPosition().x, arBottom ); 259 | } 260 | } 261 | } 262 | 263 | 264 | void PanZoomLayer::setScale( float scale ) 265 | { 266 | CCLayerColor::setScale( MIN( MAX( scale, _minScale ), _maxScale ) ); 267 | this->setPosition( this->getPosition() ); 268 | } 269 | 270 | 271 | void PanZoomLayer::SetPanBoundsRect( CCRect rect ) 272 | { 273 | _panBoundsRect = rect; 274 | 275 | CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); 276 | float wFactor = _panBoundsRect.size.width / visibleSize.width; 277 | float hFactor = _panBoundsRect.size.height / visibleSize.height; 278 | float minScale; 279 | if( wFactor > hFactor ) 280 | minScale = wFactor; 281 | else 282 | minScale = hFactor; 283 | SetMinScale( minScale ); 284 | } 285 | 286 | 287 | void PanZoomLayer::SetMaxScale( float maxScale ) 288 | { 289 | _maxScale = maxScale; 290 | } 291 | 292 | 293 | float PanZoomLayer::GetMaxScale() 294 | { 295 | return _maxScale; 296 | } 297 | 298 | 299 | void PanZoomLayer::SetMinScale( float minScale ) 300 | { 301 | _minScale = minScale; 302 | } 303 | 304 | 305 | float PanZoomLayer::GetMinScale() 306 | { 307 | return _minScale; 308 | } 309 | 310 | 311 | void PanZoomLayer::Holding() 312 | { 313 | _isHolding = true; 314 | } 315 | 316 | 317 | void PanZoomLayer::UnHolding() 318 | { 319 | _isHolding = false; 320 | } 321 | 322 | 323 | void PanZoomLayer::SetProductFactor( float v ) 324 | { 325 | _productFactor = v; 326 | } -------------------------------------------------------------------------------- /Classes/PanZoomLayer.h: -------------------------------------------------------------------------------- 1 | 2 | // Created By GrowingDever 21th January 2014 3 | 4 | #ifndef _PAN_ZOOM_LAYER_H_ 5 | #define _PAN_ZOOM_LAYER_H_ 6 | 7 | #include "cocos2d.h" 8 | 9 | using namespace cocos2d; 10 | 11 | class PanZoomLayer : public CCLayerColor 12 | { 13 | private: 14 | CCArray *_touches; 15 | CCPoint _beganTouchPoint; 16 | CCPoint _endedTouchPoint; 17 | CCPoint _deltaSum; 18 | CCPoint _prevDeltaPoint; 19 | double _accelerationFactor; 20 | cc_timeval _timeStamp; 21 | CCRect _panBoundsRect; 22 | float _maxScale; 23 | float _minScale; 24 | float _productFactor; 25 | 26 | bool _isHolding; 27 | 28 | 29 | public: 30 | PanZoomLayer(); 31 | virtual ~PanZoomLayer(); 32 | 33 | static PanZoomLayer* create(); 34 | 35 | virtual bool init(); 36 | virtual void onEnter(); 37 | virtual void onExit(); 38 | 39 | virtual void update( float dt ); 40 | 41 | virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent); 42 | virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent); 43 | virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent); 44 | 45 | virtual void setPosition( CCPoint position ); 46 | virtual void setScale( float scale ); 47 | 48 | void SetPanBoundsRect( CCRect rect ); 49 | void SetMaxScale( float maxScale ); 50 | float GetMaxScale(); 51 | void SetMinScale( float minScale ); 52 | float GetMinScale(); 53 | 54 | void Holding(); 55 | void UnHolding(); 56 | 57 | void SetProductFactor( float v ); 58 | 59 | }; 60 | 61 | 62 | #endif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | cocos2d-x-panzoomlayer 2 | ====================== 3 | 4 | Pan and Zoom Layer! 5 | 6 | 7 | You can use panning and zooming with inheriting this class! 8 | 9 | Reference : [LINK](http://www.cocos2d-x.org/forums/6/topics/5430) -------------------------------------------------------------------------------- /Resources/CloseNormal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toughrogrammer/cocos2d-x-panzoomlayer/7b2f8bdf2af791989f2b2a656511222e29aca725/Resources/CloseNormal.png -------------------------------------------------------------------------------- /Resources/CloseSelected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toughrogrammer/cocos2d-x-panzoomlayer/7b2f8bdf2af791989f2b2a656511222e29aca725/Resources/CloseSelected.png -------------------------------------------------------------------------------- /Resources/Fishfam_base_TH8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toughrogrammer/cocos2d-x-panzoomlayer/7b2f8bdf2af791989f2b2a656511222e29aca725/Resources/Fishfam_base_TH8.jpg -------------------------------------------------------------------------------- /Resources/HelloWorld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toughrogrammer/cocos2d-x-panzoomlayer/7b2f8bdf2af791989f2b2a656511222e29aca725/Resources/HelloWorld.png -------------------------------------------------------------------------------- /Resources/HelloWorld2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toughrogrammer/cocos2d-x-panzoomlayer/7b2f8bdf2af791989f2b2a656511222e29aca725/Resources/HelloWorld2.png -------------------------------------------------------------------------------- /Resources/runatic2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toughrogrammer/cocos2d-x-panzoomlayer/7b2f8bdf2af791989f2b2a656511222e29aca725/Resources/runatic2.png -------------------------------------------------------------------------------- /proj.android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /proj.android/.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 33 | 34 | 35 | 45 | 48 | 49 | 50 | 51 | 61 | 64 | 65 | 66 | 67 | 75 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /proj.android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | smooth_panning_zoom 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 25 | clean,full,incremental, 26 | 27 | 28 | ?children? 29 | ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\|| 30 | 31 | 32 | ?name? 33 | 34 | 35 | 36 | org.eclipse.cdt.make.core.append_environment 37 | true 38 | 39 | 40 | org.eclipse.cdt.make.core.autoBuildTarget 41 | all 42 | 43 | 44 | org.eclipse.cdt.make.core.buildArguments 45 | ${ProjDirPath}/build_native.sh 46 | 47 | 48 | org.eclipse.cdt.make.core.buildCommand 49 | bash 50 | 51 | 52 | org.eclipse.cdt.make.core.buildLocation 53 | ${ProjDirPath} 54 | 55 | 56 | org.eclipse.cdt.make.core.cleanBuildTarget 57 | clean 58 | 59 | 60 | org.eclipse.cdt.make.core.contents 61 | org.eclipse.cdt.make.core.activeConfigSettings 62 | 63 | 64 | org.eclipse.cdt.make.core.enableAutoBuild 65 | false 66 | 67 | 68 | org.eclipse.cdt.make.core.enableCleanBuild 69 | true 70 | 71 | 72 | org.eclipse.cdt.make.core.enableFullBuild 73 | true 74 | 75 | 76 | org.eclipse.cdt.make.core.fullBuildTarget 77 | 78 | 79 | 80 | org.eclipse.cdt.make.core.stopOnError 81 | true 82 | 83 | 84 | org.eclipse.cdt.make.core.useDefaultBuildCmd 85 | false 86 | 87 | 88 | 89 | 90 | com.android.ide.eclipse.adt.ApkBuilder 91 | 92 | 93 | 94 | 95 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 96 | full,incremental, 97 | 98 | 99 | 100 | 101 | 102 | com.android.ide.eclipse.adt.AndroidNature 103 | org.eclipse.jdt.core.javanature 104 | org.eclipse.cdt.core.cnature 105 | org.eclipse.cdt.core.ccnature 106 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 107 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 108 | 109 | 110 | 111 | Classes 112 | 2 113 | COCOS2DX/projects/smooth_panning_zoom/Classes 114 | 115 | 116 | cocos2dx 117 | 2 118 | COCOS2DX/cocos2dx 119 | 120 | 121 | extensions 122 | 2 123 | COCOS2DX/extensions 124 | 125 | 126 | scripting 127 | 2 128 | COCOS2DX/scripting 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /proj.android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 13 | 14 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /proj.android/README.md: -------------------------------------------------------------------------------- 1 | ## Prerequisites: 2 | 3 | * Android NDK 4 | * Android SDK **OR** Eclipse ADT Bundle 5 | * Android AVD target installed 6 | 7 | ## Building project 8 | 9 | There are two ways of building Android projects. 10 | 11 | 1. Eclipse 12 | 2. Command Line 13 | 14 | ### Import Project in Eclipse 15 | 16 | #### Features: 17 | 18 | 1. Complete workflow from Eclipse, including: 19 | * Build C++. 20 | * Clean C++. 21 | * Build and Run whole project. 22 | * Logcat view. 23 | * Debug Java code. 24 | * Javascript editor. 25 | * Project management. 26 | 2. True C++ editing, including: 27 | * Code completion. 28 | * Jump to definition. 29 | * Refactoring tools etc. 30 | * Quick open C++ files. 31 | 32 | 33 | #### Setup Eclipse Environment (only once) 34 | 35 | 36 | **NOTE:** This step needs to be done only once to setup the Eclipse environment for cocos2d-x projects. Skip this section if you've done this before. 37 | 38 | 1. Download Eclipse ADT bundle from [Google ADT homepage](http://developer.android.com/sdk/index.html) 39 | 40 | **OR** 41 | 42 | Install Eclipse with Java. Add ADT and CDT plugins. 43 | 44 | 2. Only for Windows 45 | 1. Install [Cygwin](http://www.cygwin.com/) with make (select make package from the list during the install). 46 | 2. Add `Cygwin\bin` directory to system PATH variable. 47 | 3. Add this line `none /cygdrive cygdrive binary,noacl,posix=0,user 0 0` to `Cygwin\etc\fstab` file. 48 | 49 | 3. Set up Variables: 50 | 1. Path Variable `COCOS2DX`: 51 | * Eclipse->Preferences->General->Workspace->**Linked Resources** 52 | * Click **New** button to add a Path Variable `COCOS2DX` pointing to the root cocos2d-x directory. 53 | ![Example](https://lh5.googleusercontent.com/-oPpk9kg3e5w/UUOYlq8n7aI/AAAAAAAAsdQ/zLA4eghBH9U/s400/cocos2d-x-eclipse-vars.png) 54 | 55 | 2. C/C++ Environment Variable `NDK_ROOT`: 56 | * Eclipse->Preferences->C/C++->Build->**Environment**. 57 | * Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory. 58 | ![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png) 59 | * Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr` 60 | 61 | 4. Import libcocos2dx library project: 62 | 1. File->New->Project->Android Project From Existing Code. 63 | 2. Click **Browse** button and open `cocos2d-x/cocos2dx/platform/android/java` directory. 64 | 3. Click **Finish** to add project. 65 | 66 | #### Adding and running from Eclipse 67 | 68 | ![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png) 69 | 70 | 1. File->New->Project->Android Project From Existing Code 71 | 2. **Browse** to your project directory. eg: `cocos2d-x/cocos2dx/samples/Cpp/TestCpp/proj.android/` 72 | 3. Add the project 73 | 4. Click **Run** or **Debug** to compile C++ followed by Java and to run on connected device or emulator. 74 | 75 | 76 | ### Running project from Command Line 77 | 78 | $ cd cocos2d-x/samples/Cpp/TestCpp/proj.android/ 79 | $ export NDK_ROOT=/path/to/ndk 80 | $ ./build_native.sh 81 | $ ant debug install 82 | 83 | If the last command results in sdk.dir missing error then do: 84 | 85 | $ android list target 86 | $ android update project -p . -t (id from step 6) 87 | $ android update project -p cocos2d-x/cocos2dx/platform/android/java/ -t (id from step 6) 88 | -------------------------------------------------------------------------------- /proj.android/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /proj.android/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 40 | 41 | 42 | 43 | 47 | 48 | 60 | 61 | 62 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /proj.android/build_native.sh: -------------------------------------------------------------------------------- 1 | APPNAME="smooth_panning_zoom" 2 | NDK_ROOT="C:\work\android-ndk-r8e" 3 | 4 | # options 5 | 6 | buildexternalsfromsource= 7 | 8 | usage(){ 9 | cat << EOF 10 | usage: $0 [options] 11 | 12 | Build C/C++ code for $APPNAME using Android NDK 13 | 14 | OPTIONS: 15 | -s Build externals from source 16 | -h this help 17 | EOF 18 | } 19 | 20 | while getopts "sh" OPTION; do 21 | case "$OPTION" in 22 | s) 23 | buildexternalsfromsource=1 24 | ;; 25 | h) 26 | usage 27 | exit 0 28 | ;; 29 | esac 30 | done 31 | 32 | # paths 33 | 34 | if [ -z "${NDK_ROOT+aaa}" ];then 35 | echo "please define NDK_ROOT" 36 | exit 1 37 | fi 38 | 39 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 40 | # ... use paths relative to current directory 41 | COCOS2DX_ROOT="$DIR/../../.." 42 | APP_ROOT="$DIR/.." 43 | APP_ANDROID_ROOT="$DIR" 44 | 45 | echo "NDK_ROOT = $NDK_ROOT" 46 | echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" 47 | echo "APP_ROOT = $APP_ROOT" 48 | echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT" 49 | 50 | # make sure assets is exist 51 | if [ -d "$APP_ANDROID_ROOT"/assets ]; then 52 | rm -rf "$APP_ANDROID_ROOT"/assets 53 | fi 54 | 55 | mkdir "$APP_ANDROID_ROOT"/assets 56 | 57 | # copy resources 58 | for file in "$APP_ROOT"/Resources/* 59 | do 60 | if [ -d "$file" ]; then 61 | cp -rf "$file" "$APP_ANDROID_ROOT"/assets 62 | fi 63 | 64 | if [ -f "$file" ]; then 65 | cp "$file" "$APP_ANDROID_ROOT"/assets 66 | fi 67 | done 68 | 69 | # run ndk-build 70 | if [[ "$buildexternalsfromsource" ]]; then 71 | echo "Building external dependencies from source" 72 | "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ 73 | "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source" 74 | else 75 | echo "Using prebuilt externals" 76 | "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ 77 | "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" 78 | fi 79 | -------------------------------------------------------------------------------- /proj.android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := cocos2dcpp_shared 6 | 7 | LOCAL_MODULE_FILENAME := libcocos2dcpp 8 | 9 | LOCAL_SRC_FILES := hellocpp/main.cpp \ 10 | ../../Classes/AppDelegate.cpp \ 11 | ../../Classes/PanZoomLayer.cpp \ 12 | ../../Classes/HelloWorldScene.cpp 13 | 14 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes 15 | 16 | LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static 17 | LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static 18 | LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static 19 | LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static 20 | LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static 21 | 22 | include $(BUILD_SHARED_LIBRARY) 23 | 24 | $(call import-module,cocos2dx) 25 | $(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl) 26 | $(call import-module,CocosDenshion/android) 27 | $(call import-module,extensions) 28 | $(call import-module,external/Box2D) 29 | $(call import-module,external/chipmunk) 30 | -------------------------------------------------------------------------------- /proj.android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := gnustl_static 2 | APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 3 | -------------------------------------------------------------------------------- /proj.android/jni/hellocpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "cocos2d.h" 3 | #include "CCEventType.h" 4 | #include "platform/android/jni/JniHelper.h" 5 | #include 6 | #include 7 | 8 | #define LOG_TAG "main" 9 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) 10 | 11 | using namespace cocos2d; 12 | 13 | extern "C" 14 | { 15 | 16 | jint JNI_OnLoad(JavaVM *vm, void *reserved) 17 | { 18 | JniHelper::setJavaVM(vm); 19 | 20 | return JNI_VERSION_1_4; 21 | } 22 | 23 | void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) 24 | { 25 | if (!CCDirector::sharedDirector()->getOpenGLView()) 26 | { 27 | CCEGLView *view = CCEGLView::sharedOpenGLView(); 28 | view->setFrameSize(w, h); 29 | 30 | AppDelegate *pAppDelegate = new AppDelegate(); 31 | CCApplication::sharedApplication()->run(); 32 | } 33 | else 34 | { 35 | ccGLInvalidateStateCache(); 36 | CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); 37 | ccDrawInit(); 38 | CCTextureCache::reloadAllTextures(); 39 | CCNotificationCenter::sharedNotificationCenter()->postNotification(EVENT_COME_TO_FOREGROUND, NULL); 40 | CCDirector::sharedDirector()->setGLDefaultValues(); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /proj.android/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /proj.android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-8 12 | 13 | android.library.reference.1=../../../cocos2dx/platform/android/java 14 | -------------------------------------------------------------------------------- /proj.android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toughrogrammer/cocos2d-x-panzoomlayer/7b2f8bdf2af791989f2b2a656511222e29aca725/proj.android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /proj.android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toughrogrammer/cocos2d-x-panzoomlayer/7b2f8bdf2af791989f2b2a656511222e29aca725/proj.android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /proj.android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toughrogrammer/cocos2d-x-panzoomlayer/7b2f8bdf2af791989f2b2a656511222e29aca725/proj.android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /proj.android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | smooth_panning_zoom 4 | 5 | -------------------------------------------------------------------------------- /proj.android/src/my/test/smooth/smooth_panning_zoom.java: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2010-2011 cocos2d-x.org 3 | 4 | http://www.cocos2d-x.org 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | ****************************************************************************/ 24 | package my.test.smooth; 25 | 26 | import org.cocos2dx.lib.Cocos2dxActivity; 27 | import org.cocos2dx.lib.Cocos2dxGLSurfaceView; 28 | 29 | import android.os.Bundle; 30 | 31 | public class smooth_panning_zoom extends Cocos2dxActivity{ 32 | 33 | protected void onCreate(Bundle savedInstanceState){ 34 | super.onCreate(savedInstanceState); 35 | } 36 | 37 | public Cocos2dxGLSurfaceView onCreateView() { 38 | Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this); 39 | // smooth_panning_zoom should create stencil buffer 40 | glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8); 41 | 42 | return glSurfaceView; 43 | } 44 | 45 | static { 46 | System.loadLibrary("cocos2dcpp"); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /proj.win32/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "AppDelegate.h" 3 | #include "CCEGLView.h" 4 | 5 | USING_NS_CC; 6 | 7 | int APIENTRY _tWinMain(HINSTANCE hInstance, 8 | HINSTANCE hPrevInstance, 9 | LPTSTR lpCmdLine, 10 | int nCmdShow) 11 | { 12 | UNREFERENCED_PARAMETER(hPrevInstance); 13 | UNREFERENCED_PARAMETER(lpCmdLine); 14 | 15 | // create the application instance 16 | AppDelegate app; 17 | CCEGLView* eglView = CCEGLView::sharedOpenGLView(); 18 | eglView->setViewName("smooth_panning_zoom"); 19 | eglView->setFrameSize( 1280, 720 ); 20 | return CCApplication::sharedApplication()->run(); 21 | } 22 | -------------------------------------------------------------------------------- /proj.win32/main.h: -------------------------------------------------------------------------------- 1 | #ifndef __MAIN_H__ 2 | #define __MAIN_H__ 3 | 4 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 5 | 6 | // Windows Header Files: 7 | #include 8 | #include 9 | 10 | // C RunTime Header Files 11 | #include "CCStdC.h" 12 | 13 | #endif // __MAIN_H__ 14 | -------------------------------------------------------------------------------- /proj.win32/smooth_panning_zoom.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smooth_panning_zoom", "smooth_panning_zoom.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}" 5 | ProjectSection(ProjectDependencies) = postProject 6 | {21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28} 7 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} 8 | {207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25} 9 | {929480E7-23C0-4DF6-8456-096D71547116} = {929480E7-23C0-4DF6-8456-096D71547116} 10 | {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} 11 | EndProjectSection 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\..\..\cocos2dx\proj.win32\cocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}" 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCocosDenshion", "..\..\..\CocosDenshion\proj.win32\CocosDenshion.vcxproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}" 16 | ProjectSection(ProjectDependencies) = postProject 17 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} 18 | EndProjectSection 19 | EndProject 20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libExtensions", "..\..\..\extensions\proj.win32\libExtensions.vcxproj", "{21B2C324-891F-48EA-AD1A-5AE13DE12E28}" 21 | ProjectSection(ProjectDependencies) = postProject 22 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} 23 | {207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25} 24 | {929480E7-23C0-4DF6-8456-096D71547116} = {929480E7-23C0-4DF6-8456-096D71547116} 25 | {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} 26 | EndProjectSection 27 | EndProject 28 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libBox2D", "..\..\..\external\Box2D\proj.win32\Box2D.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}" 29 | EndProject 30 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libchipmunk", "..\..\..\external\chipmunk\proj.win32\chipmunk.vcxproj", "{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}" 31 | EndProject 32 | Global 33 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 34 | Debug|Win32 = Debug|Win32 35 | Release|Win32 = Release|Win32 36 | EndGlobalSection 37 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 38 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.ActiveCfg = Debug|Win32 39 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.Build.0 = Debug|Win32 40 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.ActiveCfg = Release|Win32 41 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.Build.0 = Release|Win32 42 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.ActiveCfg = Debug|Win32 43 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32 44 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32 45 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32 46 | {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Debug|Win32.ActiveCfg = Debug|Win32 47 | {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Debug|Win32.Build.0 = Debug|Win32 48 | {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Release|Win32.ActiveCfg = Release|Win32 49 | {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Release|Win32.Build.0 = Release|Win32 50 | {21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Debug|Win32.ActiveCfg = Debug|Win32 51 | {21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Debug|Win32.Build.0 = Debug|Win32 52 | {21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Release|Win32.ActiveCfg = Release|Win32 53 | {21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Release|Win32.Build.0 = Release|Win32 54 | {929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.ActiveCfg = Debug|Win32 55 | {929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.Build.0 = Debug|Win32 56 | {929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.ActiveCfg = Release|Win32 57 | {929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.Build.0 = Release|Win32 58 | {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Debug|Win32.ActiveCfg = Debug|Win32 59 | {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Debug|Win32.Build.0 = Debug|Win32 60 | {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Release|Win32.ActiveCfg = Release|Win32 61 | {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Release|Win32.Build.0 = Release|Win32 62 | EndGlobalSection 63 | GlobalSection(SolutionProperties) = preSolution 64 | HideSolutionNode = FALSE 65 | EndGlobalSection 66 | EndGlobal 67 | -------------------------------------------------------------------------------- /proj.win32/smooth_panning_zoom.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A} 15 | test_win32 16 | Win32Proj 17 | 18 | 19 | 20 | Application 21 | Unicode 22 | true 23 | v100 24 | v110 25 | v110_xp 26 | v120 27 | v120_xp 28 | 29 | 30 | Application 31 | Unicode 32 | v100 33 | v110 34 | v110_xp 35 | v120 36 | v120_xp 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | <_ProjectFileVersion>10.0.40219.1 50 | $(SolutionDir)$(Configuration).win32\ 51 | $(Configuration).win32\ 52 | true 53 | $(SolutionDir)$(Configuration).win32\ 54 | $(Configuration).win32\ 55 | false 56 | AllRules.ruleset 57 | 58 | 59 | AllRules.ruleset 60 | 61 | 62 | 63 | 64 | $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath) 65 | 66 | 67 | $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath) 68 | 69 | 70 | 71 | Disabled 72 | $(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\external;$(ProjectDir)..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\CocosDenshion\include;$(ProjectDir)..\..\..\extensions;..\Classes;..;%(AdditionalIncludeDirectories) 73 | WIN32;_DEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 74 | true 75 | EnableFastChecks 76 | MultiThreadedDebugDLL 77 | 78 | 79 | Level3 80 | EditAndContinue 81 | 4267;4251;4244;%(DisableSpecificWarnings) 82 | 83 | 84 | libExtensions.lib;libcocos2d.lib;libCocosDenshion.lib;opengl32.lib;glew32.lib;libBox2d.lib;libchipmunk.lib;libcurl_imp.lib;pthreadVCE2.lib;websockets.lib;%(AdditionalDependencies) 85 | $(OutDir)$(ProjectName).exe 86 | $(OutDir);%(AdditionalLibraryDirectories) 87 | true 88 | Windows 89 | MachineX86 90 | 91 | 92 | 93 | 94 | 95 | 96 | if not exist "$(OutDir)" mkdir "$(OutDir)" 97 | xcopy /Y /Q "$(ProjectDir)..\..\..\external\libwebsockets\win32\lib\*.*" "$(OutDir)" 98 | 99 | 100 | 101 | 102 | MaxSpeed 103 | true 104 | $(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\external;$(ProjectDir)..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\CocosDenshion\include;$(ProjectDir)..\..\..\extensions;..\Classes;..;%(AdditionalIncludeDirectories) 105 | WIN32;NDEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 106 | MultiThreadedDLL 107 | true 108 | 109 | 110 | Level3 111 | ProgramDatabase 112 | 4267;4251;4244;%(DisableSpecificWarnings) 113 | 114 | 115 | libExtensions.lib;libcocos2d.lib;libCocosDenshion.lib;opengl32.lib;glew32.lib;libBox2d.lib;libchipmunk.lib;libcurl_imp.lib;pthreadVCE2.lib;websockets.lib;%(AdditionalDependencies) 116 | $(OutDir)$(ProjectName).exe 117 | $(OutDir);%(AdditionalLibraryDirectories) 118 | true 119 | Windows 120 | true 121 | true 122 | MachineX86 123 | 124 | 125 | 126 | 127 | 128 | 129 | if not exist "$(OutDir)" mkdir "$(OutDir)" 130 | xcopy /Y /Q "$(ProjectDir)..\..\..\external\libwebsockets\win32\lib\*.*" "$(OutDir)" 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | {98a51ba8-fc3a-415b-ac8f-8c7bd464e93e} 148 | false 149 | 150 | 151 | {f8edd7fa-9a51-4e80-baeb-860825d2eac6} 152 | false 153 | 154 | 155 | {21b2c324-891f-48ea-ad1a-5ae13de12e28} 156 | false 157 | 158 | 159 | {929480e7-23c0-4df6-8456-096d71547116} 160 | false 161 | 162 | 163 | {207bc7a9-ccf1-4f2f-a04d-45f72242ae25} 164 | false 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /proj.win32/smooth_panning_zoom.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {84a8ebd7-7cf0-47f6-b75e-d441df67da40} 6 | 7 | 8 | {bb6c862e-70e9-49d9-81b7-3829a6f50471} 9 | 10 | 11 | 12 | 13 | win32 14 | 15 | 16 | Classes 17 | 18 | 19 | Classes 20 | 21 | 22 | Classes 23 | 24 | 25 | 26 | 27 | win32 28 | 29 | 30 | Classes 31 | 32 | 33 | Classes 34 | 35 | 36 | Classes 37 | 38 | 39 | -------------------------------------------------------------------------------- /proj.win32/smooth_panning_zoom.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(ProjectDir)..\Resources 5 | WindowsLocalDebugger 6 | 7 | 8 | $(ProjectDir)..\Resources 9 | WindowsLocalDebugger 10 | 11 | --------------------------------------------------------------------------------