Re: How can i get mouseWheel with c#?

#2
Usually you would get mouse values through the Mouse class, but I just noticed that the value of the mouse wheel changing was never assigned to the Mouse in C#. I'll work on fixing it so you can get it easily through the Mouse class.
In the meantime if you need it you can get it by creating a new IHardwareMouseEventListener class, and adding it as a listener to the engine's hardware mouse. Example:

Code: Select all

using CryEngine.Common;

public class MouseListener : IHardwareMouseEventListener
{
public MouseListener()
{
Global.gEnv.pHardwareMouse.AddListener(this);
}

public override void Dispose()
{
Global.gEnv.pHardwareMouse.RemoveListener(this);

base.Dispose();
}

public override void OnHardwareMouseEvent(int iX, int iY, EHARDWAREMOUSEEVENT eHardwareMouseEvent, int wheelDelta)
{
if(eHardwareMouseEvent == EHARDWAREMOUSEEVENT.HARDWAREMOUSEEVENT_WHEEL)
{
Log.Always("The mouse wheel has changed by a value of {0}", wheelDelta);
}
}

public override void OnHardwareMouseEvent(int iX, int iY, EHARDWAREMOUSEEVENT eHardwareMouseEvent)
{
OnHardwareMouseEvent(iX, iY, eHardwareMouseEvent, 0);
}
}

Who is online

Users browsing this forum: No registered users and 1 guest