我只看到从 GET_WHEEL_DELTA_WPARAM 返回的正数,即使当我向我滚动鼠标滚轮时它应该是负数。
case WM_MOUSEWHEEL:
short wheel_delta = 0;
wheel_delta = GET_WHEEL_DELTA_WPARAM(Addtl_Info_L);
此外,此处的此页面表示向前滚动车轮给出一个正数,向后滚动一个负数,而此页面表示它是左右而不是向前和向后。
这是完整的消息处理程序:
LRESULT CALLBACK Message_Handler(HWND App_Handle, UINT Message_Type, WPARAM Addtl_Info_W, LPARAM Addtl_Info_L) {
short wheel_delta(0);
switch(Message_Type) {
case WM_MOUSEWHEEL:
wheel_delta = GET_WHEEL_DELTA_WPARAM(Addtl_Info_L);
if (wheel_delta > 0) {
std::wostringstream outs;
outs << "Wheel delta is positive" << std::endl;
OutputDebugString(outs.str().c_str());
graphics_manager.camera_tilt = graphics_manager.camera_tilt + 0.1f;
} else if (wheel_delta < 0) {
std::wostringstream outs;
outs << "Wheel delta is negative" << std::endl;
OutputDebugString(outs.str().c_str());
graphics_manager.camera_tilt = graphics_manager.camera_tilt - 0.1f;
}
return 0;
}
return DefWindowProc(App_Handle, Message_Type, Addtl_Info_W, Addtl_Info_L);
}