Hello all.
Quick question for anyone that has used RawMouse / RawInputMouse (and for
anyone that hasn't used it.. look here:
http://link.mywwwserver.com/~jstookey/arcade/rawmouse/).
RawMouse is basically a program for managing multiple mouses independently
but connected to the same machine using MAME.
It's been ported to C# recently enough and having finally gotten it to read
two mouse inputs from the one PC.... am now able to use my TouchPad and my
USB Mouse to control two paddles on m Air Hockey game.
But if both paddles move at the same time, the delay can be quite
problematic!
Below is the important snippets of my code for implementing it...
using RawInputSharp;
namespace AirHockey
{
public class frmTable : System.Windows. Forms.Form
{
// rawmouseinput
private RawMouseInput _rmInput;
public frmTable()
{
InitializeCompo nent();
//create and init
_rmInput = new RawMouseInput() ;
_rmInput.Regist erForWM_INPUT(t his.Handle);
UpdateControls( );
DoubleBuffering ();
CreateTablePath ();
CreatePlayer1Re gionPath();
CreatePlayer2Re gionPath();
}
protected const int WM_INPUT = 0x00FF;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_INPUT:
//read in new mouse values.
_rmInput.Update RawMouse(m.LPar am);
UpdateControls( );
break;
}
base.WndProc(re f m);
}
protected void UpdateControls( )
{
if(_rmInput.Mic e.Count > 0)
{
RawMouse mouse1 = (RawMouse)_rmIn put.Mice[0];
paddle1_x = mouse1.X;
paddle1_y = mouse1.Y;
}
if(_rmInput.Mic e.Count > 1)
{
RawMouse mouse2 = (RawMouse)_rmIn put.Mice[1];
paddle2_x = mouse2.X;
paddle2_y = mouse2.Y;
}
}
}
Is there any way to improve the efficiency of this? Even decrease the delay
somewhat!
Thanks in advance all.
Brian