new input system

This commit is contained in:
Jorijn van der Graaf 2026-05-12 00:24:48 +02:00
commit ac2eb7fb0a
31 changed files with 3292 additions and 781 deletions

View file

@ -20,6 +20,7 @@ module;
export module Crafter.Graphics:InputField;
import std;
import :Types;
import :Keys;
import :Font;
import :UI;
import :UIComponents;
@ -81,8 +82,12 @@ export namespace Crafter {
void InputField_OnText(InputField&, std::string_view utf8);
// Edit-control keys: Backspace, Delete, Left, Right, Home, End. Anything
// else is ignored. Safe to feed every key the host receives.
void InputField_OnKey(InputField&, CrafterKeys);
// else is ignored. Safe to feed every key the host receives. The KeyCode
// is the raw platform key (Win32 PS/2 scancode + extended bit; Wayland
// kernel keycode) — typically the value delivered by
// `Window::onRawKeyDown`. Internal comparisons use `Key(CrafterKeys::X)`
// from :Keys so the code stays cross-platform.
void InputField_OnKey(InputField&, KeyCode);
// Map a click x-coord (in window pixels) to a cursor position. `rect` is
// the field's current draw rect; `colors.paddingX` is consulted for the