OpenTTD Source 20260421-master-gc2fbc6fdeb
OTTDMain Class Reference

The main class of the application, the application's delegate. More...

Inheritance diagram for OTTDMain:

Instance Methods

(void) - stopEngine [implementation]
 Stop the game engine.
(void) - launchGameEngine: [implementation]
 Start the game loop.
(void) - applicationDidFinishLaunching: [implementation]
 Called when the internal event loop has just started running.
(NSApplicationTerminateReply) - applicationShouldTerminate: [implementation]
 Display the in game quit confirmation dialog.
(void) - unregisterObserver [implementation]
 Remove ourself as a notification observer.
(BOOL) - applicationSupportsSecureRestorableState: [implementation]
 Indicates to AppKit that OpenTTD is compatible with secure state storage.

Detailed Description

The main class of the application, the application's delegate.

Definition at line 71 of file cocoa_wnd.mm.

Method Documentation

◆ applicationDidFinishLaunching:

- (void) applicationDidFinishLaunching: (NSNotification*) note
implementation

Called when the internal event loop has just started running.

Parameters
noteNotification containing the application object. Exists because the API requires it.

Definition at line 216 of file cocoa_wnd.mm.

◆ applicationShouldTerminate:

- (NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication*) sender
implementation

Display the in game quit confirmation dialog.

Parameters
senderThe application object. Exists because the API requires it.
Returns
Whether the application should be terminating right now.

Definition at line 230 of file cocoa_wnd.mm.

◆ applicationSupportsSecureRestorableState:

- (BOOL) applicationSupportsSecureRestorableState: (NSApplication*) sender
implementation

Indicates to AppKit that OpenTTD is compatible with secure state storage.

Starting with macOS 12, macOS expects us to be better compatible with NSSecureCoding, as to prevent attacks through restorable storage. Starting with 14, macOS logs a warning if we don't implement this ourselves. Since OpenTTD does not (yet) make use of restorable state, we simply don't care what happens with it.

Explained here: https://developer.apple.com/documentation/foundation/nssecurecoding

Parameters
senderThe application object. Exists because the API requires it.
Returns
Always YES.

Definition at line 254 of file cocoa_wnd.mm.

◆ launchGameEngine:

- (void) launchGameEngine: (NSNotification*) note
implementation

Start the game loop.

Parameters
noteNotification containing the application object. Exists because the API requires it.

Definition at line 196 of file cocoa_wnd.mm.

References VideoDriver::GetInstance(), and VideoDriver_Cocoa::MainLoopReal().

◆ stopEngine

- (void) stopEngine
implementation

Stop the game engine.

Must be called on main thread.

Definition at line 182 of file cocoa_wnd.mm.

References stopEngine.

Referenced by stopEngine.

◆ unregisterObserver

- (void) unregisterObserver
implementation

Remove ourself as a notification observer.

Definition at line 240 of file cocoa_wnd.mm.

References unregisterObserver.

Referenced by CocoaExitApplication(), and unregisterObserver.


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