/ src / AppDelegate.hh
AppDelegate.hh
 1  #pragma once
 2  
 3  #include "base.hh"
 4  
 5  #include "MTKViewDelegate.hh"
 6  
 7  #include <AppKit/AppKit.hpp>
 8  #include <Metal/Metal.hpp>
 9  #include <MetalKit/MetalKit.hpp>
10  
11  import std;
12  
13  /// A delegate for the main application, manages window initialization and lifecycle
14  class AppDelegate : public NS::ApplicationDelegate {
15      NS::Window* window;
16      NS::String* window_title;
17  
18      MTK::View* mtk_view;
19      MTL::Device* device;
20      std::unique_ptr<MTKViewDelegate> view_delegate;
21  
22  public:
23      AppDelegate();
24      AppDelegate(const char* title);
25  
26      ~AppDelegate();
27  
28      virtual void
29      applicationWillFinishLaunching(NS::Notification* pNotification) override;
30  
31      virtual void
32      applicationDidFinishLaunching(NS::Notification* pNotification) override;
33  
34      virtual bool
35      applicationShouldTerminateAfterLastWindowClosed(NS::Application* pSender) override;
36  };