One more thing (which jumped out when doing a full rebuild):
in CCDirector.h
(looking at that file helped me understand your fix earlier on as far as templateRender was concerned... GL context-wise)
you should add
@class EAGLView;
before the CCDirector:NSObject interface is declared. (C++ error otherwise)
This is the relvant section of my EAGLView.m file:
- (BOOL)createFramebuffer {
glGenFramebuffersOES(1, &viewFramebuffer);
glGenRenderbuffersOES(1, &viewRenderbuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer];
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
glGenRenderbuffersOES(1, &depthRenderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer);
if( !sio2 )
{
// Initialize SIO2 global variable
sio2Init( &tmp_argc, tmp_argv );
// Initialize OpenGL ES
sio2InitGL();
// Initialize OpenAL
sio2InitAL();
// Create a window using the default sio2 structure handle
sio2->_SIO2window = sio2WindowInit();
sio2->_SIO2resource = sio2ResourceInit( "default" );
// Update the viewport with the current window size
sio2WindowUpdateViewport( sio2->_SIO2window, 0, 0, backingWidth, backingHeight );
// Attach a function to the render callback
//sio2->_SIO2window->_SIO2windowrender = templateRender;
sio2->_SIO2window->_SIO2windowrender = templateLoader;
// Specify the function callback to use when the application quit.
sio2WindowShutdown( sio2->_SIO2window, templateShutdown );
// Link the appropriate callbacks to handle tap, move and the
// accelerometer.
sio2->_SIO2window->_SIO2windowtap = templateScreenTap;
sio2->_SIO2window->_SIO2windowtouchmove = templateScreenTouchMove;
sio2->_SIO2window->_SIO2windowaccelerometer = templateScreenAccelerometer;
// Cocos2D initialization
[[CCDirector sharedDirector] setAnimationInterval:1.0f/60];
[[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
[[CCDirector sharedDirector] setDisplayFPS:YES];
[[CCDirector sharedDirector] attachInView:self]; //re-nable
[CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGB565];
[[CCDirector sharedDirector] runWithScene: [HelloWorld scene]]; //re-enable
[[CCDirector sharedDirector] stopAnimation];
[[CCTouchDispatcher sharedDispatcher] addStandardDelegate:self priority:99];
MARK;
}
return YES;
}
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch;
CGPoint pos;
sio2->_SIO2window->n_touch = 0;
for( touch in touches )
{
pos = [ touch locationInView:self ];
sio2->_SIO2window->touch[ sio2->_SIO2window->n_touch ]->x = pos.y;
sio2->_SIO2window->touch[ sio2->_SIO2window->n_touch ]->y = pos.x;
++sio2->_SIO2window->n_touch;
}
sio2->_SIO2window->n_tap = [ [ touches anyObject ] tapCount ];
sio2ResourceDispatchEvents( sio2->_SIO2resource,
sio2->_SIO2window,
SIO2_WINDOW_TAP,
SIO2_WINDOW_TAP_DOWN );
[[CCTouchDispatcher sharedDispatcher] touchesBegan:touches withEvent:event];
}
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch;
CGPoint pos;
sio2->_SIO2window->n_touch = 0;
for( touch in touches )
{
pos = [ touch locationInView:self ];
sio2->_SIO2window->touch[ sio2->_SIO2window->n_touch ]->x = pos.y;
sio2->_SIO2window->touch[ sio2->_SIO2window->n_touch ]->y = pos.x;
++sio2->_SIO2window->n_touch;
}
sio2ResourceDispatchEvents( sio2->_SIO2resource,
sio2->_SIO2window,
SIO2_WINDOW_TOUCH_MOVE,
SIO2_WINDOW_TAP_DOWN );
[[CCTouchDispatcher sharedDispatcher] touchesMoved:touches withEvent:event];
}
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch;
CGPoint pos;
sio2->_SIO2window->n_touch = 0;
for( touch in touches )
{
pos = [ touch locationInView:self ];
sio2->_SIO2window->touch[ sio2->_SIO2window->n_touch ]->x = pos.y;
sio2->_SIO2window->touch[ sio2->_SIO2window->n_touch ]->y = pos.x;
++sio2->_SIO2window->n_touch;
}
sio2ResourceDispatchEvents( sio2->_SIO2resource,
sio2->_SIO2window,
SIO2_WINDOW_TAP,
SIO2_WINDOW_TAP_UP );
[[CCTouchDispatcher sharedDispatcher] touchesEnded:touches withEvent:event];
}
- (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
}
I do not know where or how to fit the ccTouchesCancelled method (I do not know if I have correctly patched the other ones either)...