⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keyboardmod.bas

📁 雪人打雪仗的3D第一人称游戏
💻 BAS
字号:
Attribute VB_Name = "KeyboardMod"
Option Explicit
Public DKI As DirectInput8
Public DKIDevice As DirectInputDevice8
Public DKIState As DIKEYBOARDSTATE
Public KeyState(0 To 255) As Boolean    'so we can detect if the key has gone up or down!
Public Const KeyBufferSize As Long = 10 'how many events the buffer holds.
Public DevProp As DIPROPLONG
'====================================================================================
Public Function KeyCheck(): Dim B As Integer
    DKIDevice.GetDeviceStateKeyboard DKIState 'get the keyboard state
    For B = LBound(DKIState.Key()) To UBound(DKIState.Key())
        DoEvents
        If DKIState.Key(B) = 128 And (Not KeyState(B) = True) Then
            KeyState(B) = True: KeyEvent B, "D"
        ElseIf DKIState.Key(B) = 0 And (Not KeyState(B) = False) Then
            KeyState(B) = False: KeyEvent B, "U"
        End If
    Next B
End Function
'====================================================================================
Private Function KeyEvent(ByVal B As Integer, ByVal KTag As String): If KTag = Empty Then Exit Function
    If KTag = "D" Then
        'do down functions
    ElseIf KTag = "U" Then  'do the functions i want on keyup
        Select Case B
            Case 1: Running = False 'the Esc key was pressed and released
        End Select
    End If
End Function
'====================================================================================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -