MayaFlux
1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Win32/KeyMapping.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
MayaFlux/IO/Keys.hpp
"
4
5
#ifdef MAYAFLUX_PLATFORM_WINDOWS
6
7
#include <windows.h>
8
9
namespace
MayaFlux::Core
{
10
11
/**
12
* @brief Convert a Win32 virtual key code to IO::Keys.
13
*
14
* Printable letters (VK_A–VK_Z == 0x41–0x5A) and digits
15
* (VK_0–VK_9 == 0x30–0x39) share the same numeric values as the Keys
16
* enum and are cast directly. All other keys are dispatched through a
17
* lookup table.
18
*
19
* @param vk Win32 virtual key code (WPARAM from WM_KEYDOWN/WM_KEYUP).
20
* @return Corresponding IO::Keys value, or Keys::Unknown if unmapped.
21
*/
22
MAYAFLUX_API
IO::Keys
from_win32_key(WPARAM vk)
noexcept
;
23
24
/**
25
* @brief Convert IO::Keys to the corresponding Win32 virtual key code.
26
*
27
* Returns 0 for Keys::Unknown or any key that has no Win32 equivalent.
28
*
29
* @param key IO::Keys value to convert.
30
* @return Win32 virtual key code, or 0 if unmapped.
31
*/
32
MAYAFLUX_API
int
to_win32_key(
IO::Keys
key)
noexcept
;
33
34
/**
35
* @brief Convert a Win32 scancode to IO::Keys for numpad keys whose VK codes
36
* invert with NumLock state.
37
*
38
* Only handles scancodes 0x47–0x53 without the extended-key bit. Returns
39
* Keys::Unknown for all other inputs; caller falls back to from_win32_key().
40
*
41
* @param scancode Raw scancode from HIWORD(lParam) & 0x1FF (bit 8 = extended).
42
* @return Corresponding IO::Keys value, or Keys::Unknown if not handled.
43
*/
44
MAYAFLUX_API
IO::Keys
from_win32_scancode(uint32_t scancode)
noexcept
;
45
46
/**
47
* @brief Check whether a Win32 virtual key code maps to a known IO::Keys value.
48
*
49
* @param vk Win32 virtual key code.
50
* @return True if the key is recognised, false otherwise.
51
*/
52
MAYAFLUX_API
bool
is_valid_win32_key(WPARAM vk)
noexcept
;
53
54
}
// namespace MayaFlux::Core
55
56
#endif
// MAYAFLUX_PLATFORM_WINDOWS
Keys.hpp
MayaFlux::Core
Definition
Chronie.hpp:8
MayaFlux::IO::Keys
Keys
Definition
Keys.hpp:5
src
MayaFlux
Core
Backends
Windowing
Win32
KeyMapping.hpp
Generated by
1.9.8