mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +00:00
Merge 08b8af94a7
into 999f3556fd
This commit is contained in:
commit
6c338a6ba6
@ -102,6 +102,8 @@ information on what to include when reporting a bug.
|
|||||||
- Added on-demand loading of Vulkan and context creation API libraries
|
- Added on-demand loading of Vulkan and context creation API libraries
|
||||||
- Added `_GLFW_VULKAN_STATIC` build macro to make the library use the Vulkan
|
- Added `_GLFW_VULKAN_STATIC` build macro to make the library use the Vulkan
|
||||||
loader linked statically into the application (#820)
|
loader linked statically into the application (#820)
|
||||||
|
- Added `glfwGetKeyScancode` function that allows retrieving platform depen-
|
||||||
|
dent scancodes for keys
|
||||||
- Bugfix: Single compilation unit builds failed due to naming conflicts (#783)
|
- Bugfix: Single compilation unit builds failed due to naming conflicts (#783)
|
||||||
- Bugfix: The range checks for `glfwSetCursorPos` used the wrong minimum (#773)
|
- Bugfix: The range checks for `glfwSetCursorPos` used the wrong minimum (#773)
|
||||||
- Bugfix: Defining `GLFW_INCLUDE_VULKAN` when compiling the library did not
|
- Bugfix: Defining `GLFW_INCLUDE_VULKAN` when compiling the library did not
|
||||||
@ -269,6 +271,7 @@ skills.
|
|||||||
- Santi Zupancic
|
- Santi Zupancic
|
||||||
- Jonas Ådahl
|
- Jonas Ådahl
|
||||||
- Lasse Öörni
|
- Lasse Öörni
|
||||||
|
- Michael Stocker
|
||||||
- All the unmentioned and anonymous contributors in the GLFW community, for bug
|
- All the unmentioned and anonymous contributors in the GLFW community, for bug
|
||||||
reports, patches, feedback, testing and encouragement
|
reports, patches, feedback, testing and encouragement
|
||||||
|
|
||||||
|
@ -223,6 +223,20 @@ ignored. This matches the behavior of the key callback, meaning the callback
|
|||||||
arguments can always be passed unmodified to this function.
|
arguments can always be passed unmodified to this function.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection input_key_scancode Key scancodes
|
||||||
|
|
||||||
|
If you need the platform dependent scancode for any given key, you can query
|
||||||
|
it with @ref glfwGetKeyScancode.
|
||||||
|
|
||||||
|
@code
|
||||||
|
const short int scancode = glfwGetKeyScancode(GLFW_KEY_X);
|
||||||
|
set_key_mapping(scancode, swap_weapons);
|
||||||
|
@encode
|
||||||
|
|
||||||
|
If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
|
||||||
|
method will return `-1`.
|
||||||
|
|
||||||
|
|
||||||
@section input_mouse Mouse input
|
@section input_mouse Mouse input
|
||||||
|
|
||||||
Mouse input comes in many forms, including cursor motion, button presses and
|
Mouse input comes in many forms, including cursor motion, button presses and
|
||||||
|
@ -2,6 +2,15 @@
|
|||||||
|
|
||||||
@page news New features
|
@page news New features
|
||||||
|
|
||||||
|
@section new_33 New features in 3.3
|
||||||
|
|
||||||
|
|
||||||
|
@subsection new_33_keyscancode Platform dependent scancodes
|
||||||
|
|
||||||
|
GLFW now supports querying the platform dependent scancode of any key with
|
||||||
|
@ref glfwGetKeyScancode.
|
||||||
|
|
||||||
|
|
||||||
@section news_32 New features in 3.2
|
@section news_32 New features in 3.2
|
||||||
|
|
||||||
|
|
||||||
|
@ -3003,6 +3003,30 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI const char* glfwGetKeyName(int key, int scancode);
|
GLFWAPI const char* glfwGetKeyName(int key, int scancode);
|
||||||
|
|
||||||
|
/*! @brief Returns the platform dependent scancode of the specified key.
|
||||||
|
*
|
||||||
|
* This function returns the platform dependent scancode of the specified key.
|
||||||
|
* This is intended for platform specific default keybindings.
|
||||||
|
*
|
||||||
|
* If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
|
||||||
|
* method will return `-1`.
|
||||||
|
*
|
||||||
|
* @param[in] key The key to query.
|
||||||
|
* @return The platform dependent scancode for the key, or `-1`.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_ERROR.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread.
|
||||||
|
*
|
||||||
|
* @sa @ref input_key_scancode
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
GLFWAPI const short int glfwGetKeyScancode(int key);
|
||||||
|
|
||||||
/*! @brief Returns the last reported state of a keyboard key for the specified
|
/*! @brief Returns the last reported state of a keyboard key for the specified
|
||||||
* window.
|
* window.
|
||||||
*
|
*
|
||||||
|
@ -1511,6 +1511,16 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
return _glfw.ns.keyName;
|
return _glfw.ns.keyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const short int _glfwPlatformGetKeyScancode(int key)
|
||||||
|
{
|
||||||
|
if(key <= -1 || key >= (sizeof(_glfw.ns.nativeKeys) / sizeof(_glfw.ns.nativeKeys[0])))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _glfw.ns.nativeKeys[key];
|
||||||
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
const GLFWimage* image,
|
const GLFWimage* image,
|
||||||
int xhot, int yhot)
|
int xhot, int yhot)
|
||||||
|
@ -256,6 +256,12 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
|
|||||||
return _glfwPlatformGetKeyName(key, scancode);
|
return _glfwPlatformGetKeyName(key, scancode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI const short int glfwGetKeyScancode(int key)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(-1);
|
||||||
|
return _glfwPlatformGetKeyScancode(key);
|
||||||
|
}
|
||||||
|
|
||||||
GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
|
GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
@ -543,6 +543,11 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode);
|
|||||||
*/
|
*/
|
||||||
const char* _glfwPlatformGetKeyName(int key, int scancode);
|
const char* _glfwPlatformGetKeyName(int key, int scancode);
|
||||||
|
|
||||||
|
/*! @copydoc glfwGetKeyScancode
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
const short int _glfwPlatformGetKeyScancode(int key);
|
||||||
|
|
||||||
/*! @copydoc glfwGetMonitors
|
/*! @copydoc glfwGetMonitors
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
|
@ -744,6 +744,13 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int _glfwPlatformGetKeyScancode(int key)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
@ -1511,6 +1511,16 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
return _glfw.win32.keyName;
|
return _glfw.win32.keyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const short int _glfwPlatformGetKeyScancode(int key)
|
||||||
|
{
|
||||||
|
if(key <= -1 || key >= (sizeof(_glfw.win32.nativeKeys) / sizeof(_glfw.win32.nativeKeys[0])))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _glfw.win32.nativeKeys[key];
|
||||||
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
const GLFWimage* image,
|
const GLFWimage* image,
|
||||||
int xhot, int yhot)
|
int xhot, int yhot)
|
||||||
|
@ -686,6 +686,12 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int _glfwPlatformGetKeyScancode(int key)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
const GLFWimage* image,
|
const GLFWimage* image,
|
||||||
int xhot, int yhot)
|
int xhot, int yhot)
|
||||||
|
@ -2183,6 +2183,16 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
|||||||
return _glfw.x11.keyName;
|
return _glfw.x11.keyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const short int _glfwPlatformGetKeyScancode(int key)
|
||||||
|
{
|
||||||
|
if(key <= -1 || key >= (sizeof(_glfw.x11.nativeKeys) / sizeof(_glfw.x11.nativeKeys[0])))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _glfw.x11.nativeKeys[key];
|
||||||
|
}
|
||||||
|
|
||||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||||
const GLFWimage* image,
|
const GLFWimage* image,
|
||||||
int xhot, int yhot)
|
int xhot, int yhot)
|
||||||
|
Loading…
Reference in New Issue
Block a user