Skip to main content

News

Topic: Mouse Library v1.0 (Read 1468 times) previous topic - next topic

Mouse Library v1.0
Hey guys, heres my old mouse library in case anybody wanted it

Code: [Select]
var mouse = new _mouse(image) // To create a mouse object

mouse.update // In your update script
mouse.render // In your render script

mouse.isMouseOver(x, y, w, h, object) // If mouse is over x,y,w,h returns true. If you also specify an object that object will be targeted by the mouse for further actions

your_object.leftOnPress = function() {}
your_object.leftOnHold = function() {}
your_object.leftOnRelease = function() {}
your_object.rightOnPress = function() {}
your_object.rightOnHold = function() {} // Specify the function calls INSIDE your desired object
your_object.rightOnRelease = function() {}
your_object.middleOnPress = function() {}
your_object.middleOnHold = function() {}
your_object.middleOnRelease = function() {}

// For the above you MUST run .isMouseOver() with the object included as this will mean the mouse will call the appropriate function from inside that object

your_object.heldLag // If you want a delay between performing actions for the ""onHold functions. Every itteration is too much for most onHold functions


It does a couple of other things it can do but its fully commented

The next version will include further control, list the mouse wheel. I also wanted to include proper Keyboard support so itll be more of a "Input" library

I did have a more advanced version of this script but it seems to have wandered off???
  • Last Edit: May 30, 2013, 01:27:34 am by Harry Bo21