OpenTTD Source: src/zoom_type.h Source File

OpenTTD Source 15.0-RC2

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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef ZOOM_TYPE_H
11#define ZOOM_TYPE_H
12
13#include "core/enum_type.hpp"
14
20 enum 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 */
34 Viewport = Normal,
35 News = Normal,
36 Industry = Out2x,
37 Town = Normal,
38 Aircraft = Normal,
39 Ship = Normal,
40 Train = Normal,
41 RoadVehicle = Normal,
42 WorldScreenshot = Normal,
43
44 Detail = Out2x,
45 TextEffect = Out2x,
46};
47 DECLARE_INCREMENT_DECREMENT_OPERATORS(ZoomLevel)
48 DECLARE_ENUM_AS_SEQUENTIAL(ZoomLevel)
49using ZoomLevels = EnumBitSet<ZoomLevel, uint8_t>;
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;
58extern ZoomLevel _font_zoom;
59
60static const int MIN_INTERFACE_SCALE = 100;
61static const int MAX_INTERFACE_SCALE = 500;
62
63#endif /* ZOOM_TYPE_H */
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
enum_type.hpp
Type (helpers) for enums.
to_underlying
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
DECLARE_ENUM_AS_SEQUENTIAL
#define DECLARE_ENUM_AS_SEQUENTIAL(enum_type)
For some enums it is useful to add/sub more than 1.
Definition enum_type.hpp:113
DECLARE_INCREMENT_DECREMENT_OPERATORS
#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
Aircraft, helicopters, rotors and their shadows belong to this class.
Definition aircraft.h:72
Industry
Defines the internal data of a functional industry.
Definition industry.h:62
RoadVehicle
Buses, trucks and trams belong to this class.
Definition roadveh.h:98
Ship
All ships have this type.
Definition ship.h:32
TextEffect
Container for all information about a text effect.
Definition texteff.cpp:23
Town
Town data structure.
Definition town.h:63
Train
'Train' is either a loco or a wagon.
Definition train.h:91
Viewport
Data structure for viewport, display of a part of the world.
Definition viewport_type.h:31
_font_zoom
ZoomLevel _font_zoom
Sprite font Zoom level (not clamped)
Definition gfx.cpp:62
_gui_scale_cfg
int _gui_scale_cfg
GUI scale in config.
Definition gfx.cpp:64
ZoomLevel
ZoomLevel
All zoom levels we know.
Definition zoom_type.h:20
ZoomLevel::Begin
@ Begin
Begin for iteration.
ZoomLevel::In2x
@ In2x
Zoomed 2 times in.
ZoomLevel::Max
@ Max
Maximum zoom level.
ZoomLevel::Min
@ Min
Minimum zoom level.
ZoomLevel::End
@ End
End for iteration.
ZoomLevel::WorldScreenshot
@ WorldScreenshot
Default zoom level for the world screen shot.
ZoomLevel::Out2x
@ Out2x
Zoomed 2 times out.
ZoomLevel::Normal
@ Normal
The normal zoom level.
ZoomLevel::In4x
@ In4x
Zoomed 4 times in.
ZoomLevel::Detail
@ Detail
All zoom levels below or equal to this will result in details on the screen, like road-work,...
ZoomLevel::Out8x
@ Out8x
Zoomed 8 times out.
ZoomLevel::Out4x
@ Out4x
Zoomed 4 times out.
ZoomLevel::News
@ News
Default zoom level for the news messages.
_gui_zoom
ZoomLevel _gui_zoom
GUI Zoom level.
Definition gfx.cpp:61
_gui_scale
int _gui_scale
GUI scale, 100 is 100%.
Definition gfx.cpp:63