📄 dxengine.vb
字号:
Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Imports Microsoft.DirectX.DirectInput
Module DxE
Private Dx As DxEngine
''' <summary>
''' Application main entry point.
''' </summary>
''' <remarks>Starts the Dx Engine and Loads from the init.dhe file.</remarks>
Public Sub Main()
Dx = New DxEngine
Dx.ReadScriptFile(Application.StartupPath & "\..\..\media\init.dhe")
Dx.MsgPump()
End Sub
Public NotInheritable Class DxEngine
#Region "Includes and DLLImports"
<System.Security.SuppressUnmanagedCodeSecurity(), System.Runtime.InteropServices.DllImport("kernel32.dll")> _
Public Shared Sub Sleep(ByVal dwMilliseconds As Long)
End Sub
#End Region
#Region "Variables, Constructors, Deconstructors"
Shared DD As Direct3D.Device
Shared DM As DirectInput.Device
Shared DK As DirectInput.Device
Shared Textures As ArrayList
Shared Tiles As ArrayList
Shared AnimTiles As ArrayList
Public Adapter As Integer
Public Format As Direct3D.Format
Public UsingCustomParams As Boolean
Public ClearColor As Color
Private Params As PresentParameters
Private Disposing As Boolean
Private RenderControl As Control
Private InitFlags As CreateFlags
Private DevType As Direct3D.DeviceType
Private Rendering As Boolean
Private RenderLoopCompleted As Boolean = True
Private Paused As Boolean
Private GameSpeed As Single
Private strMediaPath As String
Private Msgs As ArrayList
Private ExitCalled As Boolean
Private fpsWriter As TextWriter
Private UnPauseKey As Key
#Region "Mouse And Keyboard Vars"
Private LeftClickCommand As String
Private LeftArrowCommand As String
Private RightArrowCommand As String
Private UpArrowCommand As String
Private DownArrowCommand As String
Private Q_KeyCommand As String
Private W_KeyCommand As String
Private E_KeyCommand As String
Private R_KeyCommand As String
Private T_KeyCommand As String
Private Y_KeyCommand As String
Private U_KeyCommand As String
Private I_KeyCommand As String
Private O_KeyCommand As String
Private P_KeyCommand As String
Private A_KeyCommand As String
Private S_KeyCommand As String
Private D_KeyCommand As String
Private F_KeyCommand As String
Private G_KeyCommand As String
Private H_KeyCommand As String
Private J_KeyCommand As String
Private K_KeyCommand As String
Private L_KeyCommand As String
Private Z_KeyCommand As String
Private X_KeyCommand As String
Private C_KeyCommand As String
Private V_KeyCommand As String
Private B_KeyCommand As String
Private N_KeyCommand As String
Private M_KeyCommand As String
Private No1_KeyCommand As String
Private No2_KeyCommand As String
Private No3_KeyCommand As String
Private No4_KeyCommand As String
Private No5_KeyCommand As String
Private No6_KeyCommand As String
Private No7_KeyCommand As String
Private No8_KeyCommand As String
Private No9_KeyCommand As String
Private No0_KeyCommand As String
Private F1_KeyCommand As String
Private F2_KeyCommand As String
Private F3_KeyCommand As String
Private F4_KeyCommand As String
Private F5_KeyCommand As String
Private F6_KeyCommand As String
Private F7_KeyCommand As String
Private F8_KeyCommand As String
Private F9_KeyCommand As String
Private F10_KeyCommand As String
Private F11_KeyCommand As String
Private F12_KeyCommand As String
Private Esc_KeyCommand As String
Private Pause_KeyCommand As String
Private ScrollLock_KeyCommand As String
Private PrintScreen_KeyCommand As String
Private Insert_KeyCommand As String
Private Delete_KeyCommand As String
Private Home_KeyCommand As String
Private End_KeyCommand As String
Private PgUp_KeyCommand As String
Private PgDown_KeyCommand As String
Private Minus_KeyCommand As String
Private Plus_KeyCommand As String
Private LeftBrace_KeyCommand As String
Private RightBrace_KeyCommand As String
Private Colon_KeyCommand As String
Private Quote_KeyCommand As String
Private Enter_KeyCommand As String
Private Comma_KeyCommand As String
Private Period_KeyCommand As String
Private FrontSlash_KeyCommand As String
Private BackSlash_KeyCommand As String
Private RightShift_KeyCommand As String
Private RightAlt_KeyCommand As String
Private RightControl_KeyCommand As String
Private Space_KeyCommand As String
Private LeftAlt_KeyCommand As String
Private LeftControl_KeyCommand As String
Private LeftShift_KeyCommand As String
Private CapsLock_KeyCommand As String
Private Tab_KeyCommand As String
Private Tilde_KeyCommand As String
Private KPNumLock_KeyCommand As String
Private KPDiv_KeyCommand As String
Private KPMul_KeyCommand As String
Private KPMin_KeyCommand As String
Private KPAdd_KeyCommand As String
Private KPEnter_KeyCommand As String
Private KPPeriod_KeyCommand As String
Private KP0_KeyCommand As String
Private KP1_KeyCommand As String
Private KP2_KeyCommand As String
Private KP3_KeyCommand As String
Private KP4_KeyCommand As String
Private KP5_KeyCommand As String
Private KP6_KeyCommand As String
Private KP7_KeyCommand As String
Private KP8_KeyCommand As String
Private KP9_KeyCommand As String
Private BackSpace_KeyCommand As String
Private LeftClickCommand_Wait As Integer
Private LeftArrowCommand_Wait As Integer
Private RightArrowCommand_Wait As Integer
Private UpArrowCommand_Wait As Integer
Private DownArrowCommand_Wait As Integer
Private Q_KeyCommand_Wait As Integer
Private W_KeyCommand_Wait As Integer
Private E_KeyCommand_Wait As Integer
Private R_KeyCommand_Wait As Integer
Private T_KeyCommand_Wait As Integer
Private Y_KeyCommand_Wait As Integer
Private U_KeyCommand_Wait As Integer
Private I_KeyCommand_Wait As Integer
Private O_KeyCommand_Wait As Integer
Private P_KeyCommand_Wait As Integer
Private A_KeyCommand_Wait As Integer
Private S_KeyCommand_Wait As Integer
Private D_KeyCommand_Wait As Integer
Private F_KeyCommand_Wait As Integer
Private G_KeyCommand_Wait As Integer
Private H_KeyCommand_Wait As Integer
Private J_KeyCommand_Wait As Integer
Private K_KeyCommand_Wait As Integer
Private L_KeyCommand_Wait As Integer
Private Z_KeyCommand_Wait As Integer
Private X_KeyCommand_Wait As Integer
Private C_KeyCommand_Wait As Integer
Private V_KeyCommand_Wait As Integer
Private B_KeyCommand_Wait As Integer
Private N_KeyCommand_Wait As Integer
Private M_KeyCommand_Wait As Integer
Private No1_KeyCommand_Wait As Integer
Private No2_KeyCommand_Wait As Integer
Private No3_KeyCommand_Wait As Integer
Private No4_KeyCommand_Wait As Integer
Private No5_KeyCommand_Wait As Integer
Private No6_KeyCommand_Wait As Integer
Private No7_KeyCommand_Wait As Integer
Private No8_KeyCommand_Wait As Integer
Private No9_KeyCommand_Wait As Integer
Private No0_KeyCommand_Wait As Integer
Private F1_KeyCommand_Wait As Integer
Private F2_KeyCommand_Wait As Integer
Private F3_KeyCommand_Wait As Integer
Private F4_KeyCommand_Wait As Integer
Private F5_KeyCommand_Wait As Integer
Private F6_KeyCommand_Wait As Integer
Private F7_KeyCommand_Wait As Integer
Private F8_KeyCommand_Wait As Integer
Private F9_KeyCommand_Wait As Integer
Private F10_KeyCommand_Wait As Integer
Private F11_KeyCommand_Wait As Integer
Private F12_KeyCommand_Wait As Integer
Private Esc_KeyCommand_Wait As Integer
Private Pause_KeyCommand_Wait As Integer
Private ScrollLock_KeyCommand_Wait As Integer
Private PrintScreen_KeyCommand_Wait As Integer
Private Insert_KeyCommand_Wait As Integer
Private Delete_KeyCommand_Wait As Integer
Private Home_KeyCommand_Wait As Integer
Private End_KeyCommand_Wait As Integer
Private PgUp_KeyCommand_Wait As Integer
Private PgDown_KeyCommand_Wait As Integer
Private Minus_KeyCommand_Wait As Integer
Private Plus_KeyCommand_Wait As Integer
Private LeftBrace_KeyCommand_Wait As Integer
Private RightBrace_KeyCommand_Wait As Integer
Private Colon_KeyCommand_Wait As Integer
Private Quote_KeyCommand_Wait As Integer
Private Enter_KeyCommand_Wait As Integer
Private Comma_KeyCommand_Wait As Integer
Private Period_KeyCommand_Wait As Integer
Private FrontSlash_KeyCommand_Wait As Integer
Private BackSlash_KeyCommand_Wait As Integer
Private RightShift_KeyCommand_Wait As Integer
Private RightAlt_KeyCommand_Wait As Integer
Private RightControl_KeyCommand_Wait As Integer
Private Space_KeyCommand_Wait As Integer
Private LeftAlt_KeyCommand_Wait As Integer
Private LeftControl_KeyCommand_Wait As Integer
Private LeftShift_KeyCommand_Wait As Integer
Private CapsLock_KeyCommand_Wait As Integer
Private Tab_KeyCommand_Wait As Integer
Private Tilde_KeyCommand_Wait As Integer
Private KPNumLock_KeyCommand_Wait As Integer
Private KPDiv_KeyCommand_Wait As Integer
Private KPMul_KeyCommand_Wait As Integer
Private KPMin_KeyCommand_Wait As Integer
Private KPAdd_KeyCommand_Wait As Integer
Private KPEnter_KeyCommand_Wait As Integer
Private KPPeriod_KeyCommand_Wait As Integer
Private KP0_KeyCommand_Wait As Integer
Private KP1_KeyCommand_Wait As Integer
Private KP2_KeyCommand_Wait As Integer
Private KP3_KeyCommand_Wait As Integer
Private KP4_KeyCommand_Wait As Integer
Private KP5_KeyCommand_Wait As Integer
Private KP6_KeyCommand_Wait As Integer
Private KP7_KeyCommand_Wait As Integer
Private KP8_KeyCommand_Wait As Integer
Private KP9_KeyCommand_Wait As Integer
Private BackSpace_KeyCommand_Wait As Integer
#End Region
Public Sub New()
Textures = New ArrayList
Tiles = New ArrayList
AnimTiles = New ArrayList
Msgs = New ArrayList
Params = Nothing
Disposing = False
Adapter = 0
InitFlags = CreateFlags.HardwareVertexProcessing Or CreateFlags.FpuPreserve Or CreateFlags.MultiThreaded
DevType = Direct3D.DeviceType.Hardware
ClearColor = Color.LightSkyBlue
GameSpeed = 0.01
End Sub
Public Sub Dispose()
If Not Disposing Then
Disposing = True
If Rendering Or (RenderLoopCompleted = False) Then
Rendering = False
End If
ReleaseInputs()
DisposeDI()
For i As Integer = Textures.Count - 1 To 0 Step -1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -