5 Button Mouse
BlitzMax Forums/BlitzMax Programming/5 Button Mouse
| ||
Any idea how (in a game) we can go about detecting mouse button 4 and 5? These things are far more common now then they ever been. |
| ||
I've not looked deep into it, but you could try change the array sizes in brl.polledinput. Just a try. |
| ||
After having a little fiddle in polledinput I can see that mouse button 4 and 5 dont even drop into the hook used for the mouse buttons. After some further searching on the internet, looks like these are known as XBUTTON1 & XBUTTON2 (at least in .Net). |
| ||
Aha found this post, looks like its what I need! http://www.blitzbasic.com/Community/posts.php?topic=68074#760692 |
| ||
Yep thats it, dead simple to implement as well... Full credit to grabel - awesome work bud! In system.mod/system.win32.c Add... /*--- 5 button mouse ---*/ #define WM_XBUTTONDOWN 0x020B #define WM_XBUTTONUP 0x020C /*--- 5 button mouse ---*/ just after the includes at the top of the file And add... /*--- 5 button mouse ---*/ case WM_XBUTTONDOWN: ReleaseCapture(); id=BBEVENT_MOUSEDOWN; data=3 + (short)HIWORD(wp); x=(short)LOWORD(lp); y=(short)HIWORD(lp); break; case WM_XBUTTONUP: ReleaseCapture(); id=BBEVENT_MOUSEUP; data=3 + (short)HIWORD(wp); x=(short)LOWORD(lp); y=(short)HIWORD(lp); break; /*--- 5 button mouse ---*/ To the bbSystemEmitOSEvent function located at around line 126 I added it after the WM_MOUSEWHEEL and before WM_CLOSE case statements. Recompile your mods and you are golden. MouseDown(4) and MouseDown(5) can then be used to read these buttons! Last edited 2012 |
| ||
Sounds like something that could/should be updated in the 'official' version? |