OpenTTD Source 20260815-master-gdf55704e7d
screensaver.h File Reference

Exports a function to turn on and off a screensaver mode. More...

Go to the source code of this file.

Functions

void ExitScreensaverMode ()
 Exits "Screensaver Mode".
void ToggleScreensaverMode ()
 Enters or exits "Screensaver Mode".

Detailed Description

Exports a function to turn on and off a screensaver mode.

Definition in file screensaver.h.

Function Documentation

◆ ExitScreensaverMode()

void ExitScreensaverMode ( )

Exits "Screensaver Mode".

This function always disables screensaver mode, which is useful for any automated actions that should exit the screensaver.

If the screensaver is not enabled, this function is a no-op.

See also
ToggleScreensaverMode

Definition at line 150 of file screensaver.cpp.

References _switch_timer, GetMainWindow(), and Window::viewport.

Referenced by SwitchVehicle(), and ToggleScreensaverMode().

◆ ToggleScreensaverMode()

void ToggleScreensaverMode ( )

Enters or exits "Screensaver Mode".

Screensaver mode is simply rotating the main window's followed vehicle every so often to show off a world full of moving trains, planes, boats, and automobiles.

If not activated, the function allocates a new IntervalTimer which fires every so often to pick new vehicles to follow. There is some randomness in this to keep things interesting.

If "Screensaver Mode" was previously activated, this instead deletes the aforementioned timer and stops following vehicles, returning the camera to the original position.

See also
SwitchVehicle

Definition at line 172 of file screensaver.cpp.

References _screensaver_check_interval, _switch_timer, ExitScreensaverMode(), and SwitchVehicle().

Referenced by MenuClickHelp().