rendering element rewrite

This commit is contained in:
Jorijn van der Graaf 2025-12-28 00:05:03 +01:00
commit 3d40256bde
22 changed files with 799 additions and 795 deletions

View file

@ -139,10 +139,20 @@ namespace Crafter {
return pixel * (SCALE / width);
}
export constexpr std::int_fast32_t RelativeToAbsolute(std::int_fast32_t relative, std::int_fast32_t full) {
return static_cast<std::int_fast32_t>(
(static_cast<__int128>(relative) * full) / SCALE
);
}
export constexpr std::int_fast32_t BoundToBoundless(std::int_fast32_t bound) {
return bound * BOUND;
}
export constexpr std::int_fast32_t BoundlessToBound(std::int_fast32_t bound) {
return bound / BOUND;
}
export constexpr std::int_fast32_t FractionalToMappedBoundless(double f) {
return std::int_fast32_t(f * SCALEDOUBLEBOUNDLESS);
}
@ -162,4 +172,47 @@ namespace Crafter {
export constexpr std::int_fast32_t PixelToMappedBoundless(std::int_fast32_t pixel, std::int_fast32_t width) {
return pixel * (SCALEBOUNDLESS / width);
}
export enum class CrafterKeys {
// Alphabetic keys
A, B, C, D, E, F, G, H, I, J, K, L, M,
N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
// Numeric keys
_0, _1, _2, _3, _4, _5, _6, _7, _8, _9,
// Function keys
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
// Control keys
Escape, Tab, Enter, Space, Backspace, Delete, Insert,
Home, End, PageUp, PageDown, CapsLock, NumLock, ScrollLock,
// Modifier keys
LeftShift, RightShift, LeftCtrl, RightCtrl,
LeftAlt, RightAlt, LeftSuper, RightSuper,
// Arrow keys
Up, Down, Left, Right,
// Keypad keys
keypad_0, keypad_1, keypad_2, keypad_3, keypad_4,
keypad_5, keypad_6, keypad_7, keypad_8, keypad_9,
keypad_enter, keypad_plus, keypad_minus, keypad_multiply,
keypad_divide, keypad_decimal,
// Punctuation and special keys
grave, minus, equal, bracket_left, bracket_right,
backslash, semicolon, quote, comma, period, slash,
print_screen, pause, menu,
// Additional keys
volume_up, volume_down, volume_mute,
media_play, media_stop, media_prev, media_next,
browser_back, browser_forward, browser_refresh,
browser_stop, browser_search, browser_home,
launch_mail, launch_calculator, launch_media_player,
CrafterKeysMax
};
}