GLFW中的鼠标滑动事件

这篇博客介绍了如何在GLFW中设置鼠标滑动回调函数,以接收鼠标或触摸板滑动事件。值得注意的是,鼠标仅能检测到y方向的滑动,xoffset始终为0。实际应用中,滚轮每滚动一次,会产生一次yoffset=1.0的滑动事件。
摘要由CSDN通过智能技术生成

GLFW中的鼠标滑动事件

以下是glfw3.h中关于设置鼠标滑动回调函数的方法:

/*! @brief Sets the scroll callback.
 *
 *  This function sets the scroll callback of the specified window, which is
 *  called when a scrolling device is used, such as a mouse wheel or scrolling
 *  area of a touchpad.
 *
 *  The scroll callback receives all scrolling input, like that from a mouse
 *  wheel or a touchpad scrolling area.
 *
 *  @param[in] window The window whose callback to set.
 *  @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
 *  set callback.
 *  @return The previously set callback, or `NULL` if no callback was set or an
 *  error occurred.
 *
 *  @ingroup input
 */
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);

/*! @brief The function signature for scroll callbacks.
 *
 *  This is the function signature for scroll c
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值