OpenTTD Source: Driver Class Reference

OpenTTD Source 15.3

Public Types | Public Member Functions
Driver Class Referenceabstract

A driver for communicating with the user. More...

`#include <driver.h>`

Inheritance diagram for Driver:

## Public Types
enum | Type : uint8_t { DT_BEGIN = 0 , DT_MUSIC = 0 , DT_SOUND , DT_VIDEO , DT_END }
| The type of driver. More...

## Public Member Functions
virtual std::optional< std::string_view > | Start (const StringList &parm)=0
| Start this driver.
virtual void | Stop ()=0
| Stop this driver.
virtual std::string_view | GetName () const =0
| Get the name of this driver.

## Detailed Description

A driver for communicating with the user.

Definition at line 21 of file driver.h.

## Member Enumeration Documentation

## ◆ Type

enum Driver::Type : uint8_t

The type of driver.

Enumerator
DT_BEGIN | Helper for iteration.
DT_MUSIC | A music driver, needs to be before sound to properly shut down extmidi forked music players.
DT_SOUND | A sound driver.
DT_VIDEO | A video driver.
DT_END | Helper for iteration.

Definition at line 38 of file driver.h.

## Member Function Documentation

## ◆ GetName()

virtual std::string_view Driver::GetName | ( |  | ) | const
| pure virtual

Get the name of this driver.

Returns
  The name of the driver.

Implemented in MusicDriver_Allegro, MusicDriver_BeMidi, MusicDriver_Cocoa, MusicDriver_DMusic, MusicDriver_ExtMidi, MusicDriver_FluidSynth, MusicDriver_Null, MusicDriver_Win32, SoundDriver_Allegro, SoundDriver_Cocoa, SoundDriver_Null, SoundDriver_SDL, SoundDriver_Win32, SoundDriver_XAudio2, VideoDriver_Allegro, VideoDriver_CocoaOpenGL, VideoDriver_CocoaQuartz, VideoDriver_Dedicated, VideoDriver_Null, VideoDriver_SDL_Default, VideoDriver_SDL_OpenGL, and VideoDriver_Win32GDI.

Referenced by VideoDriver_SDL_Base::Start(), and SurveyConfiguration().

## ◆ Start()

virtual std::optional< std::string_view > Driver::Start | ( | const StringList & | parm | ) |
| pure virtual

Start this driver.

Parameters

  parm | Parameters passed to the driver.

Returns
  std::nullopt if everything went okay, otherwise an error message.

Implemented in MusicDriver_Null, SoundDriver_Null, MusicDriver_Allegro, MusicDriver_BeMidi, MusicDriver_Cocoa, MusicDriver_DMusic, MusicDriver_ExtMidi, MusicDriver_FluidSynth, MusicDriver_Win32, SoundDriver_Allegro, SoundDriver_Cocoa, SoundDriver_SDL, SoundDriver_Win32, SoundDriver_XAudio2, VideoDriver_Allegro, VideoDriver_CocoaOpenGL, VideoDriver_CocoaQuartz, VideoDriver_Dedicated, VideoDriver_Null, VideoDriver_SDL_OpenGL, VideoDriver_SDL_Base, and VideoDriver_Win32GDI.

## ◆ Stop()

virtual void Driver::Stop | ( |  | ) |
| pure virtual

Stop this driver.

Implemented in MusicDriver_Allegro, MusicDriver_BeMidi, MusicDriver_Cocoa, MusicDriver_DMusic, MusicDriver_ExtMidi, MusicDriver_FluidSynth, MusicDriver_Null, MusicDriver_Win32, SoundDriver_Allegro, SoundDriver_Cocoa, SoundDriver_Null, SoundDriver_SDL, SoundDriver_Win32, SoundDriver_XAudio2, VideoDriver_Allegro, VideoDriver_CocoaOpenGL, VideoDriver_Cocoa, VideoDriver_CocoaQuartz, VideoDriver_Dedicated, VideoDriver_Null, VideoDriver_SDL_OpenGL, VideoDriver_SDL_Base, VideoDriver_Win32Base, and VideoDriver_Win32GDI.

Referenced by CrashLog::AfterCrashLogCleanup(), and UserErrorI().

The documentation for this class was generated from the following file:

- src/driver.h