Re #166 (widget aspect ratio in split-screen mode) Applied Simon's patches 1 and 2

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2838 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 210a3ca3258a3d7871e09bd562ed92ec0f566854
Former-commit-id: 5799636a7e503c017455a245d3034d3cc9080e53
This commit is contained in:
pouillot 2010-10-06 18:57:54 +00:00
parent a8c370d080
commit ca5bcf1119
2 changed files with 17 additions and 3 deletions

View file

@ -48,7 +48,7 @@ static float grDefaultClr[4] = {0.9, 0.9, 0.15, 1.0};
#define NB_DEBUG 3
static const int Winx = 0;
static int Winw = 800;
static const int Winw = 800;
static const int Winy = 0;
static const int Winh = 600;
@ -64,7 +64,6 @@ static string st; //This is the line we will display in the bottom
cGrBoard::cGrBoard (int myid) {
id = myid;
trackMap = NULL;
Winw = grWinw*600/grWinh;
}

View file

@ -118,6 +118,16 @@ void cGrScreen::activate(int x, int y, int w, int h)
scrw = w;
scrh = h;
if (boardCam) {
// Boards assume a fixed geometry of 800x600
int overscan = (((float) scrw * 600 / (float) scrh) - 800) / 2;
if (overscan < 0) overscan = 0;
delete boardCam;
boardCam = new cGrOrthoCamera(this, -overscan, 800 + overscan, 0, 600);
}
if (mirrorCam) {
mirrorCam->setViewport (scrx, scry, scrw, scrh);
mirrorCam->setPos (scrx + scrw / 4, scry + 5 * scrh / 6 - scrh / 10, scrw / 2, scrh / 6);
@ -433,7 +443,12 @@ void cGrScreen::initCams(tSituation *s)
}
if (boardCam == NULL) {
boardCam = new cGrOrthoCamera(this,0, grWinw*600/grWinh, 0, 600);
// Boards assume a fixed geometry of 800x600
int overscan = (((float) scrw * 600 / (float) scrh) - 800) / 2;
if (overscan < 0) overscan = 0;
boardCam = new cGrOrthoCamera(this, -overscan, 800 + overscan, 0, 600);
}
if (bgCam == NULL) {