diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-05-18 05:27:06 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-05-18 05:27:06 +0000 |
| commit | 670ec0dfe7b0449c6305e601a34fca6bbebaf58b (patch) | |
| tree | 2f8724ab32f4e202dcb74c1cb94a1bf01497b100 | |
| parent | Updated samples (fixed input controller issue on UWP) (diff) | |
| download | DiligentEngine-670ec0dfe7b0449c6305e601a34fca6bbebaf58b.tar.gz DiligentEngine-670ec0dfe7b0449c6305e601a34fca6bbebaf58b.zip | |
NativeAppMacOS: enabled shift/ctrl/alt press handling
| -rw-r--r-- | Common/NativeApp/Apple/Source/Classes/OSX/ViewController.mm | 20 | ||||
| -rw-r--r-- | Common/NativeApp/include/MacOS/MacOSAppBase.h | 1 | ||||
| m--------- | DiligentSamples | 0 |
3 files changed, 21 insertions, 0 deletions
diff --git a/Common/NativeApp/Apple/Source/Classes/OSX/ViewController.mm b/Common/NativeApp/Apple/Source/Classes/OSX/ViewController.mm index 0df734b..6af9c4c 100644 --- a/Common/NativeApp/Apple/Source/Classes/OSX/ViewController.mm +++ b/Common/NativeApp/Apple/Source/Classes/OSX/ViewController.mm @@ -136,6 +136,26 @@ [super keyUp:theEvent]; } +// Informs the receiver that the user has pressed or released a +// modifier key (Shift, Control, and so on) +- (void)flagsChanged:(NSEvent *)event +{ + auto modifierFlags = [event modifierFlags]; + { + auto* view = (ViewBase*)self.view; + auto* theApp = [view lockApp]; + if(theApp) + { + theApp->OnFlagsChanged(modifierFlags & NSEventModifierFlagShift, + modifierFlags & NSEventModifierFlagControl, + modifierFlags & NSEventModifierFlagOption); + } + [view unlockApp]; + } + + [super flagsChanged:event]; +} + - (BOOL)acceptsFirstResponder { return YES; } diff --git a/Common/NativeApp/include/MacOS/MacOSAppBase.h b/Common/NativeApp/include/MacOS/MacOSAppBase.h index 2922ac9..a242b8e 100644 --- a/Common/NativeApp/include/MacOS/MacOSAppBase.h +++ b/Common/NativeApp/include/MacOS/MacOSAppBase.h @@ -40,6 +40,7 @@ public: virtual void OnMouseMove(int x, int y){} virtual void OnKeyPressed(int key){} virtual void OnKeyReleased(int key){} + virtual void OnFlagsChanged(bool ShiftPressed, bool ControlPressed, bool AltPressed){} protected: Timer timer; diff --git a/DiligentSamples b/DiligentSamples -Subproject d4ce5dffc4cf7fec9d76bb5737311f88332cd48 +Subproject 8e9e8a1fd07b6c0f2c72dc44a5d9e0619422dae |
