OpenTTD Source 20251019-master-g9f7f314f81
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
20enum class ZoomLevel : int8_t {
21 /* Our possible zoom-levels */
22 Begin = 0,
23 Min = Begin,
24 In4x = Begin,
25 In2x,
26 Normal,
27 Out2x,
28 Out4x,
29 Out8x,
30 Max = Out8x,
31 End,
32
33 /* Here we define in which zoom viewports are */
35 News = Normal,
36 Industry = Out2x,
37 Town = Normal,
39 Ship = Normal,
40 Train = Normal,
43
44 Detail = Out2x,
46};
50
51static const uint ZOOM_BASE_SHIFT = to_underlying(ZoomLevel::Normal);
52static uint const ZOOM_BASE = 1U << ZOOM_BASE_SHIFT;
53
54extern int _gui_scale;
55extern int _gui_scale_cfg;
56
57extern ZoomLevel _gui_zoom;
59
60static const int MIN_INTERFACE_SCALE = 100;
61static const int MAX_INTERFACE_SCALE = 500;
62
63#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:62
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:63
'Train' is either a loco or a wagon.
Definition train.h:91
Data structure for viewport, display of a part of the world.
ZoomLevel _font_zoom
Sprite font Zoom level (not clamped)
Definition gfx.cpp:63
int _gui_scale_cfg
GUI scale in config.
Definition gfx.cpp:65
ZoomLevel
All zoom levels we know.
Definition zoom_type.h:20
@ 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 _gui_zoom
GUI Zoom level.
Definition gfx.cpp:62
int _gui_scale
GUI scale, 100 is 100%.
Definition gfx.cpp:64