TORCS  1.3.9
The Open Racing Car Simulator
grscreen.h
Go to the documentation of this file.
1 /***************************************************************************
2 
3  file : grscreen.h
4  created : Thu May 15 22:11:19 CEST 2003
5  copyright : (C) 2003 by Eric EspiĆ©
6  email : eric.espie@torcs.org
7  version : $Id$
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 
20 #ifndef _GRSCREEN_H_
21 #define _GRSCREEN_H_
22 
23 #include <car.h>
24 #include "grcam.h"
25 #include "grboard.h"
26 
27 class cGrScreen {
28  protected:
29  int id;
30 
31  tCarElt *curCar; // Current car viewed.
32  tCarElt **cars; // List of cars.
33 
34  int curCamHead; // The current camera list.
35  tGrCamHead cams[10]; // From F2 to F11.
36 
37  class cGrPerspCamera *curCam; // The current camera.
38  class cGrCarCamMirror *mirrorCam; // The mirror camera.
39  class cGrPerspCamera *dispCam; // The display camera.
40  class cGrOrthoCamera *boardCam; // The board camera.
41  class cGrBackgroundCam *bgCam; // The background camera.
42 
43  class cGrBoard *board; // The board.
44 
45  int drawCurrent; // Should the current car be drawn.
46 
47  int scrx, scry, scrw, scrh;
48  float viewRatio;
49 
50  int active; // Is the screen activated.
51 
55 
56  void loadParams(tSituation *s); // Load from parameters files.
57 
58  public:
59  cGrScreen(int id);
60  ~cGrScreen();
61 
62  void activate(int x, int y, int w, int h);
63  void desactivate(void);
64  void setZoom(long zoom);
65  int isInScreen(int x, int y);
66  void update(tSituation *s, float Fps);
67  void camDraw(tSituation *s);
68  void updateCurrent(tSituation *s);
69 
70  void selectCamera(long cam);
71  void selectBoard(long brd);
72  void selectTrackMap();
73 
74  void setCurrentCar(tCarElt *newCurCar);
75  void initCams(tSituation *s);
76  void initBoard(void);
77 
78  void selectNextCar(void);
79  void selectPrevCar(void);
80  void switchMirror(void);
81 
82  tCarElt *getCurrentCar(void) { return curCar; }
83  cGrCamera* getCurCamera(void) { return curCam; }
84  float getViewRatio(void) { return viewRatio; }
85  int getCurCamHead(void) { return curCamHead; }
86  int isActive(void) { return active; }
87  int getId(void) { return id; }
88  int getScrX (void) { return scrx; }
89  int getScrY (void) { return scry; }
90  int getScrW (void) { return scrw; }
91  int getScrH (void) { return scrh; }
92 };
93 
94 
95 #endif /* _GRSCREEN_H_ */
96 
97 
98 
99 
tCarElt * curCar
Definition: grscreen.h:31
int curCamHead
Definition: grscreen.h:34
class cGrPerspCamera * curCam
Definition: grscreen.h:37
int isActive(void)
Definition: grscreen.h:86
cars situation used to inform the GUI and the drivers
Definition: raceman.h:85
void desactivate(void)
Definition: grscreen.cpp:133
void selectCamera(long cam)
Definition: grscreen.cpp:198
Car structure (tCarElt).
Definition: car.h:455
int scrw
Definition: grscreen.h:47
class cGrPerspCamera * dispCam
Definition: grscreen.h:39
void initBoard(void)
Definition: grscreen.cpp:507
int mirrorFlag
Definition: grscreen.h:54
tGrCamHead cams[10]
Definition: grscreen.h:35
float viewRatio
Definition: grscreen.h:48
class cGrOrthoCamera * boardCam
Definition: grscreen.h:40
void update(tSituation *s, float Fps)
Definition: grscreen.cpp:303
int selectPrevFlag
Definition: grscreen.h:53
void initCams(tSituation *s)
Definition: grscreen.cpp:454
void loadParams(tSituation *s)
Definition: grscreen.cpp:391
int drawCurrent
Definition: grscreen.h:45
tCarElt * getCurrentCar(void)
Definition: grscreen.h:82
class cGrCarCamMirror * mirrorCam
Definition: grscreen.h:38
int id
Definition: grscreen.h:29
int scrx
Definition: grscreen.h:47
class cGrBackgroundCam * bgCam
Definition: grscreen.h:41
float getViewRatio(void)
Definition: grscreen.h:84
void selectNextCar(void)
Definition: grscreen.cpp:144
void updateCurrent(tSituation *s)
int getScrH(void)
Definition: grscreen.h:91
void setCurrentCar(tCarElt *newCurCar)
Definition: grscreen.cpp:107
void selectTrackMap()
Definition: grscreen.cpp:159
int active
Definition: grscreen.h:50
tCarElt ** cars
Definition: grscreen.h:32
This is the car structure.
int getCurCamHead(void)
Definition: grscreen.h:85
int scrh
Definition: grscreen.h:47
cGrCamera * getCurCamera(void)
Definition: grscreen.h:83
cGrScreen(int id)
Definition: grscreen.cpp:41
void selectBoard(long brd)
Definition: grscreen.cpp:154
void activate(int x, int y, int w, int h)
Definition: grscreen.cpp:113
int getId(void)
Definition: grscreen.h:87
static Vector y[4]
Definition: Convex.cpp:56
int getScrY(void)
Definition: grscreen.h:89
void selectPrevCar(void)
Definition: grscreen.cpp:149
void camDraw(tSituation *s)
Definition: grscreen.cpp:258
~cGrScreen()
Definition: grscreen.cpp:62
void switchMirror(void)
Definition: grscreen.cpp:179
int getScrW(void)
Definition: grscreen.h:90
int selectNextFlag
Definition: grscreen.h:52
int getScrX(void)
Definition: grscreen.h:88
class cGrBoard * board
Definition: grscreen.h:43
int scry
Definition: grscreen.h:47
int isInScreen(int x, int y)
Definition: grscreen.cpp:90
void setZoom(long zoom)
Definition: grscreen.cpp:139