Hello,

I'm a Compsci student trying to learn Cocoa development, and I'm trying to
write a simple program using Core Animation, but I'm having a hard time
getting it to work. I just need someone to tell me what I'm doing wrong so I
can move on and screw up something else :)
Thanks, and I apologize for the newbie question!

I'm getting a Link error:

".objc_class_name_CALayer", referenced from:
[EMAIL PROTECTED]@[EMAIL PROTECTED] in GameBoard.o
symbol(s) not found
collect2: Id returned 1 exit status

//GameBoard.h*********************************************
#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>

@interface GameBoard : NSView {
    CALayer * animateLayer;
}

- (bool)acceptsFirstResponder;
- (id)initWithFrame:(NSRect)frame;
- (void)awakeFromNib;
- (void)drawRect:(NSRect)rect;
- (void)drawBoardBackgroundInRect:(NSRect)rect;
- (void)drawLayer:(CALayer *)theLayer inContext:(CGContextRef)theContext;

@end

//GameBoard.g********************************************
#import "GameBoard.h"

@implementation GameBoard

- (id) initWithFrame:(NSRect) frame {
    if (self = [super initWithFrame: frame]) {
        animateLayer = [CALayer layer];
        [animateLayer setDelegate:self];
    }
    return self;
}

- (void) awakeFromNib {
    //keep the window a square
    [[self window] setContentAspectRatio:NSMakeSize(1.0, 1.0)];

    [[self window] setAcceptsMouseMovedEvents: YES];
}

- (BOOL) acceptsFirstResponder {
    return NO;
}

//draws the view
- (void)drawRect:(NSRect)rect {
    [self drawBoardBackgroundInRect:rect];
}

- (void)drawBoardBackgroundInRect:(NSRect)rect {
    [NSBezierPath fillRect:rect];
}

- (void)drawLayer:(CALayer *)theLayer
        inContext:(CGContextRef)theContext {
    CGMutablePathRef thePath = CGPathCreateMutable();

    CGPathMoveToPoint(thePath,NULL,15.0f,15.f);
    CGPathAddCurveToPoint(thePath,
                          NULL,
                          15.f,250.0f,
                          295.0f,250.0f,
                          295.0f,15.0f);

    CGContextBeginPath(theContext);
    CGContextAddPath(theContext, thePath );

    CGContextSetLineWidth(theContext, 1);
    CGContextSetRGBStrokeColor(theContext,0,0,1,1);

    CGContextStrokePath(theContext);
}

@end
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to