달력

10

« 2024/10 »

  • 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
  • 28
  • 29
  • 30
  • 31
http://www.cocos2d-iphone.org/forum/topic/7843

I thought I'd go ahead and start a new thread for this...

This is an example project file I put together that handles pinchzoom, scroll, doubletap zoom, etc... feels alot like fieldrunners pinchzoom functionality.

The doubletap-zoom may need some adjustments but overall it works very well. If anyone improves it please share!

http://dl.dropbox.com/u/8990214/pinchzoom.zip

Enjoy

CGSize mapSize;

		self.tileMap = [CCTMXTiledMap tiledMapWithTMXFile:@"TileMap.tmx"];
                self.background = [_tileMap layerNamed:@"Background"];

		self.isTouchEnabled = YES;

                // had to do this because the tilemap is > than the iPhone screen size
		mapSize = _tileMap.contentSize; 

		// create a base layer
		CCColorLayer *base = [CCColorLayer layerWithColor:ccc4(139,139,139,255)];
		base.position = ccp(0,0);
		base.contentSize = mapSize;
		[base addChild:_tileMap];

		[self addChild: base z:0];

		self.anchorPoint = CGPointZero;
		base.anchorPoint = CGPointZero;
		_tileMap.anchorPoint = CGPointZero;

		// attach base layer to PinchZoomLayer
		PinchZoomLayer *pZoom = [PinchZoomLayer initPinchZoom:base];

		// zoom out all the way
		[pZoom scaleToFit];		

		GameSceneHUD *HUD = [GameSceneHUD node];
		HUD.anchorPoint = CGPointZero;
		[self addChild:HUD z:10];

		self.HUD = HUD;



:
Posted by netkorea