Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////
- // //
- // MouseHeld is a library designed //
- // to allow tracking of what mouse //
- // buttons are being held down //
- // //
- //////////////////////////////////////
- // mouse button macros
- #define MOUSE_LEFT 1 // left click
- #define MOUSE_RIGHT 2 // right click
- #define MOUSE_MIDLE 4 // middle click
- client
- var
- mouses_down = 0 //variable for what keys are being held down
- // bitflags to track holding down mouse buttons.
- // uncomment the //world << mouses_down to see.
- // MouseDown() tells us they're being held down
- // then we turn on their respective bitflags
- MouseDown(atom/object,location,control,params)
- var/list/pref = params2list(params)
- if("left" in pref)
- mouses_down |= MOUSE_LEFT
- if("right" in pref)
- mouses_down |= MOUSE_RIGHT
- if("middle" in pref)
- mouses_down |= MOUSE_MIDLE
- //world << mouses_down
- ..()
- // MouseUp() tells us they are no longer being held down.
- // then we turn off their respective bitflags
- MouseUp(object,location,control,params)
- var/list/pref = params2list(params)
- if("left" in pref)
- mouses_down &= ~MOUSE_LEFT
- if("right" in pref)
- mouses_down &= ~MOUSE_RIGHT
- if("middle" in pref)
- mouses_down &= ~MOUSE_MIDLE
- //world << mouses_down
- ..()
- #undef MOUSE_LEFT
- #undef MOUSE_RIGHT
- #undef MOUSE_MIDLE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement