From ca5bcf1119247d13c2f5d103d0c1db142fa0977c Mon Sep 17 00:00:00 2001 From: pouillot Date: Wed, 6 Oct 2010 18:57:54 +0000 Subject: [PATCH] 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 --- src/modules/graphic/ssggraph/grboard.cpp | 3 +-- src/modules/graphic/ssggraph/grscreen.cpp | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/modules/graphic/ssggraph/grboard.cpp b/src/modules/graphic/ssggraph/grboard.cpp index d59f8117..7f99a66b 100644 --- a/src/modules/graphic/ssggraph/grboard.cpp +++ b/src/modules/graphic/ssggraph/grboard.cpp @@ -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; } diff --git a/src/modules/graphic/ssggraph/grscreen.cpp b/src/modules/graphic/ssggraph/grscreen.cpp index bf3a8be7..4ffc368e 100644 --- a/src/modules/graphic/ssggraph/grscreen.cpp +++ b/src/modules/graphic/ssggraph/grscreen.cpp @@ -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) {