OpenGL Sprites...
OpenGL Sprites...
- Subject: OpenGL Sprites...
- From: Albert Atkinson <email@hidden>
- Date: Mon, 24 Jun 2002 11:21:56 -0500
I am trying to update one of my sprites to show another image when
the up arrow key is pressed. Here is a snippet of code:
case upKey:
if(released) {
upKeyPressed = NO;
spriteImage = [[NSImage alloc]
initWithContentsOfFile: fileName];
} else {
upKeyPressed = YES;
spriteImage = [[NSImage alloc] initWithContentsOfFile:
fileNameThrust];
}
break;
At the top of my code file is this snippet:
NSBundle *programBundle = [NSBundle bundleForClass:[self class]];
fileName = [programBundle pathForResource:@"Apple" ofType:@"tiff"];
fileNameThrust = [programBundle pathForResource:@"Apple Thrust"
ofType:@"tiff"];
spriteImage = [[NSImage alloc] initWithContentsOfFile: fileName];
And here is my header file:
#define upKey 126
//Some code snipped out...
BOOL upKeyPressed;
NSString *fileName;
NSString *fileNameThrust;
//Some code snipped out...
- (id)init;
- (void)dealloc;
- (void)update;
- (void)handleKey:(unsigned short)key keyUp:(BOOL)released;
My problem is that when I run the app it will work fine but the
moment I push the up arrow I crash. Any suggestions?
Thanks!
Albert
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.