1 /*
2 * Kuklomenos
3 * Copyright (C) 2008-2009 Martin Bays <mbays@sdf.lonestar.org>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see http://www.gnu.org/licenses/.
17 */
18
19 #include <algorithm>
20
21 #include "geom.h"
22 #include "gfx.h"
23 #include "coords.h"
24
ScreenGeom(int iwidth,int iheight)25 ScreenGeom::ScreenGeom(int iwidth, int iheight) :
26 width(iwidth), height(iheight),
27 centre(iwidth/2, iheight/2),
28 rad(std::min(iwidth,iheight)/2 - 20)
29 {
30 // info = centre + [(rad+[room for infoMaxLines lines]) out at pi/6],
31 // where infoMaxLines is preferably 3, less if necessary.
32 // We assume a 7x13 font with two pixels gap between lines.
33 infoMaxLines = 3;
34 while ((int)((rad+17*infoMaxLines)*0.866) > centre.y)
35 infoMaxLines--;
36 info.x = centre.x + (rad+17*infoMaxLines)/2;
37 info.y = centre.y - (int)((rad+17*infoMaxLines)*0.866);
38 infoMaxLength = (width - info.x) / 7;
39
40 indicatorRsqLim1 = (rad+3)*(rad+3);
41 indicatorRsqLim2 = (rad+8)*(rad+8);
42 indicatorRsqLim3 = (rad+10)*(rad+10);
43 indicatorRsqLim4 = (rad+15)*(rad+15);
44 }
45
46 ScreenGeom screenGeom;
47
48 int ARENA_RAD = 220;
49
50 float ZOOMDIST_MAX = (float)((ARENA_RAD/2));
51
52 float AIM_MIN = 20.0;
53 float ZOOM_MIN = 0.0;
54 float AIM_MAX = ZOOMDIST_MAX;
55
56 CartCoord ARENA_CENTRE(0,0);
57