OpenTTD Source 20250529-master-g10c159a79f
zoom_type.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#ifndef ZOOM_TYPE_H
11#define ZOOM_TYPE_H
12
13#include "core/enum_type.hpp"
14
16enum class ZoomLevel : uint8_t {
17 /* Our possible zoom-levels */
18 Begin = 0,
19 Min = Begin,
20 In4x = Begin,
21 In2x,
22 Normal,
23 Out2x,
24 Out4x,
25 Out8x,
26 Max = Out8x,
27 End,
28
29 /* Here we define in which zoom viewports are */
31 News = Normal,
32 Industry = Out2x,
33 Town = Normal,
35 Ship = Normal,
36 Train = Normal,
39
40 Detail = Out2x,
42};
46
47static const uint ZOOM_BASE_SHIFT = to_underlying(ZoomLevel::Normal);
48static uint const ZOOM_BASE = 1U << ZOOM_BASE_SHIFT;
49
50extern int _gui_scale;
51extern int _gui_scale_cfg;
52
53extern ZoomLevel _gui_zoom;
55#define ZOOM_LVL_GUI (_gui_zoom)
56
57static const int MIN_INTERFACE_SCALE = 100;
58static const int MAX_INTERFACE_SCALE = 500;
59
60#endif /* ZOOM_TYPE_H */
Enum-as-bit-set wrapper.
Type (helpers) for enums.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23)
Definition enum_type.hpp:17
#define DECLARE_ENUM_AS_SEQUENTIAL(enum_type)
For some enums it is useful to add/sub more than 1.
#define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type)
For some enums it is useful to have pre/post increment/decrement operators.
Definition enum_type.hpp:63
Aircraft, helicopters, rotors and their shadows belong to this class.
Definition aircraft.h:72
Defines the internal data of a functional industry.
Definition industry.h:64
Buses, trucks and trams belong to this class.
Definition roadveh.h:98
All ships have this type.
Definition ship.h:32
Container for all information about a text effect.
Definition texteff.cpp:23
Town data structure.
Definition town.h:52
'Train' is either a loco or a wagon.
Definition train.h:91
Data structure for viewport, display of a part of the world.
ZoomLevel
All zoom levels we know.
Definition zoom_type.h:16
@ Begin
Begin for iteration.
@ In2x
Zoomed 2 times in.
@ Max
Maximum zoom level.
@ Min
Minimum zoom level.
@ End
End for iteration.
@ WorldScreenshot
Default zoom level for the world screen shot.
@ Out2x
Zoomed 2 times out.
@ Normal
The normal zoom level.
@ In4x
Zoomed 4 times in.
@ Detail
All zoom levels below or equal to this will result in details on the screen, like road-work,...
@ Out8x
Zoomed 8 times out.
@ Out4x
Zoomed 4 times out.
@ News
Default zoom level for the news messages.
ZoomLevel _font_zoom
Sprite font Zoom level (not clamped)
Definition gfx.cpp:62
int _gui_scale_cfg
GUI scale in config.
Definition gfx.cpp:64
ZoomLevel _gui_zoom
GUI Zoom level.
Definition gfx.cpp:61
int _gui_scale
GUI scale, 100 is 100%.
Definition gfx.cpp:63