| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #include "Input/BsKeyboard.h"
- #include "Input/BsInput.h"
- #include "MacOS/BsMacOSInput.h"
- namespace bs
- {
- /** Contains private data for the MacOS Keyboard implementation. */
- struct Keyboard::Pimpl
- {
- explicit Pimpl(Input* owner)
- :hid(HIDType::Keyboard, owner)
- { }
- HIDManager hid;
- bool hasInputFocus = true;
- };
- Keyboard::Keyboard(const String& name, Input* owner)
- : mName(name), mOwner(owner)
- {
- m = bs_new<Pimpl>(owner);
- }
- Keyboard::~Keyboard()
- {
- bs_delete(m);
- }
- void Keyboard::capture()
- {
- m->hid.capture(nullptr, !m->hasInputFocus);
- }
- void Keyboard::changeCaptureContext(UINT64 windowHandle)
- {
- m->hasInputFocus = windowHandle != (UINT64)-1;
- }
- }
|