8 #ifndef vsg_iOS_Window_h
9 #define vsg_iOS_Window_h
13 #include <vsg/app/Window.h>
14 #include <vsg/ui/KeyEvent.h>
15 #include <vulkan/vulkan_metal.h>
16 #include <UIKit/UiKit.h>
19 - (vsg::ref_ptr<vsg::Window>) vsgWindow;
20 - (instancetype)initWithTraits:(vsg::ref_ptr<vsg::WindowTraits>)traits andVsgViewer:(vsg::ref_ptr<vsg::Viewer>) vsgViewer;
28 extern vsg::Names getInstanceExtensions();
36 using kVKKeyCodeToKeySymbolMap = std::map<unsigned short, vsg::KeySymbol>;
38 bool getKeySymbol(UIEvent* anEvent, vsg::KeySymbol& keySymbol, vsg::KeySymbol& modifiedKeySymbol, vsg::KeyModifier& keyModifier);
41 kVKKeyCodeToKeySymbolMap _keycodeMap;
55 const char* instanceExtensionSurfaceName()
const override {
return VK_EXT_METAL_SURFACE_EXTENSION_NAME; }
57 bool valid()
const override {
return _window; }
63 void resize()
override;
65 bool handleUIEvent(UIEvent* anEvent);
70 CAMetalLayer* layer() {
return _metalLayer; };
72 vsg::clock::time_point getEventTime(
double eventTime)
74 long elapsedmilli = long(
double(eventTime - _first_macos_timestamp) * 1000.0f);
75 return _first_macos_time_point + std::chrono::milliseconds(elapsedmilli);
78 void queueEvent(
vsg::UIEvent* anEvent) { _bufferedEvents.emplace_back(anEvent); }
81 virtual ~iOS_Window();
83 void _initSurface()
override;
87 CAMetalLayer* _metalLayer;
89 double _first_macos_timestamp = 0;
90 vsg::clock::time_point _first_macos_time_point;
92 vsg::UIEvents _bufferedEvents;
UIEvent is a base class for user interface events.
Definition: UIEvent.h:28
KeyboardMap maps iOS keyboard events to vsg::KeySymbol.
Definition: iOS_Window.h:32
iOS_Window implements iOS specific window creation, event handling and vulkan Surface setup.
Definition: iOS_Window.h:47
bool pollEvents(vsg::UIEvents &events) override
get the list of events since the last pollEvents call by splicing bufferEvents with polled windowing ...
Definition: iOS_ViewController.h:10
Definition: iOS_Window.h:19