2
0

ApplicationWindowLinux.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2024 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Window/ApplicationWindow.h>
  6. // Responsible for opening the main window
  7. class ApplicationWindowLinux : public ApplicationWindow
  8. {
  9. public:
  10. /// Destructor
  11. ~ApplicationWindowLinux();
  12. /// Initialize the window
  13. virtual void Initialize(const char *inTitle) override;
  14. /// Access to the window handle
  15. Display * GetDisplay() const { return mDisplay; }
  16. Window GetWindow() const { return mWindow; }
  17. /// Event listener for the keyboard handler
  18. using EventListener = std::function<void(const XEvent &)>;
  19. void SetEventListener(const EventListener &inListener) { mEventListener = inListener; }
  20. /// Enter the main loop and keep rendering frames until the window is closed
  21. void MainLoop(RenderCallback inRenderCallback) override;
  22. protected:
  23. Display * mDisplay;
  24. Window mWindow;
  25. Atom mWmDeleteWindow;
  26. EventListener mEventListener;
  27. };