@@ -112,7 +112,7 @@ - (id)initWithDuration:(NSTimeInterval)duration
112
112
_outgoingOverIncoming = NO ;
113
113
114
114
// find out where the outgoing scene will end (if it is a transition with movement)
115
- CGSize size = [CCDirector sharedDirector ].designSize ;
115
+ CGSize size = [CCDirector sharedDirector ].viewportRect . size ;
116
116
switch (direction) {
117
117
case CCTransitionDirectionDown: _outgoingDestination = CGPointMake (0 , -size.height ); break ;
118
118
case CCTransitionDirectionLeft: _outgoingDestination = CGPointMake (-size.width , 0 ); break ;
@@ -188,21 +188,25 @@ - (void)startTransition:(CCScene *)scene
188
188
189
189
// create render textures
190
190
// get viewport size
191
- CGSize size = [CCDirector sharedDirector ].designSize ;
191
+ CGRect rect = [CCDirector sharedDirector ].viewportRect ;
192
+
193
+ // Make sure we aren't rounding down.
194
+ rect.size .width = ceil (rect.size .width );
195
+ rect.size .height = ceil (rect.size .height );
192
196
193
197
// create texture for outgoing scene
194
- _outgoingTexture = [CCRenderTexture renderTextureWithWidth: size.width / _outgoingDownScale
195
- height: size.height / _outgoingDownScale
198
+ _outgoingTexture = [CCRenderTexture renderTextureWithWidth: rect. size.width / _outgoingDownScale
199
+ height: rect. size.height / _outgoingDownScale
196
200
pixelFormat: _transitionPixelFormat];
197
- _outgoingTexture.position = CGPointMake (size.width * 0 .5f , size.height * 0 .5f );
201
+ _outgoingTexture.position = CGPointMake (rect. size .width * 0 .5f + rect. origin . x , rect. size .height * 0 .5f + rect. origin . y );
198
202
_outgoingTexture.scale = _outgoingDownScale;
199
203
[self addChild: _outgoingTexture z: _outgoingOverIncoming];
200
204
201
205
// create texture for incoming scene
202
- _incomingTexture = [CCRenderTexture renderTextureWithWidth: size.width / _incomingDownScale
203
- height: size.height / _incomingDownScale
206
+ _incomingTexture = [CCRenderTexture renderTextureWithWidth: rect. size.width / _incomingDownScale
207
+ height: rect. size.height / _incomingDownScale
204
208
pixelFormat: _transitionPixelFormat];
205
- _incomingTexture.position = CGPointMake (size.width * 0 .5f , size.height * 0 .5f );
209
+ _incomingTexture.position = CGPointMake (rect. size .width * 0 .5f + rect. origin . x , rect. size .height * 0 .5f + rect. origin . y );
206
210
_incomingTexture.scale = _incomingDownScale;
207
211
[self addChild: _incomingTexture];
208
212
0 commit comments