ApplicationWindowLinux.h 994 B

1234567891011121314151617181920212223242526272829303132
  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. /// Initialize the window
  11. virtual void Initialize() override;
  12. /// Access to the window handle
  13. Display * GetDisplay() const { return mDisplay; }
  14. Window GetWindow() const { return mWindow; }
  15. /// Event listener for the keyboard handler
  16. using EventListener = std::function<void(const XEvent &)>;
  17. void SetEventListener(const EventListener &inListener) { mEventListener = inListener; }
  18. /// Enter the main loop and keep rendering frames until the window is closed
  19. void MainLoop(RenderCallback inRenderCallback) override;
  20. protected:
  21. Display * mDisplay;
  22. Window mWindow;
  23. Atom mWmDeleteWindow;
  24. EventListener mEventListener;
  25. };