Painter/PainterFactoryForTac.m

00001 //
00002 //  PainterFactoryForTac.m
00003 //  MacTrek
00004 //
00005 //  Created by Aqua on 23/07/2006.
00006 //  Copyright 2006 Luky Soft. All rights reserved.
00007 //
00008 
00009 #import "PainterFactoryForTac.h"
00010 
00011 
00012 @implementation PainterFactoryForTac
00013 
00014 - (void)   drawPlayer:(Player*) player inRect:(NSRect) Rect {
00015     
00016     NSColor *col = [self colorForTeam:[player team]];
00017     if ([player flags] & PLAYER_CLOAK) {
00018         // find out aplha value PF_MIN_ALPHA_VALUE (0.1) means fully cloaked
00019         // 1.0 means fully uncloaked
00020         float alpha = 1.0;
00021         alpha -= (((1.0 - PF_MIN_ALPHA_VALUE) * [player cloakPhase]) / PLAYER_CLOAK_PHASES);
00022         col = [col colorWithAlphaComponent:alpha];
00023     }    
00024     [col set];
00025     
00026     // draw the ship in a sqrt(2)/2 size rect (inner circle)
00027     // sides should be 0.707 * rect.width thus reduced by 0,292893218813 / 2    
00028      [shapes drawTriangleNotchUpInRect:NSInsetRect(Rect, Rect.size.width*0.1515, Rect.size.height*0.1515)];
00029 }
00030 
00031 @end

Generated on Sat Aug 26 21:14:16 2006 for MacTrek by  doxygen 1.4.7