Mouse Button 4 & 5
by Deception Games · in Torque Game Engine Advanced · 09/29/2007 (11:33 pm) · 0 replies
After reading through a bunch of threads and wish lists of many but not finding anything that I could just hack in I went and did a bit of discovery. I'm not sure what I have unleashed but it works so far and any comments or thoughts in the area of learning would be appreciated.
To enable mouse buttons 4 & 5 (which I haven't tested 5, I will have to dig out a mouse with another button on it) I did these quick hacks:
In engine/platformWin32/platformWin32.h, change _WIN32_WINNT to 0x0500 as noted below:
In engine/platformWin32/winWindow.cpp, add the following so it appears like this:
Like I said, it works. I can now assign a mouse4 to keys (mouse5 remains untested). I have no idea what I have unleashed by updating to NT 0x0500. And this all sounds remarkably to simple, I must have missed something.
Working with the Windows stuff is far outside my scope of understanding. I'd prefer a cross platform fix but since TGEA doesn't work with anything but Windows I can't do much about that (yet). I'm just concerned that I have opened up a huge can of worms by jumping up NT versions or that I have left myself open to some hole that I'll only find months later on accident and be stuck in a nightmare of debugging.
To enable mouse buttons 4 & 5 (which I haven't tested 5, I will have to dig out a mouse with another button on it) I did these quick hacks:
In engine/platformWin32/platformWin32.h, change _WIN32_WINNT to 0x0500 as noted below:
// define this so that we can use WM_MOUSEWHEEL messages...
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endifIn engine/platformWin32/winWindow.cpp, add the following so it appears like this:
Game->postEvent(event);
}
break;
case WM_LBUTTONDOWN:
mouseButtonEvent(SI_MAKE, KEY_BUTTON0);
break;
case WM_MBUTTONDOWN:
mouseButtonEvent(SI_MAKE, KEY_BUTTON2);
break;
case WM_RBUTTONDOWN:
mouseButtonEvent(SI_MAKE, KEY_BUTTON1);
break;
case WM_XBUTTONDOWN:
if (GetAsyncKeyState(VK_XBUTTON1))
mouseButtonEvent(SI_MAKE, KEY_BUTTON3);
else
mouseButtonEvent(SI_MAKE, KEY_BUTTON4);
// mouseButtonEvent(SI_MAKE, KEY_BUTTON3);
break;
case WM_LBUTTONUP:
mouseButtonEvent(SI_BREAK, KEY_BUTTON0);
break;
case WM_MBUTTONUP:
mouseButtonEvent(SI_BREAK, KEY_BUTTON2);
break;
case WM_RBUTTONUP:
mouseButtonEvent(SI_BREAK, KEY_BUTTON1);
break;
case WM_XBUTTONUP:
if (GetAsyncKeyState(VK_XBUTTON1))
mouseButtonEvent(SI_BREAK, KEY_BUTTON3);
else
mouseButtonEvent(SI_BREAK, KEY_BUTTON4);
// mouseButtonEvent(SI_BREAK, KEY_BUTTON3);
break;
case WM_MOUSEWHEEL:
mouseWheelEvent( (S16) HIWORD( wParam ) );
break;
}
}Like I said, it works. I can now assign a mouse4 to keys (mouse5 remains untested). I have no idea what I have unleashed by updating to NT 0x0500. And this all sounds remarkably to simple, I must have missed something.
Working with the Windows stuff is far outside my scope of understanding. I'd prefer a cross platform fix but since TGEA doesn't work with anything but Windows I can't do much about that (yet). I'm just concerned that I have opened up a huge can of worms by jumping up NT versions or that I have left myself open to some hole that I'll only find months later on accident and be stuck in a nightmare of debugging.