new input system
This commit is contained in:
parent
b3db40ebec
commit
ac2eb7fb0a
31 changed files with 3292 additions and 781 deletions
|
|
@ -30,7 +30,7 @@ module;
|
|||
#endif
|
||||
export module Crafter.Graphics:Device;
|
||||
import std;
|
||||
import :Types; // CrafterKeys for keyboard repeat state
|
||||
import :Keys; // KeyCode for keyboard repeat state
|
||||
|
||||
export namespace Crafter {
|
||||
struct Window;
|
||||
|
|
@ -43,7 +43,7 @@ export namespace Crafter {
|
|||
int rate = 25; // chars/sec
|
||||
int delay = 500; // ms before first repeat
|
||||
bool active = false;
|
||||
CrafterKeys key{};
|
||||
KeyCode key = 0;
|
||||
std::string utf8; // UTF-8 to re-emit as onTextInput, if any
|
||||
std::chrono::time_point<std::chrono::steady_clock> pressTime;
|
||||
std::chrono::time_point<std::chrono::steady_clock> lastFireTime;
|
||||
|
|
@ -68,6 +68,13 @@ export namespace Crafter {
|
|||
inline static xkb_state* xkb_state;
|
||||
inline static std::vector<Window*> windows;
|
||||
inline static wl_pointer* wlPointer;
|
||||
// wl_data_device_manager + wl_data_device drive copy/paste. Bound
|
||||
// lazily in handle_global; the data device is created once both
|
||||
// the manager and the seat are present (registry binding order
|
||||
// isn't guaranteed). nullptr on compositors that don't expose
|
||||
// the manager — Clipboard::SetText silently no-ops there.
|
||||
inline static wl_data_device_manager* dataDeviceManager = nullptr;
|
||||
inline static wl_data_device* dataDevice = nullptr;
|
||||
|
||||
static void seat_handle_capabilities(void* data, wl_seat* seat, uint32_t capabilities);
|
||||
static void xdg_surface_handle_preferred_scale(void* data, wp_fractional_scale_v1*, std::uint32_t scale);
|
||||
|
|
@ -137,6 +144,12 @@ export namespace Crafter {
|
|||
inline static PFN_vkGetPhysicalDeviceDescriptorSizeEXT vkGetPhysicalDeviceDescriptorSizeEXT;
|
||||
inline static PFN_vkGetDeviceFaultInfoEXT vkGetDeviceFaultInfoEXT;
|
||||
|
||||
// VK_EXT_memory_decompression — opt-in. When the driver advertises it
|
||||
// and exposes the GDeflate 1.0 method, GPU asset decompression is
|
||||
// available; otherwise consumers fall back to CPU decode.
|
||||
inline static bool memoryDecompressionSupported = false;
|
||||
inline static PFN_vkCmdDecompressMemoryEXT vkCmdDecompressMemoryEXT = nullptr;
|
||||
|
||||
inline static VkPhysicalDeviceMemoryProperties memoryProperties;
|
||||
|
||||
inline static VkPhysicalDeviceDescriptorHeapPropertiesEXT descriptorHeapProperties = {
|
||||
|
|
@ -146,16 +159,19 @@ export namespace Crafter {
|
|||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR,
|
||||
.pNext = &descriptorHeapProperties
|
||||
};
|
||||
inline static VkPhysicalDeviceMemoryDecompressionPropertiesEXT memoryDecompressionProperties = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_EXT
|
||||
};
|
||||
|
||||
static void CheckVkResult(VkResult result);
|
||||
static std::uint32_t GetMemoryType(std::uint32_t typeBits, VkMemoryPropertyFlags properties);
|
||||
|
||||
// ─── Wayland key repeat ────────────────────────────────────────
|
||||
// TickKeyRepeats walks the held-key state and fires onKeyDown /
|
||||
// onTextInput accordingly. Called once per frame from
|
||||
// Window::Render. KeyRepeatState lives at namespace scope so its
|
||||
// member initializers don't trip C++'s "complete-type-needed"
|
||||
// rule for the inline static below.
|
||||
// TickKeyRepeats fires onRawKeyDown / onRawKeyHold / onTextInput on
|
||||
// the focused window for whichever key is currently repeating.
|
||||
// Called once per frame from Window::Render. KeyRepeatState lives
|
||||
// at namespace scope so its member initializers don't trip C++'s
|
||||
// "complete-type-needed" rule for the inline static below.
|
||||
#ifdef CRAFTER_GRAPHICS_WINDOW_WAYLAND
|
||||
inline static KeyRepeatState keyRepeat;
|
||||
static void TickKeyRepeats();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue