00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ArmageTron_VIEWPORT_H
00029 #define ArmageTron_VIEWPORT_H
00030
00031 #define MAX_VIEWPORTS 4
00032
00033 #include "defs.h"
00034 #include "tString.h"
00035 #include "tCoord.h"
00036 #include "tSafePTR.h"
00037
00038 class rViewport{
00039 REAL left,bottom,width,height;
00040 public:
00041 rViewport(REAL l,REAL b,REAL w,REAL h):left(l),bottom(b),width(w),height(h){}
00042
00043 rViewport(rViewport &top,rViewport &sub)
00044 :left (top.left+top.width*sub.left),
00045 bottom(top.bottom+top.height*sub.bottom),
00046 width(top.width*sub.width),
00047 height(top.height*sub.height){}
00048
00049 ~rViewport(){tCHECK_DEST;}
00050
00051 #ifndef DEDICATED
00052 void Select();
00053 #endif
00054
00055 void Perspective(REAL fov,REAL zNear=1,REAL zFar=10000000,REAL xShift = 0);
00056
00057 REAL UpDownFOV(REAL fov);
00058
00060 rViewport CorrectAspectBottom() const;
00061
00063 rViewport EqualAspectBottom() const;
00064
00066 tCoord GetDimensions() const {return tCoord(width, height);}
00067
00068 static rViewport s_viewportFullscreen,
00069 s_viewportLeft,s_viewportRight,
00070 s_viewportTop,s_viewportBottom,
00071 s_viewportTopLeft,s_viewportBottomLeft,
00072 s_viewportTopRight,s_viewportBottomRight, s_viewportDemonstation;
00073
00074 static void CorrectViewport(int i, int mp);
00075 static void CorrectViewports(int mp);
00076 static void SetDirectionOfCorrection(int vp, int dir);
00077 static void Update(int mp);
00078
00079 };
00080
00081 extern int sr_viewportBelongsToPlayer[MAX_VIEWPORTS];
00082 extern int s_newViewportBelongsToPlayer[MAX_VIEWPORTS];
00083
00084
00085 class rViewportConfiguration{
00086 rViewport *viewports[MAX_VIEWPORTS];
00087 public:
00088 const int num_viewports;
00089
00090 static int next_conf_num;
00091
00092 rViewportConfiguration(rViewport *first);
00093 rViewportConfiguration(rViewport *first,rViewport *second);
00094 rViewportConfiguration(rViewport *first,rViewport *second,rViewport *third);
00095 rViewportConfiguration(rViewport *first,rViewport *second,rViewport *third,
00096 rViewport *forth);
00097 #ifndef DEDICATED
00098 void Select(int i);
00099 static void DemonstrateViewport(tString *titles);
00100 #endif
00101 rViewport * Port(int i);
00102
00103 static rViewportConfiguration *s_viewportConfigurations[];
00104 static const int s_viewportNumConfigurations;
00105 static char const * s_viewportConfigurationNames[];
00106
00107 static rViewportConfiguration *CurrentViewportConfiguration();
00108
00109 static rViewport * CurrentViewport(int i);
00110
00111 static void UpdateConf();
00112 };
00113
00114 #endif
00115
00116
00117