Reply to thread

Hey all, Ive been dabbling with directdraw for a few weeks, and thought it was time to deal with keystrokes for my upcoming game. I created this class to simplify directinput, but for some reason it wont work. Any ideas?


[CODE]

Public Class DirectInput




    Dim KBState As Microsoft.DirectX.DirectInput.KeyboardState

    Dim KB As New Microsoft.DirectX.DirectInput.Device(SystemGuid.Keyboard)



    Dim JoyState As JoystickState finish me!


    Sub New(ByRef theParentForm As Form)

        KB.SetCooperativeLevel(theParentForm, Background Or NonExclusive)

        KB.Acquire()

    End Sub


    Public Function isPressed(ByRef theKey As Keys, Optional ByRef acquireFirst As Boolean = False) As Boolean

        If acquireFirst Then

            KB.Acquire()

            KBState = KB.GetCurrentKeyboardState

        End If


        isPressed = KBState.Item(theKey)

       

    End Function




    Public Sub acquire()

        KB.Acquire()

        KBState = KB.GetCurrentKeyboardState

        one for joypad, too!



    End Sub




End Class


[/CODE]


Please ignore the redundant joystick code, Ill get to that in time ^^


Back
Top