Get mouse wheel delta GD5


Hello, if you need value when you scroll with your mouse, you need “MouseWheelDelta”

It’s ok with mouse on pc/mac/linux, for touch on mobile it’s not tested, I don’t think it’s going to work, the mobile works differently.

This function is in GD but not accessible easyly.
I’ve added a function for use it as numerical expression !

Here code and below the instruction for import it in your game :

{"000kind":"GDEVELOP_Events Function_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsFunction":{"description":"Return mouse wheel delta when we scroll","fullName":"MouseWheelDelta","functionType":"Expression","name":"E_GetMouseWheelDelta","sentence":"","events":[{"disabled":false,"folded":false,"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[],"events":[]},{"disabled":false,"folded":false,"type":"BuiltinCommonInstructions::JsCode","inlineCode":"eventsFunctionContext.returnValue = runtimeScene.getGame().getInputManager().getMouseWheelDelta();","parameterObjects":"","useStrict":true}],"parameters":[],"objectGroups":[]},"name":"E_GetMouseWheelDelta"}}
  1. Double click for select all text
  2. Copy it with CTRL+C
  3. Go in GD5, in functions.
  4. Add a new empty function
  5. Just right click on it, and click on Paste !
  6. Now you see a new function “E_GetMouseWheelDelta”
  7. You can delete the empty function, it was just for Paste

Mouse Wheel up/down, MouseWheelDelta() not supported ?
Mouse scrolling

Thanks Bouh,

This is really welcome :slight_smile:


Nice, it must be included with Gdevelop as a builtin function/expression.