Mouse wheel and events
Posted: Mon Sep 22, 2003 9:06 am
Hi all,
For thus who want to add mouse wheel events, this is modifications to :
First)
In IEventReceiver.h, add this inside enum EMOUSE_INPUT_EVENT :
Second for Win32)
In CIrrDeviceWin32.cpp, add this in the start of the code :
and inside WndProc add this :
second for Linux)
In CIrrDeviceLinux.cpp inside bool CIrrDeviceLinux::run() add this under Case Button3: :
That's all. Beware ! i don't test this under Linux !
For thus who want to add mouse wheel events, this is modifications to :
First)
In IEventReceiver.h, add this inside enum EMOUSE_INPUT_EVENT :
Code: Select all
//! The mouse wheel is upped
EMIE_MOUSE_WHEEL_UP,
//! The mouse wheel is downed
EMIE_MOUSE_WHEEL_DOWN
In CIrrDeviceWin32.cpp, add this in the start of the code :
Code: Select all
#ifdef WIN32
#define _WIN32_WINNT 0x0500
Code: Select all
case WM_MOUSEWHEEL:
event.EventType = irr::EET_MOUSE_INPUT_EVENT;
((short int)HIWORD(wParam)/WHEEL_DELTA>0) ? event.MouseInput.Event = irr::EMIE_MOUSE_WHEEL_UP : event.MouseInput.Event = irr::EMIE_MOUSE_WHEEL_DOWN;
event.MouseInput.X = LOWORD(lParam);
event.MouseInput.Y = HIWORD(lParam);
dev = getDeviceFromHWnd(hWnd);
if (dev)
dev->postEventFromUser(event);
return 0;
In CIrrDeviceLinux.cpp inside bool CIrrDeviceLinux::run() add this under Case Button3: :
Code: Select all
// WHEEL UP
case Button4:
irrevent.MouseInput.Event = EMIE_MOUSE_WHEEL_UP;
break;
// WHEEL DOWN
case Button5:
irrevent.MouseInput.Event = EMIE_MOUSE_WHEEL_DOWN;
break;