Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OoliteApp Class Reference

#include <OoliteApp.h>

+ Inheritance diagram for OoliteApp:
+ Collaboration diagram for OoliteApp:

Instance Methods

(void) - setExitContext:
 
(void) - sendEvent: [implementation]
 
(void) - terminate: [implementation]
 

Private Attributes

IBOutlet NSWindow * _gameWindow
 
IBOutlet GameController_gameController
 
NSString * _exitContext
 

Detailed Description

Definition at line 37 of file OoliteApp.h.

Method Documentation

◆ sendEvent:

- (void) sendEvent: (NSEvent *) theEvent
implementation

Definition at line 1 of file OoliteApp.m.

32 :(NSEvent *)theEvent
33{
34 NSEventType etype = [theEvent type];
35 MyOpenGLView* gameView = [_gameController gameView];
36
37 if ([NSApp keyWindow] == _gameWindow)
38 {
39 // Ensure key events are handled at least once when game window is key
40 switch (etype)
41 {
42 case NSKeyDown:
43 [gameView keyDown:theEvent];
44 break;
45
46 case NSKeyUp:
47 [gameView keyUp:theEvent];
48 break;
49
50 default:
51 break;
52 }
53 }
54 [super sendEvent:theEvent]; // perform the default event behaviour
55}
void keyDown:(NSEvent *theEvent)
void keyUp:(NSEvent *theEvent)
IBOutlet NSWindow * _gameWindow
Definition OoliteApp.h:40

References _gameController, _gameWindow, GameController::gameView, MyOpenGLView::keyDown:, and MyOpenGLView::keyUp:.

+ Here is the call graph for this function:

◆ setExitContext:

- (void) setExitContext: (NSString *) exitContext

Definition at line 1 of file OoliteApp.m.

58 :(NSString *)exitContext
59{
60 [_exitContext release];
61 _exitContext = [exitContext copy];
62}
NSString * _exitContext
Definition OoliteApp.h:42

◆ terminate:

- (void) terminate: (id) sender
implementation

Definition at line 1 of file OoliteApp.m.

65 :(id)sender
66{
67 if (_exitContext == nil) [self setExitContext:@"Cocoa terminate event"];
68 OOLog(@"exit.context", @"Exiting: %@.", _exitContext);
69 [super terminate:sender];
70}
#define OOLog(class, format,...)
Definition OOLogging.h:88
return nil

Member Data Documentation

◆ _exitContext

- (NSString*) _exitContext
private

Definition at line 42 of file OoliteApp.h.

◆ _gameController

- (IBOutlet GameController*) _gameController
private

Definition at line 41 of file OoliteApp.h.

Referenced by sendEvent:.

◆ _gameWindow

- (IBOutlet NSWindow*) _gameWindow
private

Definition at line 40 of file OoliteApp.h.

Referenced by sendEvent:.


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