mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Add guide documentation & fixes
This commit is contained in:
parent
841cf79c5f
commit
6e19d07de8
@ -132,7 +132,7 @@ information on what to include when reporting a bug.
|
|||||||
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
|
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
|
||||||
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to
|
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to
|
||||||
`GLFW_NATIVE_CONTEXT_API` (#2518)
|
`GLFW_NATIVE_CONTEXT_API` (#2518)
|
||||||
- [Cocoa] Added `glfwSetTrackpadZoomCallback` and `glfwSetTrackpadRotateCallback`
|
- [Cocoa & Wayland] Added `glfwSetTrackpadZoomCallback` and `glfwSetTrackpadRotateCallback`
|
||||||
for trackpad zoom and rotate events (#90)
|
for trackpad zoom and rotate events (#90)
|
||||||
|
|
||||||
|
|
||||||
|
@ -581,6 +581,42 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
|||||||
|
|
||||||
A normal mouse wheel, being vertical, provides offsets along the Y-axis.
|
A normal mouse wheel, being vertical, provides offsets along the Y-axis.
|
||||||
|
|
||||||
|
### Trackpad zoom and rotate {#input_mouse_trackpad_gestures}
|
||||||
|
|
||||||
|
Trackpad events are currently only available on macOS and Wayland (Linux).
|
||||||
|
|
||||||
|
If you wish to be notified when a zoom gesture is performed on a trackpad,
|
||||||
|
set the trackpadZoom callback.
|
||||||
|
|
||||||
|
```c
|
||||||
|
glfwSetTrackpadZoomCallback(window, trackpad_zoom_callback);
|
||||||
|
```
|
||||||
|
|
||||||
|
The callback function receives the scale of the zoom, which is a ratio that
|
||||||
|
should be multiplied by the current zoom level to get the new zoom level.
|
||||||
|
|
||||||
|
```c
|
||||||
|
static void trackpad_zoom_callback(GLFWwindow* window, double scale)
|
||||||
|
{
|
||||||
|
my_app->zoom_level *= scale;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For trackpad rotate gestures, set the trackpadRotateCallback.
|
||||||
|
|
||||||
|
```c
|
||||||
|
glfwSetTrackpadRotateCallback(window, trackpad_rotate_callback);
|
||||||
|
```
|
||||||
|
|
||||||
|
The callback function recieves the angle, in degrees, to rotate by.
|
||||||
|
|
||||||
|
```c
|
||||||
|
static void trackpad_rotate_callback(GLFWwindow* window, double angle)
|
||||||
|
{
|
||||||
|
my_app->rotation_angle_degrees += angle;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Joystick input {#joystick}
|
## Joystick input {#joystick}
|
||||||
|
|
||||||
|
@ -1880,7 +1880,8 @@ typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffse
|
|||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
* @param[in] scale The manigification amount, as a scale factor
|
* @param[in] scale The manigification amount, to be multiplied by the current
|
||||||
|
* scale factor to get the new scale factor.
|
||||||
*
|
*
|
||||||
* @sa @ref glfwSetTrackpadZoomCallback
|
* @sa @ref glfwSetTrackpadZoomCallback
|
||||||
*
|
*
|
||||||
|
@ -1069,7 +1069,7 @@ GLFWAPI GLFWtrackpadzoomfun glfwSetTrackpadZoomCallback(GLFWwindow* handle,
|
|||||||
return cbfun;
|
return cbfun;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWtrackpadzoomfun glfwSetTrackpadRotateCallback(GLFWwindow* handle,
|
GLFWAPI GLFWtrackpadrotatefun glfwSetTrackpadRotateCallback(GLFWwindow* handle,
|
||||||
GLFWtrackpadrotatefun cbfun)
|
GLFWtrackpadrotatefun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
Loading…
Reference in New Issue
Block a user