Crafter.Graphics
C++ graphics library using Wayland and Vulkan.
 
Loading...
Searching...
No Matches
Crafter.Graphics Module Reference

Classes

class  Crafter::VulkanShader< path, entrypoint, stage, DescriptorCount, Descriptors >
 Represents a Vulkan shader module with specified configuration. More...
 
class  Crafter::TextureShader< PixelType >
 Creates a sampler for a provided VulkanTexture<PixelType>. More...
 
class  Crafter::DescriptorSet< MeshShader, FragmentShader >
 Holder for VkDescriptorSet. More...
 
class  Crafter::VulkanPipeline< MeshShader, FragmentShader >
 A generic Vulkan graphics pipeline wrapper using template-based shaders. More...
 
class  Crafter::WindowWayland
 A window using the Wayland display server protocol. More...
 
class  Crafter::VulkanTexture< PixelType >
 Represents a Vulkan texture with pixel data of a specified type. More...
 
class  Crafter::Buffer< T >
 VkBuffer holder. Stores a value and handles buffer mapping and lifetime management. More...
 
class  Crafter::Window
 Represents a GUI window handling input events, mouse states, keyboard states, and UI elements. More...
 
class  Crafter::WindowWaylandWayland
 A specialized Wayland window implementation for direct drawing. More...
 
class  Crafter::Camera
 Camera with projection and view matrices. More...
 
class  Crafter::WindowWaylandVulkan
 A Wayland window specialized for Vulkan rendering. More...
 
class  Crafter::UiElement
 General use UiElement for handeling input events. Add to a window's elements member to start recieving events. More...
 
class  Crafter::Mesh< VertexType >
 Holder for a indexed mesh. More...
 
class  Crafter::MeshShader< VertexType >
 Shader for rendering indexed meshes. More...
 

Functions

static void CreateDevice ()
 Creates the vulkan device, this must be called before any use of vulkan.
 
static void CHECK_VK_RESULT (VkResult result)
 Checks if result is VK_SUCCESS.
 
static std::uint32_t GetMemoryType (std::uint32_t typeBits, VkMemoryPropertyFlags properties)
 Finds a suitable memory type index for the device based on required properties.
 
 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.
 
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)
 
 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.
 
 WindowWaylandWayland (std::string name, std::uint32_t width, std::uint32_t height)
 Constructs a new WindowWaylandWayland object.
 
 ~WindowWaylandWayland ()
 Destructor cleans up Wayland-specific window resources and framebuffer.
 
void StartAsync ()
 Starts the event loop asynchronously.
 
void StartSync ()
 Starts the event loop synchronously.
 
struct Crafter::__attribute__ ((packed)) Pixel_BU8_GU8_RU8_AU8
 

Variables

static VkInstance instance = VK_NULL_HANDLE
 
static VkDebugUtilsMessengerEXT debugMessenger = VK_NULL_HANDLE
 
static VkPhysicalDevice physDevice = VK_NULL_HANDLE
 
static VkDevice device = VK_NULL_HANDLE
 
static std::uint32_t queueFamilyIndex = 0
 
static VkQueue queue = VK_NULL_HANDLE
 
static VkCommandPool commandPool = VK_NULL_HANDLE
 
static VkSwapchainKHR swapchain = VK_NULL_HANDLE
 
static PFN_vkCmdDrawMeshTasksEXT vkCmdDrawMeshTasksEXTProc
 
static PFN_vkCmdBeginRenderingKHR vkCmdBeginRenderingKHRProc
 
static PFN_vkCmdEndRenderingKHR vkCmdEndRenderingKHRProc
 
static VkPhysicalDeviceMemoryProperties memoryProperties
 
static VkFormat depthFormat = VK_FORMAT_UNDEFINED
 
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 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
 
int32_t x
 
int32_t y
 
int32_t width
 
int32_t height
 
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
 
Pixel_BU8_GU8_RU8_AU8 * framebuffer = NULL
 Framebuffer for the window using the BGRA 8-bit unsigned pixel format, use this for direct drawing to the window.
 

Files

file  src/module/Crafter.Graphics.cppm
 
file  src/module/Crafter.Graphics-Camera.cppm
 
file  src/module/Crafter.Graphics-DescriptorSet.cppm
 
file  src/module/Crafter.Graphics-HeightmapShader.cppm
 
file  src/module/Crafter.Graphics-Mesh.cppm
 
file  src/module/Crafter.Graphics-MeshShader.cppm
 
file  src/module/Crafter.Graphics-TextureShader.cppm
 
file  src/module/Crafter.Graphics-Types.cppm
 
file  src/module/Crafter.Graphics-UiElement.cppm
 
file  src/module/Crafter.Graphics-VoxelShader.cppm
 
file  src/module/Crafter.Graphics-VulkanBuffer.cppm
 
file  src/module/Crafter.Graphics-VulkanDevice.cppm
 
file  src/module/Crafter.Graphics-VulkanPipeline.cppm
 
file  src/module/Crafter.Graphics-VulkanShader.cppm
 
file  src/module/Crafter.Graphics-VulkanTexture.cppm
 
file  src/module/Crafter.Graphics-Window.cppm
 
file  src/module/Crafter.Graphics-WindowWayland.cppm
 
file  src/module/Crafter.Graphics-WindowWaylandVulkan.cppm
 
file  src/module/Crafter.Graphics-WindowWaylandWayland.cppm