evan 2026.1.4
Evan
Loading...
Searching...
No Matches
evan::LinuxDesktopPlatform Class Reference

Linux desktop platform implementation. More...

#include <headers/evan/glfw/platform/LinuxDesktopPlatform.hpp>

Inheritance diagram for evan::LinuxDesktopPlatform:
Collaboration diagram for evan::LinuxDesktopPlatform:

Public Member Functions

 LinuxDesktopPlatform (const std::string &name, const uint32_t width, const uint32_t height)
 Constructor for LinuxDesktopPlatform.
 
 ~LinuxDesktopPlatform ()=default
 Destructor for LinuxDesktopPlatform. This destructor ensures proper cleanup of resources associated with the Linux desktop platform, such as destroying the Vulkan surface and any other resources that were created during initialization.
 
std::vector< std::string > getRequiredInstanceExtensions () const override
 Get the required instance extensions for the Linux desktop platform.
 
VkSurfaceKHR createSurface (VkInstance instance) const override
 Create a Vulkan surface for the Linux desktop platform.
 
- Public Member Functions inherited from evan::IDesktopPlatform
 ~IDesktopPlatform () override
 Destructor for DesktopPlatform.
 
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.
 
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.
 

Protected Member Functions

std::filesystem::path getDefaultCacheRoot () const override
 Get the Linux cache root directory.
 

Additional Inherited Members

- Public Attributes inherited from evan::IDesktopPlatform
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.
 
- Protected Attributes inherited from evan::IPlatform
Error _lastError = Error::Ok
 Sticky error recorded by the platform while polling events.
 

Detailed Description

Linux desktop platform implementation.

This class provides an implementation of the IDesktopPlatform interface specifically for the Linux desktop environment. It handles platform-specific functionality related to Linux, such as creating a Vulkan surface using GLFW and managing the necessary resources for rendering on Linux.

Definition at line 25 of file LinuxDesktopPlatform.hpp.

Constructor & Destructor Documentation

◆ LinuxDesktopPlatform()

evan::LinuxDesktopPlatform::LinuxDesktopPlatform ( const std::string &  name,
const uint32_t  width,
const uint32_t  height 
)

Constructor for LinuxDesktopPlatform.

Parameters
nameThe name of the window.
widthThe width of the window.
heightThe height of the window. This constructor initializes the Linux desktop platform with the specified window parameters, setting up the necessary resources for rendering on Linux using Vulkan and GLFW.

Definition at line 13 of file LinuxDesktopPlatform.cpp.

Member Function Documentation

◆ createSurface()

VkSurfaceKHR evan::LinuxDesktopPlatform::createSurface ( VkInstance  instance) const
overridevirtual

Create a Vulkan surface for the Linux desktop platform.

Parameters
instanceThe Vulkan instance to use for creating the surface.
Returns
The created Vulkan surface. This method creates a Vulkan surface that is compatible with the Linux 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 on Linux.

Implements evan::IDesktopPlatform.

Definition at line 53 of file LinuxDesktopPlatform.cpp.

◆ getDefaultCacheRoot()

std::filesystem::path evan::LinuxDesktopPlatform::getDefaultCacheRoot ( ) const
overrideprotectedvirtual

Get the Linux cache root directory.

Returns
XDG_CACHE_HOME when set, ~/.cache otherwise, or an empty path when neither is available.

Implements evan::IPlatform.

Definition at line 72 of file LinuxDesktopPlatform.cpp.

◆ getRequiredInstanceExtensions()

std::vector< std::string > evan::LinuxDesktopPlatform::getRequiredInstanceExtensions ( ) const
overridevirtual

Get the required instance extensions for the Linux desktop platform.

Returns
A vector of strings representing the required instance extensions for the Linux desktop platform.

This method retrieves the necessary Vulkan instance extensions required for the Linux desktop platform, which may include extensions for window surface creation and other platform-specific features related to Vulkan on Linux.

Implements evan::IDesktopPlatform.

Definition at line 38 of file LinuxDesktopPlatform.cpp.


The documentation for this class was generated from the following files: