CGSize winSize = [[CCDirector sharedDirector] winSize];
int x = MAX(position.x, winSize.width /2);
int y = MAX(position.y, winSize.height /2);
x = MIN(x, (_tileMap.mapSize.width * _tileMap.tileSize.width)
- winSize.width /2);
y = MIN(y, (_tileMap.mapSize.height *_tileMap.tileSize.height)
-winSize.height/2);
CGPoint actualPosition = ccp(x, y);
CGPoint centerOfView = ccp(winSize.width/2, winSize.height/2);
self.position = centerOfView;
注意這是在NSObject的定義的MAX。我仍然模糊不清。我試圖在文本文檔中查找它,但沒有得到相關結果。
同樣,ccp只是採取兩個座標,並將它們保存到一個點?
E.G.
CGPoint centerOfView = ccp(winSize.width/2, winSize.height/2);
謝謝!
它是一個*宏*,它接受兩個表達式,對它們進行求值並返回兩個較大的值。 – dasblinkenlight 2012-03-29 19:27:02