maybe some other peeps want this feature too. whatever this workaround supports only win32 input at the moment. to support linux, the CIrrDeviceLinux.cpp would need to be changed too. as i am not developing with a linux system right now i did not change it.
the following files must be edited:
IEventReciever.h
CIrrDeviceWin32.cpp
changes in IEventReciever.h:
find the enum EMOUSE_INPUT_EVENT and change it to the following:
Code: Select all
//! Enumeration for all mouse input events
enum EMOUSE_INPUT_EVENT
{
//! Left mouse button was pressed down.
EMIE_LMOUSE_PRESSED_DOWN = 0,
//! Right mouse button was pressed down.
EMIE_RMOUSE_PRESSED_DOWN,
//! Middle mouse button was pressed down.
EMIE_MMOUSE_PRESSED_DOWN,
//! Left mouse button was left up.
EMIE_LMOUSE_LEFT_UP,
//! Right mouse button was left up.
EMIE_RMOUSE_LEFT_UP,
//! Middle mouse button was left up.
EMIE_MMOUSE_LEFT_UP,
//! The mouse cursor changed its position.
EMIE_MOUSE_MOVED,
//! The mouse wheel was moved. Use Wheel value in event data to find out
//! in what direction and how fast.
EMIE_MOUSE_WHEEL,
//! X1 mouse button was pressed down.
EMIE_X1MOUSE_PRESSED_DOWN,
//! X2 mouse button was pressed down.
EMIE_X2MOUSE_PRESSED_DOWN,
//! X1 mouse button was left up.
EMIE_X1MOUSE_LEFT_UP,
//! X2 mouse button was left up.
EMIE_X2MOUSE_LEFT_UP,
//! No real event. Just for convenience to get number of events
EMIE_COUNT
};
1. find the method LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) and change the defines in the first lines of the method from:
Code: Select all
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif
#ifndef WHEEL_DELTA
#define WHEEL_DELTA 120
#endif
Code: Select all
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif
#ifndef WHEEL_DELTA
#define WHEEL_DELTA 120
#endif
#ifndef WM_XBUTTONDOWN
#define WM_XBUTTONDOWN 0x020B
#endif
#ifndef WM_XBUTTONUP
#define WM_XBUTTONUP 0x020C
#endif
#ifndef XBUTTON1
#define XBUTTON1 1
#endif
#ifndef XBUTTON2
#define XBUTTON2 2
#endif
Code: Select all
// X1 und X2 buttons
case WM_XBUTTONDOWN:
if(HIWORD(wParam)==XBUTTON1)
{
ClickCount++;
SetCapture(hWnd);
event.EventType = irr::EET_MOUSE_INPUT_EVENT;
event.MouseInput.Event = irr::EMIE_X1MOUSE_PRESSED_DOWN;
event.MouseInput.X = (short)LOWORD(lParam);
event.MouseInput.Y = (short)HIWORD(lParam);
dev = getDeviceFromHWnd(hWnd);
if (dev)
dev->postEventFromUser(event);
return 0;
}
else if(HIWORD(wParam)==XBUTTON2)
{
ClickCount++;
SetCapture(hWnd);
event.EventType = irr::EET_MOUSE_INPUT_EVENT;
event.MouseInput.Event = irr::EMIE_X2MOUSE_PRESSED_DOWN;
event.MouseInput.X = (short)LOWORD(lParam);
event.MouseInput.Y = (short)HIWORD(lParam);
dev = getDeviceFromHWnd(hWnd);
if (dev)
dev->postEventFromUser(event);
return 0;
}
return 0;
case WM_XBUTTONUP:
if(HIWORD(wParam)==XBUTTON1)
{
ClickCount--;
if (ClickCount<1)
{
ClickCount=0;
ReleaseCapture();
}
event.EventType = irr::EET_MOUSE_INPUT_EVENT;
event.MouseInput.Event = irr::EMIE_X1MOUSE_LEFT_UP;
event.MouseInput.X = (short)LOWORD(lParam);
event.MouseInput.Y = (short)HIWORD(lParam);
dev = getDeviceFromHWnd(hWnd);
if (dev)
dev->postEventFromUser(event);
return 0;
}
else if(HIWORD(wParam)==XBUTTON2)
{
ClickCount--;
if (ClickCount<1)
{
ClickCount=0;
ReleaseCapture();
}
event.EventType = irr::EET_MOUSE_INPUT_EVENT;
event.MouseInput.Event = irr::EMIE_X2MOUSE_LEFT_UP;
event.MouseInput.X = (short)LOWORD(lParam);
event.MouseInput.Y = (short)HIWORD(lParam);
dev = getDeviceFromHWnd(hWnd);
if (dev)
dev->postEventFromUser(event);
return 0;
}
return 0;
// X1 und X2 buttons
if somebody found out how to get this support with linux please post it here.
regards mosics
PS: i read somewhere about different keycodes with older win32 versions. this workaround works with winxp professional sp2. if this workaround works with older win32 versions too, pleae post it here, thx
