Mouse wheel and events

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Mouse wheel and events

Post by cyberbobjr »

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 :

Code: Select all

//! The mouse wheel is upped
EMIE_MOUSE_WHEEL_UP,

//! The mouse wheel is downed
EMIE_MOUSE_WHEEL_DOWN
Second for Win32)
In CIrrDeviceWin32.cpp, add this in the start of the code :

Code: Select all

#ifdef WIN32
#define _WIN32_WINNT 0x0500
and inside WndProc add this :

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;
second for Linux)
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;
That's all. Beware ! i don't test this under Linux !
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Thanks for posting this. There'll be a very similar implementation in the next version. Okay.. now I only need to get a mouse with mouse wheel to test it out..
:D
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

for Win32 it's works, i've test it :)
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

niko wrote:Thanks for posting this. There'll be a very similar implementation in the next version. Okay.. now I only need to get a mouse with mouse wheel to test it out..
:D
YOU DONT HAVE A MOUSE WHEEL??? :shock: HOW DO YOU SURVIVE NIKO???
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

Maybe he use voice recognition? :P
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

I currently even don't have a mouse.. Just that pad which is in front of the keyboard of my Notebook.. :(
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

Niko, seems you should be extremely mobile. 8)
Post Reply