Crafter.Graphics
C++ graphics library using Wayland and Vulkan.
 
Loading...
Searching...
No Matches
Crafter::WindowWaylandVulkan Class Referenceexport

A Wayland window specialized for Vulkan rendering. More...

Inheritance diagram for Crafter::WindowWaylandVulkan:
Crafter::WindowWayland Crafter::Window

Public Member Functions

 WindowWaylandVulkan (std::string name, std::uint32_t width, std::uint32_t height)
 Constructs a WindowWaylandVulkan instance.
 
 ~WindowWaylandVulkan ()
 Destructor for the WindowWaylandVulkan.
 
VkCommandBuffer StartInit ()
 Starts Vulkan initialization and returns a command buffer.
 
void FinishInit ()
 Completes Vulkan initialization.
 
void StartAsync ()
 Starts the event loop asynchronously.
 
void StartSync ()
 Starts the event loop synchronously.
 
- Public Member Functions inherited from Crafter::WindowWayland
 WindowWayland (std::string name, std::uint32_t width, std::uint32_t height)
 Constructs a Wayland window with a given name and size.
 
 ~WindowWayland ()
 Destructor cleans up Wayland-specific window resources.
 
- Public Member Functions inherited from Crafter::Window
 Window (std::string name, std::uint32_t width, std::uint32_t height)
 Constructs a Window with a given name and dimensions.
 
ScaleData ScaleElement (const UiElement &element)
 Calculates the real position and size of an UiElement.
 

Public Attributes

Event< VkCommandBuffer > onDraw
 
- Public Attributes inherited from Crafter::Window
Event< MousePoint > onMouseRightClick
 
Event< MousePoint > onMouseLeftClick
 
Event< MousePoint > onMouseRightHold
 
Event< MousePoint > onMouseLeftHold
 
Event< MousePoint > onMouseRightRelease
 
Event< MousePoint > onMouseLeftRelease
 
Event< MouseMoveEvent > onMouseMove
 
Event< MouseMoveEvent > onMouseEnter
 
Event< MouseMoveEvent > onMouseLeave
 
Event< double > onMouseScroll
 
Event< void > onClose
 
MousePoint currentMousePos
 
MousePoint lastMousePos
 
MousePoint mouseDelta
 
bool mouseLeftHeld = false
 
bool mouseRightHeld = false
 
bool heldkeys [255] = {}
 
Event< void > onKeyDown [255]
 
Event< void > onKeyHold [255]
 
Event< void > onKeyUp [255]
 
Event< char > onAnyKeyDown
 
Event< char > onAnyKeyHold
 
Event< char > onAnyKeyUp
 
std::vector< UiElementelements
 
std::string name
 
std::uint32_t width
 
std::uint32_t height
 
float scale = 1
 
bool open = true
 

Additional Inherited Members

- Static Protected Member Functions inherited from Crafter::WindowWayland
static void PointerListenerHandleMotion (void *data, wl_pointer *wl_pointer, uint time, wl_fixed_t surface_x, wl_fixed_t surface_y)
 
static void PointerListenerHandleAxis (void *, wl_pointer *, std::uint32_t, std::uint32_t, wl_fixed_t value)
 
static void PointerListenerHandleEnter (void *data, wl_pointer *wl_pointer, uint serial, wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y)
 
static void PointerListenerHandleLeave (void *, wl_pointer *, std::uint32_t, wl_surface *)
 
static void xdg_toplevel_handle_close (void *data, xdg_toplevel *)
 
static void handle_global (void *data, wl_registry *registry, std::uint32_t name, const char *interface, std::uint32_t version)
 
static void pointer_handle_button (void *data, wl_pointer *pointer, std::uint32_t serial, std::uint32_t time, std::uint32_t button, std::uint32_t state)
 
static void seat_handle_capabilities (void *data, wl_seat *seat, uint32_t capabilities)
 
static void xdg_surface_handle_configure (void *data, xdg_surface *xdg_surface, std::uint32_t serial)
 
- Protected Attributes inherited from Crafter::WindowWayland
bool configured = false
 
wl_shm * shm = NULL
 
wl_seat * seat = NULL
 
xdg_toplevel * xdgToplevel = NULL
 
xdg_wm_base * xdgWmBase = NULL
 
zxdg_decoration_manager_v1 * manager = NULL
 
wl_surface * surface = NULL
 
wl_buffer * buffer = NULL
 
xdg_surface * xdgSurface = NULL
 
wl_display * display = NULL
 
- Static Protected Attributes inherited from Crafter::WindowWayland
static wl_compositor * compositor = NULL
 
static wl_pointer_listener pointer_listener
 
static wl_keyboard_listener keyboard_listener
 
static wl_seat_listener seat_listener
 
static wl_registry_listener registry_listener
 
static xdg_surface_listener xdg_surface_listener
 
static xdg_toplevel_listener xdg_toplevel_listener
 

Detailed Description

A Wayland window specialized for Vulkan rendering.

This class extends the WindowWayland base class to support Vulkan graphics integration within a Wayland environment. It provides methods for initializing Vulkan command buffers and managing drawing operations either synchronously or asynchronously.

The class exposes an event onDraw which is called for every frame.

Precondition
VulkanDevice::CreateDevice() must be called before creating or using this class.

Constructor & Destructor Documentation

◆ WindowWaylandVulkan()

Crafter::WindowWaylandVulkan::WindowWaylandVulkan ( std::string name,
std::uint32_t width,
std::uint32_t height )

Constructs a WindowWaylandVulkan instance.

Parameters
nameThe title of the window.
widthThe width of the window in pixels.
heightThe height of the window in pixels.

◆ ~WindowWaylandVulkan()

Crafter::WindowWaylandVulkan::~WindowWaylandVulkan ( )

Destructor for the WindowWaylandVulkan.

Cleans up Vulkan and Wayland resources associated with this window.

Member Function Documentation

◆ FinishInit()

void Crafter::WindowWaylandVulkan::FinishInit ( )

Completes Vulkan initialization.

Finalizes any remaining setup required after recording commands returned by StartInit().

◆ StartAsync()

void Crafter::WindowWaylandVulkan::StartAsync ( )

Starts the event loop asynchronously.

This method triggers rendering without blocking the caller.

◆ StartInit()

VkCommandBuffer Crafter::WindowWaylandVulkan::StartInit ( )

Starts Vulkan initialization and returns a command buffer.

This command buffer can be used to record Vulkan setup commands.

Returns
VkCommandBuffer A Vulkan command buffer for recording initialization commands.

◆ StartSync()

void Crafter::WindowWaylandVulkan::StartSync ( )

Starts the event loop synchronously.

This method blocks the caller until the event loop stops.


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