00001
00002
00003
00004
00005
00006
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;
00029 NSPoint backGroundStartPoint;
00030 LLTrigonometry *trigonometry;
00031 LLShapes *shapes;
00032 int alert;
00033 NSBezierPath *line;
00034 NSBezierPath *dashedLine;
00035 NSDictionary *normalStateAttribute;
00036 }
00037
00038
00039 - (void) setSimplifyDrawing:(bool)simpleDraw;
00040 - (void) setDebugLabels:(bool)debug;
00041 - (bool) debugLabels;
00042 - (void) cacheImagesInSeperateThread:(id)sender;
00043
00044
00045 - (NSPoint) centreOfRect:(NSRect)aRect;
00046
00047
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
00056 - (NSRect) gameRectAround:(NSPoint)gamePoint forView:(NSRect)bounds withScale:(int)scale;
00057
00058
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
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
00078
00079
00080
00081
00082
00083 - (void) drawTorp:(Torp*) torp inRect:(NSRect) Rect;
00084 - (void) drawPlasma:(Plasma*) plasma inRect:(NSRect) Rect;
00085 - (void) drawBackgroundImageInRect:(NSRect) Rect;
00086
00087
00088 - (int) maxFuseForMovingTorp;
00089 - (int) maxFuseForExplodingTorp;
00090 - (int) maxFuseForMovingPlasma;
00091 - (int) maxFuseForExplodingPlasma;
00092 - (int) maxFuseForMovingPlayer;
00093 - (int) maxFuseForExplodingPlayer;
00094 - (int) maxFuseForPlanet;
00095
00096
00097
00098
00099 - (NSSize) backGroundImageSize;
00100
00101 - (NSColor*) colorForTeam:(Team*)team;
00102
00103 - (void) cacheImages;
00104
00105 - (int) maxScale;
00106 - (int) minScale;
00107
00108
00109 @end