Hey all,
First I'd like to say sorry if this post doesn't have enough details, been a while since I posted a question here
.
Currently I am writing a small (And very very simple) game for university coursework (I'm not looking for someone to write it for me I am just stuck at a point) and I am trying to use a custom class from within another class. Currently I think it has been initialised properly but it is not actually stepped into the init code when I do something like:
I don't have an alloc method just an init method just now, could this be the problem?
Currently the class that is calling "cube" header is looking like:
And I am trying to use it within this class like this:
I thought that all I would need to do is create a pointer to the class, initialise this pointer using the init call and then be able to use it with the loadTexturesForScene call, but currently it will not even go into the init method of the MainCube class.
I have stepped through from the start till the application is running and it does not access the MainCube class at all.
Another thing even after the
call in the class cube is (MainCube *) 0x0 which would be explained because it is not currently entering the init function at all.
A few words of wisdom would be good as this is all that is stopping me from completing my coursework just now as I am trying to refactor it so that it runs slightly quicker
Thanks all,
Stephen
First I'd like to say sorry if this post doesn't have enough details, been a while since I posted a question here
Currently I am writing a small (And very very simple) game for university coursework (I'm not looking for someone to write it for me I am just stuck at a point) and I am trying to use a custom class from within another class. Currently I think it has been initialised properly but it is not actually stepped into the init code when I do something like:
Code:
cube = [cube init];
I don't have an alloc method just an init method just now, could this be the problem?
Currently the class that is calling "cube" header is looking like:
Code:
#import "MainCube.h"
@interface GameScene : AbstractScene {
//float transY;
//float transX;
GLfloat scaleMatrix[16];
GLfloat rotationMatrix[16];
GLfloat translationMatrix[16];
GLfloat projectionMatrix[16];
int firstTime;
float lastPinchDistance;
float lastZoomDistance;
CGPoint lastTouchPosition;
//GLuint texture;
MainCube *cube;
}
And I am trying to use it within this class like this:
Code:
- (void)initScene {
cube = [cube init];
GLint framebufferWidth, framebufferHeight;
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &framebufferWidth);
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &framebufferHeight);
GLfloat aspectRatio = (GLfloat)framebufferHeight / (GLfloat)framebufferWidth;
lastZoomDistance = -5.0f;
[EDMatrixTools applyIdentity:scaleMatrix];
[EDMatrixTools applyIdentity:rotationMatrix];
[EDMatrixTools applyIdentity:translationMatrix];
[EDMatrixTools applyIdentity:projectionMatrix];
[EDMatrixTools applyTranslation:translationMatrix x:0 y:0 z:lastZoomDistance];
[EDMatrixTools applyProjection:projectionMatrix fov:45 aspect:aspectRatio near:1 far:100];
[cube loadTexturesForScene];
}
I thought that all I would need to do is create a pointer to the class, initialise this pointer using the init call and then be able to use it with the loadTexturesForScene call, but currently it will not even go into the init method of the MainCube class.
I have stepped through from the start till the application is running and it does not access the MainCube class at all.
Another thing even after the
Code:
cube = [cube init];
A few words of wisdom would be good as this is all that is stopping me from completing my coursework just now as I am trying to refactor it so that it runs slightly quicker
Thanks all,
Stephen