ScummVM API documentation
dialog_unit.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BAGEL_HODJNPODJ_LIBS_DIALOG_UNIT_H
23 #define BAGEL_HODJNPODJ_LIBS_DIALOG_UNIT_H
24 
25 #include "common/rect.h"
26 #include "bagel/hodjnpodj/gfx/gfx_surface.h"
27 
28 namespace Bagel {
29 namespace HodjNPodj {
30 
31 constexpr double X_FACTOR = 4.6;
32 
33 struct DialogPoint : public Common::Point {
34 public:
35  DialogPoint(int xx, int yy) {
36  GfxSurface s;
37  s.setFontSize(8);
38  this->x = (xx * s.getStringWidth("X")) / X_FACTOR;
39  this->y = (yy * s.getStringHeight()) / 8;
40  }
41  DialogPoint(int fontSize, int xx, int yy) {
42  GfxSurface s;
43  s.setFontSize(fontSize);
44  this->x = (xx * s.getStringWidth("X")) / X_FACTOR;
45  this->y = (yy * s.getStringHeight()) / 8;
46  }
47 };
48 
49 struct DialogRect : public Common::Rect {
50 public:
51  DialogRect(int x, int y, int w, int h) {
52  GfxSurface s;
53  s.setFontSize(8);
54  left = (x * s.getStringWidth("X")) / X_FACTOR;
55  top = (y * s.getStringHeight()) / 8;
56  right = left + (w * s.getStringWidth("X")) / X_FACTOR;
57  bottom = top + (h * s.getStringHeight()) / 8;
58  }
59  DialogRect(int fontSize, int x, int y, int w, int h) {
60  GfxSurface s;
61  s.setFontSize(fontSize);
62  left = (x * s.getStringWidth("X")) / X_FACTOR;
63  top = (y * s.getStringHeight()) / 8;
64  right = left + (w * s.getStringWidth("X")) / X_FACTOR;
65  bottom = top + (h * s.getStringHeight()) / 8;
66  }
67 };
68 
69 } // namespace HodjNPodj
70 } // namespace Bagel
71 
72 #endif
Definition: rect.h:524
int16 y
Definition: rect.h:49
int16 x
Definition: rect.h:48
Definition: rect.h:144
Definition: afxwin.h:27
Definition: dialog_unit.h:49
Definition: dialog_unit.h:33