evan 2026.1.4
Evan
Loading...
Searching...
No Matches
IDesktopPlatform.hpp
1/*
2** ETIB PROJECT, 2026
3** evan
4** File description:
5** IDesktopPlatform
6*/
7
8#pragma once
9
10#include "evan/IPlatform.hpp"
11#include "evan/glfw/DesktopBackend.hpp"
12#include "evan/glfw/DesktopSwapchainContext.hpp"
13#include "evan/glfw/GlfwContext.hpp"
14
15#include <utility/event/keyboard_event.hpp>
16#include <utility/event/mouse_button_event.hpp>
17#include <utility/event/mouse_motion_event.hpp>
18#include <utility/event/mouse_wheel_event.hpp>
19#include <utility/event/cursor_enter_event.hpp>
20#include <utility/event/file_drop_event.hpp>
21#include <utility/event/text_input_event.hpp>
22
23#include <iostream>
24
25namespace evan
26{
35 {
36 public:
42 ~IDesktopPlatform() override;
43
54 virtual std::vector<std::string>
55 getRequiredInstanceExtensions() const override = 0;
56
62 bool shouldClose() const override;
63
82 virtual std::vector<std::shared_ptr<utility::event::Event>>
83 pollEvents(ADeviceBackend &deviceBackend) override;
84
96 virtual VkSurfaceKHR createSurface(VkInstance instance) const = 0;
97
110 std::shared_ptr<ADeviceBackend> createDeviceBackend() const override;
111
125 std::shared_ptr<ASwapchainContext> createSwapchainContext(
126 const DeviceContext &deviceContext) const override;
127
136 utility::event::KeyboardEvent::KeyCode
137 convertGlfwKeyToKeyCode(int glfwKey) const;
138
148 utility::event::MouseButtonEvent::Button
149 convertGlfwMouseButtonToButton(int glfwMouseButton) const;
150
159 utility::event::KeyboardEvent::KeyModifiers
160 convertGlfwModsToKeyModifiers(int glfwMods) const;
161
171 utility::event::MouseMotionEvent::MousePosition
172 getMousePosition() const;
173
187 utility::event::MouseMotionEvent::MousePosition
188 convertCursorPosition(double xPos, double yPos) const;
189
200 std::vector<std::shared_ptr<utility::event::KeyboardEvent>>
202
206 GLFWwindow *_window = nullptr;
207
219 std::vector<std::shared_ptr<utility::event::KeyboardEvent>>
221
234 std::vector<std::shared_ptr<utility::event::MouseButtonEvent>>
236
246 std::vector<std::shared_ptr<utility::event::MouseMotionEvent>>
248
258 std::vector<std::shared_ptr<utility::event::MouseWheelEvent>>
260
269 std::vector<std::shared_ptr<utility::event::CursorEnterEvent>>
271
280 std::vector<std::shared_ptr<utility::event::FileDropEvent>>
282
291 std::vector<std::shared_ptr<utility::event::TextInputEvent>>
293
294 private:
302 evan::glfw::GlfwContext _glfwContext;
303 };
304} // namespace evan
Abstract base class for Vulkan device backends.
Represents the device context for the engine, managing Vulkan-related resources and operations.
Desktop platform implementation.
~IDesktopPlatform() override
Destructor for DesktopPlatform.
virtual VkSurfaceKHR createSurface(VkInstance instance) const =0
Create a Vulkan surface for the Desktop platform.
bool shouldClose() const override
Check if the Desktop platform should close.
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.
std::vector< std::shared_ptr< utility::event::MouseButtonEvent > > _mouseButtonEvents
Vector to store mouse button events.
utility::event::MouseButtonEvent::Button convertGlfwMouseButtonToButton(int glfwMouseButton) const
Convert a GLFW mouse button code to a MouseButtonEvent::Button.
std::vector< std::shared_ptr< utility::event::KeyboardEvent > > _keyboardEvents
Vector to store keyboard events.
std::vector< std::shared_ptr< utility::event::MouseWheelEvent > > _mouseWheelEvents
Vector to store mouse wheel events.
GLFWwindow * _window
Currently active GLFW window for the Desktop platform.
utility::event::KeyboardEvent::KeyModifiers convertGlfwModsToKeyModifiers(int glfwMods) const
Convert GLFW modifier flags to KeyModifiers.
utility::event::MouseMotionEvent::MousePosition convertCursorPosition(double xPos, double yPos) const
Convert a GLFW cursor position to framebuffer coordinates.
virtual std::vector< std::shared_ptr< utility::event::Event > > pollEvents(ADeviceBackend &deviceBackend) override
Poll events for the Desktop platform.
virtual std::vector< std::string > getRequiredInstanceExtensions() const override=0
Get the required instance extensions for the Desktop platform.
std::vector< std::shared_ptr< utility::event::TextInputEvent > > _textInputEvents
Vector to store text input events.
utility::event::MouseMotionEvent::MousePosition getMousePosition() const
Get the current mouse position.
std::vector< std::shared_ptr< utility::event::KeyboardEvent > > getPressedMovementKeys() const
Get the current state of movement keys.
std::vector< std::shared_ptr< utility::event::FileDropEvent > > _fileDropEvents
Vector to store file drop events.
std::vector< std::shared_ptr< utility::event::MouseMotionEvent > > _mouseMotionEvents
Vector to store mouse motion events.
std::vector< std::shared_ptr< utility::event::CursorEnterEvent > > _cursorEnterEvents
Vector to store cursor enter/leave events.
std::shared_ptr< ADeviceBackend > createDeviceBackend() const override
Create a device context for the Desktop platform.
Abstract interface for platform-specific functionality.
Definition IPlatform.hpp:36
Reference-counted GLFW lifecycle guard.