ModelPreview: fix WASD (use Pilz.Win32.Keyboard)
This commit is contained in:
@@ -95,13 +95,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Pilz.Simple3DFileParser\Pilz.Simple3DFileParser.vbproj" />
|
||||
<ProjectReference Include="..\Pilz.Win32\Pilz.Win32.vbproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="ModelPreview.Designer.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="OpenTK3">
|
||||
<HintPath>..\Shared Libs\OpenTK3.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -9,9 +9,7 @@ Imports Point = System.Drawing.Point
|
||||
Imports Color = System.Drawing.Color
|
||||
Imports OpenTK.Mathematics
|
||||
Imports OpenTK.WinForms
|
||||
Imports OpenTK.Input
|
||||
Imports OpenTK.Windowing.GraphicsLibraryFramework
|
||||
Imports Key = OpenTK3.Input.Key
|
||||
Imports Pilz.Win32.Mapped
|
||||
|
||||
Namespace PreviewN
|
||||
|
||||
@@ -32,12 +30,6 @@ Namespace PreviewN
|
||||
Public Property Scaling As Single = 500.0F
|
||||
Public Property ClearColor As Color = Color.CornflowerBlue
|
||||
|
||||
Public ReadOnly Property Keyboard As OpenTK3.Input.KeyboardState
|
||||
Get
|
||||
Return OpenTK3.Input.Keyboard.GetState
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property EnableCameraControlling As Boolean
|
||||
Get
|
||||
Return _EnableCameraControlling
|
||||
@@ -89,15 +81,13 @@ Namespace PreviewN
|
||||
|
||||
Private ReadOnly Property IsStrgPressed As Boolean
|
||||
Get
|
||||
Dim state = Keyboard
|
||||
Return state(Key.ControlLeft) OrElse state(Key.ControlRight)
|
||||
Return Keyboard.IsKeyDown(Keys.Control)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private ReadOnly Property IsShiftPressed As Boolean
|
||||
Get
|
||||
Dim state = Keyboard
|
||||
Return state(Key.ShiftLeft) OrElse state(Key.ShiftRight)
|
||||
Return Keyboard.IsKeyDown(Keys.Shift)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -293,32 +283,24 @@ Namespace PreviewN
|
||||
Dim allowCamMove As Boolean = Not (IsMouseDown AndAlso IsShiftPressed)
|
||||
|
||||
If allowCamMove Then
|
||||
Dim state = Keyboard
|
||||
|
||||
If state(Key.W) Then
|
||||
'camera.Move(moveSpeed, moveSpeed, camMtx)
|
||||
If Keyboard.IsKeyDown(Keys.W) Then
|
||||
MyCamera.UpdateCameraMatrixWithScrollWheel(moveSpeed, camMtx)
|
||||
savedCamPos = MyCamera.Position
|
||||
End If
|
||||
If state(Key.S) Then
|
||||
'camera.Move(-moveSpeed, -moveSpeed, camMtx)
|
||||
If Keyboard.IsKeyDown(Keys.S) Then
|
||||
MyCamera.UpdateCameraMatrixWithScrollWheel(-moveSpeed, camMtx)
|
||||
savedCamPos = MyCamera.Position
|
||||
End If
|
||||
If state(Key.A) Then
|
||||
'camera.Move(-moveSpeed, 0, camMtx)
|
||||
If Keyboard.IsKeyDown(Keys.A) Then
|
||||
MyCamera.UpdateCameraOffsetDirectly(-moveSpeed, 0, camMtx)
|
||||
End If
|
||||
If state(Key.D) Then
|
||||
'camera.Move(moveSpeed, 0, camMtx)
|
||||
If Keyboard.IsKeyDown(Keys.D) Then
|
||||
MyCamera.UpdateCameraOffsetDirectly(moveSpeed, 0, camMtx)
|
||||
End If
|
||||
If state(Key.E) Then
|
||||
'camera.Move(0, -moveSpeed, camMtx)
|
||||
If Keyboard.IsKeyDown(Keys.E) Then
|
||||
MyCamera.UpdateCameraOffsetDirectly(0, -moveSpeed, camMtx)
|
||||
End If
|
||||
If state(Key.Q) Then
|
||||
'camera.Move(0, moveSpeed, camMtx)
|
||||
If Keyboard.IsKeyDown(Keys.Q) Then
|
||||
MyCamera.UpdateCameraOffsetDirectly(0, moveSpeed, camMtx)
|
||||
End If
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user