Skip to content

Commit a1f4962

Browse files
committed
Android project fixes. Still something wrong with linking the CCNoARC.m file.
1 parent 927a1d8 commit a1f4962

File tree

9 files changed

+1837
-481
lines changed

9 files changed

+1837
-481
lines changed

cocos2d-ios.xcodeproj/project.pbxproj

Lines changed: 1302 additions & 231 deletions
Large diffs are not rendered by default.

cocos2d-osx.xcodeproj/project.pbxproj

Lines changed: 216 additions & 187 deletions
Large diffs are not rendered by default.

cocos2d-tests-ios.xcodeproj/project.pbxproj

Lines changed: 301 additions & 18 deletions
Large diffs are not rendered by default.

cocos2d/CCDirector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ typedef NS_ENUM(NSUInteger, CCDirectorProjection) {
7070

7171
#elif __CC_PLATFORM_ANDROID
7272
#define CC_VIEWCONTROLLER NSObject
73+
#define CC_VIEW CCGLView
7374

7475
#endif
7576

cocos2d/CCDirector.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ -(void) setView:(CC_VIEW<CCDirectorView> *)view
393393
#if __CC_PLATFORM_IOS
394394
CGFloat scale = self.view.layer.contentsScale ?: 1.0;
395395
#elif __CC_PLATFORM_ANDROID
396-
CGFloat scale = __view.contentScaleFactor;
396+
CGFloat scale = _view.contentScaleFactor;
397397
#else
398398
//self.view.wantsBestResolutionOpenGLSurface = YES;
399399
CGFloat scale = self.view.window.backingScaleFactor;

cocos2d/CCTexture.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,6 @@ -(void) generateMipmap
633633
glGenerateMipmap(GL_TEXTURE_2D);
634634
_hasMipmaps = YES;
635635

636-
glPopGroupMarkerEXT();
637636
CCGL_DEBUG_POP_GROUP_MARKER();
638637
});
639638
}

cocos2d/Platforms/Android/CCDirectorAndroid.m

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -52,46 +52,6 @@ - (id) init
5252
}
5353

5454

55-
//
56-
// Draw the Scene
57-
//
58-
- (void) drawScene
59-
{
60-
/* calculate "global" dt */
61-
[self calculateDeltaTime];
62-
63-
CCGLView *openGLview = (CCGLView*)self.view;
64-
65-
/* tick before glClear: issue #533 */
66-
if( ! _isPaused ) [_scheduler update: _dt];
67-
68-
/* to avoid flickr, nextScene MUST be here: after tick and before draw.
69-
XXX: Which bug is this one. It seems that it can't be reproduced with v0.9 */
70-
if( _nextScene ) [self setNextScene];
71-
72-
GLKMatrix4 projection = self.projectionMatrix;
73-
_renderer.globalShaderUniforms = [self updateGlobalShaderUniforms];
74-
75-
[CCRenderer bindRenderer:_renderer];
76-
[_renderer invalidateState];
77-
78-
[_renderer enqueueClear:(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) color:_runningScene.colorRGBA.glkVector4 depth:1.0f stencil:0 globalSortOrder:NSIntegerMin];
79-
80-
// Render
81-
[_runningScene visit:_renderer parentTransform:&projection];
82-
[_notificationNode visit:_renderer parentTransform:&projection];
83-
if( _displayStats ) [self showStats];
84-
85-
[_renderer flush];
86-
[CCRenderer bindRenderer:nil];
87-
88-
[openGLview swapBuffers];
89-
90-
_totalFrames++;
91-
92-
if( _displayStats ) [self calculateMPF];
93-
}
94-
9555
-(void) setViewport
9656
{
9757
CGSize size = _winSizeInPixels;
@@ -158,15 +118,13 @@ -(void)end
158118

159119
-(void) setView:(CCGLView *)view
160120
{
161-
if( view != __view) {
162121
[super setView:view];
163122
if( view ) {
164123
// set size
165124
CGFloat scale = view.contentScaleFactor;
166125
CGSize size = view.bounds.size;
167126
_winSizeInPixels = CGSizeMake(size.width * scale, size.height * scale);
168127
}
169-
}
170128
}
171129

172130
- (void)runBlock:(dispatch_block_t)block

cocos2d/Platforms/Android/CCGLView.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#import <BridgeKitV3/BridgeKit.h>
1717

1818
#import "../../Platforms/CCGL.h"
19+
#import "CCDirectorView.h"
1920

2021
enum CCAndroidScreenMode {
2122

@@ -39,7 +40,7 @@ enum CCAndroidScreenMode {
3940
};
4041

4142
BRIDGE_CLASS("org.cocos2d.CCGLView")
42-
@interface CCGLView : AndroidSurfaceView
43+
@interface CCGLView : AndroidSurfaceView <CCDirectorView>
4344

4445
- (id)initWithContext:(AndroidContext *)context;
4546
- (id)initWithContext:(AndroidContext *)context screenMode:(enum CCAndroidScreenMode)screenMode scaleFactor:(float)scaleFactor;

cocos2d/Platforms/Android/CCGLView.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,20 @@ - (void)swapBuffers
561561
eglSwapBuffers(_eglDisplay, _eglSurface);
562562
}
563563

564+
#warning TODO temporary
565+
-(void)addFrameCompletionHandler:(dispatch_block_t)handler
566+
{
567+
handler();
568+
}
569+
570+
-(void)beginFrame {}
571+
572+
#warning TODO temporary
573+
-(void)presentFrame
574+
{
575+
[self swapBuffers];
576+
}
577+
564578
@end
565579
#endif // __CC_PLATFORM_ANDROID
566580

0 commit comments

Comments
 (0)