• Advertisement
Sign in to follow this  

[SlimdX]directinput problem

This topic is 2896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
I am using Visual Studio 2008, i test your code and now it doesn´t send me any error when i write the code.

Thank´s

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement