|
evan 2026.1.4
Evan
|
Desktop platform implementation. More...
#include <headers/evan/glfw/IDesktopPlatform.hpp>


Public Member Functions | |
| ~IDesktopPlatform () override | |
| Destructor for DesktopPlatform. | |
| virtual std::vector< std::string > | getRequiredInstanceExtensions () const override=0 |
| Get the required instance extensions for the Desktop platform. | |
| bool | shouldClose () const override |
| Check if the Desktop platform should close. | |
| virtual std::vector< std::shared_ptr< utility::event::Event > > | pollEvents (ADeviceBackend &deviceBackend) override |
| Poll events for the Desktop platform. | |
| virtual VkSurfaceKHR | createSurface (VkInstance instance) const =0 |
| Create a Vulkan surface for the Desktop platform. | |
| std::shared_ptr< ADeviceBackend > | createDeviceBackend () const override |
| Create a device context for the Desktop platform. | |
| std::shared_ptr< ASwapchainContext > | createSwapchainContext (const DeviceContext &deviceContext) const override |
| Create a swapchain context for the Desktop platform. | |
| utility::event::KeyboardEvent::KeyCode | convertGlfwKeyToKeyCode (int glfwKey) const |
| Convert a GLFW key code to a KeyboardEvent::KeyCode. | |
| utility::event::MouseButtonEvent::Button | convertGlfwMouseButtonToButton (int glfwMouseButton) const |
| Convert a GLFW mouse button code to a MouseButtonEvent::Button. | |
| utility::event::KeyboardEvent::KeyModifiers | convertGlfwModsToKeyModifiers (int glfwMods) const |
| Convert GLFW modifier flags to KeyModifiers. | |
| utility::event::MouseMotionEvent::MousePosition | getMousePosition () const |
| Get the current mouse position. | |
| utility::event::MouseMotionEvent::MousePosition | convertCursorPosition (double xPos, double yPos) const |
| Convert a GLFW cursor position to framebuffer coordinates. | |
| std::vector< std::shared_ptr< utility::event::KeyboardEvent > > | getPressedMovementKeys () const |
| Get the current state of movement keys. | |
Public Member Functions inherited from evan::IPlatform | |
| virtual | ~IPlatform ()=default |
| Virtual destructor. | |
| virtual VkInstanceCreateFlags | getInstanceCreateFlags () const |
| Get platform-specific Vulkan instance creation flags. | |
| virtual std::vector< std::string > | getRequiredDeviceExtensions () const |
| Get platform-specific required Vulkan device extensions. | |
| virtual std::filesystem::path | getPipelineCachePath () const |
| Get the path where the Vulkan pipeline cache is persisted. | |
| Error | getLastError () const |
| Get the last error recorded by the platform. | |
Public Attributes | |
| GLFWwindow * | _window = nullptr |
| Currently active GLFW window for the Desktop platform. | |
| std::vector< std::shared_ptr< utility::event::KeyboardEvent > > | _keyboardEvents |
| Vector to store keyboard events. | |
| std::vector< std::shared_ptr< utility::event::MouseButtonEvent > > | _mouseButtonEvents |
| Vector to store mouse button events. | |
| std::vector< std::shared_ptr< utility::event::MouseMotionEvent > > | _mouseMotionEvents |
| Vector to store mouse motion events. | |
| std::vector< std::shared_ptr< utility::event::MouseWheelEvent > > | _mouseWheelEvents |
| Vector to store mouse wheel events. | |
| std::vector< std::shared_ptr< utility::event::CursorEnterEvent > > | _cursorEnterEvents |
| Vector to store cursor enter/leave events. | |
| std::vector< std::shared_ptr< utility::event::FileDropEvent > > | _fileDropEvents |
| Vector to store file drop events. | |
| std::vector< std::shared_ptr< utility::event::TextInputEvent > > | _textInputEvents |
| Vector to store text input events. | |
Additional Inherited Members | |
Protected Member Functions inherited from evan::IPlatform | |
| virtual std::filesystem::path | getDefaultCacheRoot () const =0 |
| Get the platform-specific cache root directory. | |
Protected Attributes inherited from evan::IPlatform | |
| Error | _lastError = Error::Ok |
| Sticky error recorded by the platform while polling events. | |
Desktop platform implementation.
This class provides an implementation of the IPlatform interface for Desktop. It handles platform-specific functionality related to Desktop using GLFW for window management and event handling.
Definition at line 34 of file IDesktopPlatform.hpp.
|
override |
Destructor for DesktopPlatform.
Ensures proper cleanup of Desktop resources.
Definition at line 13 of file IDesktopPlatform.cpp.
| utility::event::MouseMotionEvent::MousePosition evan::IDesktopPlatform::convertCursorPosition | ( | double | xPos, |
| double | yPos | ||
| ) | const |
Convert a GLFW cursor position to framebuffer coordinates.
GLFW reports cursor positions in screen coordinates (points on high-DPI displays), while the swapchain viewport is sized in framebuffer pixels. Scaling keeps ray picking and the debug pointer aligned with the on-screen mouse cursor.
| xPos | Horizontal cursor position in screen coordinates. |
| yPos | Vertical cursor position in screen coordinates. |
Definition at line 246 of file IDesktopPlatform.cpp.
| utility::event::KeyboardEvent::KeyCode evan::IDesktopPlatform::convertGlfwKeyToKeyCode | ( | int | glfwKey | ) | const |
Convert a GLFW key code to a KeyboardEvent::KeyCode.
| glfwKey | The GLFW key code to convert. |
Definition at line 184 of file IDesktopPlatform.cpp.
| utility::event::KeyboardEvent::KeyModifiers evan::IDesktopPlatform::convertGlfwModsToKeyModifiers | ( | int | glfwMods | ) | const |
Convert GLFW modifier flags to KeyModifiers.
| glfwMods | The GLFW modifier flags to convert. |
Definition at line 211 of file IDesktopPlatform.cpp.
| utility::event::MouseButtonEvent::Button evan::IDesktopPlatform::convertGlfwMouseButtonToButton | ( | int | glfwMouseButton | ) | const |
Convert a GLFW mouse button code to a MouseButtonEvent::Button.
| glfwMouseButton | The GLFW mouse button code to convert. |
Definition at line 190 of file IDesktopPlatform.cpp.
|
overridevirtual |
Create a device context for the Desktop platform.
This method creates a device context specific to the Desktop platform, which is responsible for managing Vulkan device resources and operations. The implementation may involve initializing Vulkan and setting up the necessary resources for rendering on the Desktop environment.
Implements evan::IPlatform.
Definition at line 30 of file IDesktopPlatform.cpp.
|
pure virtual |
Create a Vulkan surface for the Desktop platform.
| instance | The Vulkan instance to use for creating the surface. |
This method creates a Vulkan surface that is compatible with the Desktop platform, allowing rendered images to be presented on the screen. The implementation may involve using GLFW's functions to create a window surface that can be used with Vulkan.
Implemented in evan::LinuxDesktopPlatform, evan::MacOsDesktopPlatform, and evan::WindowsDesktopPlatform.
|
overridevirtual |
Create a swapchain context for the Desktop platform.
| deviceContext | The device context to use for creating the swapchain context. |
This method creates a swapchain context specific to the Desktop platform, which is responsible for managing the presentation of rendered images to the screen. The implementation may involve creating a Vulkan swapchain and associated resources tailored to the Desktop environment.
Implements evan::IPlatform.
Definition at line 38 of file IDesktopPlatform.cpp.

| utility::event::MouseMotionEvent::MousePosition evan::IDesktopPlatform::getMousePosition | ( | ) | const |
Get the current mouse position.
This method retrieves the current position of the mouse cursor on the screen, which can be used for handling mouse motion events and interactions within the application.
Definition at line 236 of file IDesktopPlatform.cpp.
| std::vector< std::shared_ptr< utility::event::KeyboardEvent > > evan::IDesktopPlatform::getPressedMovementKeys | ( | ) | const |
Get the current state of movement keys.
Polls the current state of movement keys (WASD, QE, arrows) and returns keyboard events for keys that are currently pressed. This enables continuous movement while holding keys.
Definition at line 273 of file IDesktopPlatform.cpp.
|
overridepure virtual |
Get the required instance extensions for the Desktop platform.
This method retrieves the necessary Vulkan instance extensions required for the Desktop platform, which may include extensions for window surface creation and other platform-specific features.
Implements evan::IPlatform.
Implemented in evan::LinuxDesktopPlatform, evan::MacOsDesktopPlatform, and evan::WindowsDesktopPlatform.
Definition at line 156 of file IDesktopPlatform.cpp.
|
overridevirtual |
Poll events for the Desktop platform.
| deviceBackend | The device backend to use for polling events. |
This method processes events for the Desktop platform, such as user input and window events, using the provided device backend. It ensures that the application remains responsive to user interactions and system events.
Note: The implementation of this method may involve using GLFW's event polling functions to handle events specific to the Desktop platform.
Implements evan::IPlatform.
Definition at line 65 of file IDesktopPlatform.cpp.
|
overridevirtual |
Check if the Desktop platform should close.
Implements evan::IPlatform.
Definition at line 177 of file IDesktopPlatform.cpp.
| std::vector<std::shared_ptr<utility::event::CursorEnterEvent> > evan::IDesktopPlatform::_cursorEnterEvents |
Vector to store cursor enter/leave events.
This vector holds unique pointers to CursorEnterEvent objects, which represent cursor enter/leave events that have been polled from the GLFW event system. Each CursorEnterEvent contains information about whether the cursor entered or left the window's content area.
Definition at line 270 of file IDesktopPlatform.hpp.
| std::vector<std::shared_ptr<utility::event::FileDropEvent> > evan::IDesktopPlatform::_fileDropEvents |
Vector to store file drop events.
This vector holds unique pointers to FileDropEvent objects, which represent file drop events that have been polled from the GLFW event system. Each FileDropEvent contains information about the paths of files and/or directories dropped on the window.
Definition at line 281 of file IDesktopPlatform.hpp.
| std::vector<std::shared_ptr<utility::event::KeyboardEvent> > evan::IDesktopPlatform::_keyboardEvents |
Vector to store keyboard events.
This vector holds unique pointers to KeyboardEvent objects, which represent keyboard input events that have been polled from the GLFW event system. Each KeyboardEvent contains information about the key that was pressed or released, as well as any modifier keys that were active at the time of the event. This allows the application to process keyboard input in a structured way, responding to user interactions effectively.
Definition at line 220 of file IDesktopPlatform.hpp.
| std::vector<std::shared_ptr<utility::event::MouseButtonEvent> > evan::IDesktopPlatform::_mouseButtonEvents |
Vector to store mouse button events.
This vector holds unique pointers to MouseButtonEvent objects, which represent mouse button input events that have been polled from the GLFW event system. Each MouseButtonEvent contains information about which mouse button was pressed or released, as well as the current state of all mouse buttons and the position of the mouse cursor at the time of the event. This allows the application to process mouse button input in a structured way, responding to user interactions effectively.
Definition at line 235 of file IDesktopPlatform.hpp.
| std::vector<std::shared_ptr<utility::event::MouseMotionEvent> > evan::IDesktopPlatform::_mouseMotionEvents |
Vector to store mouse motion events.
This vector holds unique pointers to MouseMotionEvent objects, which represent mouse motion events that have been polled from the GLFW event system. Each MouseMotionEvent contains information about the current position of the mouse cursor, allowing the application to respond to mouse movement and interactions effectively.
Definition at line 247 of file IDesktopPlatform.hpp.
| std::vector<std::shared_ptr<utility::event::MouseWheelEvent> > evan::IDesktopPlatform::_mouseWheelEvents |
Vector to store mouse wheel events.
This vector holds unique pointers to MouseWheelEvent objects, which represent mouse wheel scroll events that have been polled from the GLFW event system. Each MouseWheelEvent contains information about the scroll offset, allowing the application to respond to mouse wheel scrolling interactions effectively.
Definition at line 259 of file IDesktopPlatform.hpp.
| std::vector<std::shared_ptr<utility::event::TextInputEvent> > evan::IDesktopPlatform::_textInputEvents |
Vector to store text input events.
This vector holds unique pointers to TextInputEvent objects, which represent text input events that have been polled from the GLFW event system. Each TextInputEvent contains committed UTF-8 text input from the operating system's text input system.
Definition at line 292 of file IDesktopPlatform.hpp.
| GLFWwindow* evan::IDesktopPlatform::_window = nullptr |
Currently active GLFW window for the Desktop platform.
Definition at line 206 of file IDesktopPlatform.hpp.