Sign in to follow this  
jor1980

[SlimdX]directinput problem

Recommended Posts

jor1980    152
hi i am trying to create a directinput device but i can´t, i have found this thread in the:http://www.gamedev.net/community/forums/topic.asp?topic_id=495706 forum but i doesn´t work for me. Here is my code: Private keyb As SlimDX.DirectInput.Device Private Sub InitializeInputDevices() Dim keyboardDevice As New SlimDX.DirectInput.DeviceClass(Of keyboarsdtate)(SystemGuid.Keyboard) keyb.SetCooperativeLevel(Me, DirectInput.CooperativeLevel.Background Or DirectInput.CooperativeLevel.Nonexclusive) keyb.Acquire() End Sub but i have two errors : keyboardstate is not defined SlimDX.DirectInput.DeviceClass' hasn´t parameters of type and because of that can´t have arguments of type

Share this post


Link to post
Share on other sites
ragnarsun    133
What version do you have? last is feb 2010. You can initialize the keyboard like this:

C# code..

SlimDX.DirectInput.Mouse mouse;
SlimDX.DirectInput.Keyboard keyboard;
SlimDX.DirectInput.DirectInput directInput;

public void IniKeyBoard()
{
//....stuff load
this.directInput = new SlimDX.DirectInput.DirectInput();
this.keyboard = new SlimDX.DirectInput.Keyboard(this.directInput);
this.mouse = new SlimDX.DirectInput.Mouse(this.directInput);
}

public void Update()
{
if (!this.keyboard.Acquire().IsSuccess || !this.mouse.Acquire().IsSuccess)
return;

SlimDX.DirectInput.KeyboardState key = this.keyboard.GetCurrentState();
SlimDX.DirectInput.MouseState mouse = this.mouse.GetCurrentState();

if (key.IsPressed(SlimDX.DirectInput.Key.W))
//do stuff
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this