// Kismet
// Copyright (C) 1994, Joseph W. Reiss, All Rights Reserved
// jreiss@magnus.acs.ohio-state.edu
/////////////////////////////////////////////////////////////////////////////
// You are free to modify this code as you wish for your own personal use.
// You may only REDISTRIBUTE the code unaltered, with this copyright notice
// and all documentation intact.
//
// If you make any significant changes to this program, please drop me a
// line and let me know!

#import "DieView.h"

@implementation DieView

- initFrame:(const NXRect *)frameRect
{
    face[0] = [NXImage findImageNamed:"Die1C"];
    face[1] = [NXImage findImageNamed:"Die2C"];
    face[2] = [NXImage findImageNamed:"Die3C"];
    face[3] = [NXImage findImageNamed:"Die4C"];
    face[4] = [NXImage findImageNamed:"Die5C"];
    face[5] = [NXImage findImageNamed:"Die6C"];
    die = [[[Die alloc] init] setValue:6];
    [super initFrame:frameRect icon:"Die6C" tag:0
     target:nil action:NULL key:0 enabled:YES];
    [self setBordered:NO];
    [self setIconPosition:NX_ICONONLY];
    [self setType:NX_PUSHONPUSHOFF];
    return self;
}

- (int) roll
{
    [self setImage:face[[die roll]-1]];
    return [die value];
}

- setValue:(int) newValue
{
    [die setValue:newValue];
    [self setImage:face[[die value]-1]];
    return self;
}

- (int)value
{
    return [die value];
}


@end
