|
OpenTTD Source 20251116-master-g21329071df
|
Handling of the main viewport. More...
#include "stdafx.h"#include "currency.h"#include "spritecache.h"#include "window_gui.h"#include "window_func.h"#include "textbuf_gui.h"#include "viewport_func.h"#include "command_func.h"#include "console_gui.h"#include "progress.h"#include "transparency_gui.h"#include "map_func.h"#include "sound_func.h"#include "transparency.h"#include "strings_func.h"#include "zoom_func.h"#include "company_base.h"#include "company_func.h"#include "toolbar_gui.h"#include "statusbar_gui.h"#include "linkgraph/linkgraph_gui.h"#include "tilehighlight_func.h"#include "hotkeys.h"#include "error.h"#include "news_gui.h"#include "misc_cmd.h"#include "timer/timer.h"#include "timer/timer_window.h"#include "saveload/saveload.h"#include "widgets/main_widget.h"#include "network/network.h"#include "network/network_func.h"#include "network/network_gui.h"#include "network/network_base.h"#include "table/sprites.h"#include "table/strings.h"#include "safeguards.h"Go to the source code of this file.
Data Structures | |
| struct | MainWindow |
Functions | |
| bool | HandlePlacePushButton (Window *w, WidgetID widget, CursorID cursor, HighLightStyle mode) |
| This code is shared for the majority of the pushbuttons. | |
| void | CcPlaySound_EXPLOSION (Commands, const CommandCost &result, TileIndex tile) |
| bool | DoZoomInOutWindow (ZoomStateChange how, Window *w) |
| Zooms a viewport in a window in or out. | |
| void | ZoomInOrOutToCursorWindow (bool in, Window *w) |
| void | FixTitleGameZoom (int zoom_adjust) |
| bool | IsQuitKey (uint16_t keycode) |
| Does the given keycode match one of the keycodes bound to 'quit game'? | |
| void | ShowSelectGameWindow () |
| void | SetupColoursAndInitialWindow () |
| Initialise the default colours (remaps and the likes), and load the main windows. | |
| void | ShowVitalWindows () |
| Show the vital in-game windows. | |
| void | GameSizeChanged () |
| Size of the application screen changed. | |
Variables | |
| static constexpr std::initializer_list< NWidgetPart > | _nested_main_window_widgets |
| static WindowDesc | _main_window_desc (WDP_MANUAL, {}, 0, 0, WC_MAIN_WINDOW, WC_NONE, WindowDefaultFlag::NoClose, _nested_main_window_widgets, &MainWindow::hotkeys) |
Handling of the main viewport.
Definition in file main_gui.cpp.
| enum GlobalHotKeys : int32_t |
Definition at line 184 of file main_gui.cpp.
| void CcPlaySound_EXPLOSION | ( | Commands | , |
| const CommandCost & | result, | ||
| TileIndex | tile | ||
| ) |
Definition at line 81 of file main_gui.cpp.
| bool DoZoomInOutWindow | ( | ZoomStateChange | how, |
| Window * | w | ||
| ) |
Zooms a viewport in a window in or out.
| how | Zooming direction. |
| w | Window owning the viewport. |
true if zooming step could be done, false if further zooming is not possible. Definition at line 93 of file main_gui.cpp.
References _settings_client, ViewportData::dest_scrollpos_x, ViewportData::dest_scrollpos_y, ClientSettings::gui, Window::InvalidateData(), ViewportData::scrollpos_x, ViewportData::scrollpos_y, Window::viewport, Viewport::virtual_height, Viewport::virtual_width, Viewport::zoom, ZOOM_IN, GUISettings::zoom_max, GUISettings::zoom_min, ZOOM_NONE, and ZOOM_OUT.
Referenced by ConZoomToLevel(), MaxZoomInOut(), ExtraViewportWindow::OnClick(), IndustryViewWindow::OnMouseWheel(), MainWindow::OnMouseWheel(), TownViewWindow::OnMouseWheel(), and VehicleViewWindow::OnMouseWheel().
| void FixTitleGameZoom | ( | int | zoom_adjust | ) |
Definition at line 158 of file main_gui.cpp.
| void GameSizeChanged | ( | ) |
Size of the application screen changed.
Adapt the game screen-size, re-allocate the open windows, and repaint everything
Definition at line 596 of file main_gui.cpp.
References _cur_resolution, MarkWholeScreenDirty(), and RelocateAllWindows().
Referenced by VideoDriver_SDL_Base::ClientSizeChanged(), and VideoDriver_Win32Base::MakeWindow().
| bool HandlePlacePushButton | ( | Window * | w, |
| WidgetID | widget, | ||
| CursorID | cursor, | ||
| HighLightStyle | mode | ||
| ) |
This code is shared for the majority of the pushbuttons.
Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters
| w | Window which called the function |
| widget | ID of the widget (=button) that called this function |
| cursor | How should the cursor image change? E.g. cursor with depot image in it |
| mode | Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground |
Definition at line 63 of file main_gui.cpp.
References Window::IsWidgetDisabled(), Window::IsWidgetLowered(), Window::LowerWidget(), ResetObjectToPlace(), Window::SetDirty(), SetObjectToPlace(), SndClickBeep(), Window::window_class, and Window::window_number.
Referenced by BuildAirToolbarWindow::OnClick(), BuildDocksToolbarWindow::OnClick(), BuildIndustryWindow::OnClick(), BuildRailToolbarWindow::OnClick(), BuildRoadToolbarWindow::OnClick(), TerraformToolbarWindow::OnClick(), ScenarioEditorLandscapeGenerationWindow::OnClick(), and FoundTownWindow::OnClick().
| bool IsQuitKey | ( | uint16_t | keycode | ) |
Does the given keycode match one of the keycodes bound to 'quit game'?
| keycode | The keycode that was pressed by the user. |
Definition at line 541 of file main_gui.cpp.
References HotkeyList::CheckMatch().
Referenced by EndGameHighScoreBaseWindow::OnKeyPress().
| void SetupColoursAndInitialWindow | ( | ) |
Initialise the default colours (remaps and the likes), and load the main windows.
Definition at line 553 of file main_gui.cpp.
References GetColourPalette(), Recolour, SetColourGradient(), and ShowVitalWindows().
Referenced by GenerateWorld(), InitializeWindowsAndCaches(), and LoadIntroGame().
| void ShowSelectGameWindow | ( | ) |
Definition at line 399 of file intro_gui.cpp.
| void ShowVitalWindows | ( | ) |
Show the vital in-game windows.
Definition at line 582 of file main_gui.cpp.
References AllocateToolbar(), and ShowStatusBar().
Referenced by _GenerateWorld(), HighScoreWindow::Close(), and SetupColoursAndInitialWindow().
| void ZoomInOrOutToCursorWindow | ( | bool | in, |
| Window * | w | ||
| ) |
Definition at line 142 of file main_gui.cpp.
|
staticconstexpr |
Definition at line 180 of file main_gui.cpp.