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

Windows desktop platform implementation. More...

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

Inheritance diagram for evan::WindowsDesktopPlatform:
Collaboration diagram for evan::WindowsDesktopPlatform:

Public Member Functions

 WindowsDesktopPlatform (const std::string &name, const uint32_t width, const uint32_t height)
 Constructor for WindowsDesktopPlatform.
 
 ~WindowsDesktopPlatform ()=default
 Destructor for WindowsDesktopPlatform. This destructor ensures proper cleanup of resources associated with the Windows 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 Windows desktop platform.
 
VkSurfaceKHR createSurface (VkInstance instance) const override
 Create a Vulkan surface for the Windows 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 Windows 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

Windows desktop platform implementation.

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

Definition at line 25 of file WindowsPlatform.hpp.

Constructor & Destructor Documentation

◆ WindowsDesktopPlatform()

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

Constructor for WindowsDesktopPlatform.

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

Definition at line 13 of file WindowsPlatoform.cpp.

Member Function Documentation

◆ createSurface()

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

Create a Vulkan surface for the Windows desktop platform.

Parameters
instanceThe Vulkan instance to use for creating the surface.
Returns
The created Vulkan surface for the Windows desktop platform.

This method creates a Vulkan surface using GLFW for the Windows desktop platform. It utilizes GLFW's functionality to create a window surface that can be used with Vulkan for rendering. If surface creation fails, it throws a runtime error indicating that the surface could not be created.

Implements evan::IDesktopPlatform.

Definition at line 52 of file WindowsPlatoform.cpp.

◆ getDefaultCacheRoot()

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

Get the Windows cache root directory.

Returns
LOCALAPPDATA%, or an empty path when it is not set.

Implements evan::IPlatform.

Definition at line 71 of file WindowsPlatoform.cpp.

◆ getRequiredInstanceExtensions()

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

Get the required instance extensions for the Windows desktop platform.

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

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

Implements evan::IDesktopPlatform.

Definition at line 37 of file WindowsPlatoform.cpp.


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