Painter/PainterFactory.h

00001 //
00002 //  PainterFactory.h
00003 //  MacTrek
00004 //
00005 //  Created by Aqua on 19/06/2006.
00006 //  Copyright 2006 Luky Soft. All rights reserved.
00007 //
00008 
00009 #import <Cocoa/Cocoa.h>
00010 #import "Data.h"
00011 #import "Phaser.h"
00012 #import "BaseClass.h"
00013 #import "Luky.h"
00014 #import "Math.h"
00015 #include <unistd.h>
00016 #include <stdlib.h>
00017 
00018 
00019 #define PF_DEFAULT_BACKGROUND_IMAGE_SIZE NSMakeSize(100, 100)
00020 #define PF_ALERT_BORDER_WIDTH 2
00021 #define PF_TRIANGLE_WIDTH   600.0
00022 #define PF_TRIANGLE_HEIGHT  400.0
00023 #define PF_MIN_ALPHA_VALUE  0.1
00024 
00025 @interface PainterFactory : BaseClass {
00026     Universe *universe;
00027     bool debugLabels;
00028     bool simple; // used for an overview map, omits torps, shields etc.    
00029     NSPoint backGroundStartPoint;
00030     LLTrigonometry *trigonometry;
00031     LLShapes *shapes;
00032     int alert;
00033     NSBezierPath *line;
00034     NSBezierPath *dashedLine; 
00035     NSDictionary *normalStateAttribute;
00036 }
00037 
00038 // internal
00039 - (void) setSimplifyDrawing:(bool)simpleDraw;
00040 - (void) setDebugLabels:(bool)debug;
00041 - (bool) debugLabels;
00042 - (void) cacheImagesInSeperateThread:(id)sender;
00043 
00044 // helper
00045 - (NSPoint) centreOfRect:(NSRect)aRect;
00046 
00047 // conversions
00048 - (NSPoint) viewPointFromGamePoint:(NSPoint)point viewRect:(NSRect)bounds 
00049              gamePosInCentreOfView:(NSPoint)centrePos withScale:(int)scale;
00050 - (NSPoint) gamePointFromViewPoint:(NSPoint)point viewRect:(NSRect)bounds 
00051              gamePosInCentreOfView:(NSPoint)centrePos withScale:(int)scale;
00052 - (NSSize)  gameSizeFromViewSize:(NSSize)rect withScale:(int)scale;
00053 - (NSSize)  viewSizeFromGameSize:(NSSize)rect withScale:(int)scale;
00054 
00055 // information
00056 - (NSRect) gameRectAround:(NSPoint)gamePoint forView:(NSRect)bounds withScale:(int)scale;
00057 
00058 // draw routines
00059 - (void) drawRect:(NSRect)drawingBounds ofViewBounds:(NSRect)viewBounds whichRepresentsGameBounds:(NSRect)gameBounds 
00060         withScale:(int)scale;
00061 - (void) drawAlertBorder:(NSRect) bounds forMe:(Player *)me;
00062 - (void) drawBackgroundInRect:(NSRect) drawingBounds ofViewBounds:(NSRect)viewBounds forMe:(Player*) me ;
00063 - (void) drawGalaxyEdgesInRect:(NSRect) drawingBounds forGameRect:(NSRect)gameBounds ofViewBounds:(NSRect)viewBounds withScale:(int)scale;
00064 - (void) drawPlanetsInRect:(NSRect)drawingBounds forGameRect:(NSRect)gameBounds ofViewBounds:(NSRect)viewBounds withScale:(int)scale;
00065 - (void) drawPlayersInRect:(NSRect)drawingBounds forGameRect:(NSRect)gameBounds ofViewBounds:(NSRect)viewBounds  withScale:(int)scale;
00066 - (void) drawTorpsInRect:(NSRect)drawingBounds forGameRect:(NSRect)gameBounds ofViewBounds:(NSRect)viewBounds  withScale:(int)scale ;
00067 - (void) drawPlasmasInRect:(NSRect)drawingBounds forGameRect:(NSRect)gameBounds ofViewBounds:(NSRect)viewBounds  withScale:(int)scale;
00068 - (void)drawLockInRect:(NSRect)drawingBounds forGameRect:(NSRect)gameBounds ofViewBounds:(NSRect)viewBounds withScale:(int)scale ;
00069 - (void) rotateAndDrawPlayer:(Player*) player inRect:(NSRect) Rect;
00070 
00071 // should be overwritten by subclasses
00072 - (void)   drawPlayer:(Player*) player inRect:(NSRect) Rect;
00073 - (void)   drawShieldWithStrenght: (float)shieldPercentage inRect:(NSRect) Rect;
00074 - (void)   drawLabelForPlanet:(Planet*)planets belowRect:(NSRect)planetViewBounds;
00075 - (void)   drawLabelForPlayer:(Player*)player belowRect:(NSRect)playerViewBounds;
00076 - (void)   drawPlanet:(Planet*) planet inRect:(NSRect) Rect;
00077 // @method drawTorp
00078 // @abstract draws all torpedo's in the actual bounds.
00079 // @param drawingBounds draw only in this area
00080 // @param gameBounds which represents these game bounds
00081 // @param viewBounds these are the total view's  bounds
00082 // @param scale the scale used to draw
00083 - (void)   drawTorp:(Torp*) torp       inRect:(NSRect) Rect;
00084 - (void)   drawPlasma:(Plasma*) plasma inRect:(NSRect) Rect;
00085 - (void)   drawBackgroundImageInRect:(NSRect) Rect;
00086 // @method maxFuseForMovingTorp
00087 // @abstract returns the number of frames to display for a moving torp  
00088 - (int)    maxFuseForMovingTorp;   
00089 - (int)    maxFuseForExplodingTorp;
00090 - (int)    maxFuseForMovingPlasma;   
00091 - (int)    maxFuseForExplodingPlasma;
00092 - (int)    maxFuseForMovingPlayer;   
00093 - (int)    maxFuseForExplodingPlayer;
00094 - (int)    maxFuseForPlanet;
00095 
00096 //  could be overwritten to match the size of the subclasses artwork
00097 //
00098 // and the stamping algorithm (will use defaults otherwise)
00099 - (NSSize) backGroundImageSize;
00100 // could be overwritten if you want different colors
00101 - (NSColor*) colorForTeam:(Team*)team;
00102 // overrule in subclass to cache the images
00103 - (void) cacheImages;
00104 // interesting zoom sizes
00105 - (int) maxScale;
00106 - (int) minScale;
00107 
00108 
00109 @end

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