home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- BorderStyle = 0 'None
- ClientHeight = 4815
- ClientLeft = 30
- ClientTop = 360
- ClientWidth = 6720
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4815
- ScaleWidth = 6720
- ShowInTaskbar = 0 'False
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
-
-
-
- Private Sub Form_Click()
- g_state = -1
- End Sub
-
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyUp Then vFrom.y = vFrom.y + 10
- If KeyCode = vbKeyDown Then vFrom.y = vFrom.y - 10
- If KeyCode = vbKeyRight Then vFrom.x = vFrom.x + 10
- If KeyCode = vbKeyLeft Then vFrom.x = vFrom.x - 10
- If KeyCode = vbKeyQ Then vFrom.z = vFrom.z + 10
- If KeyCode = vbKeyA Then vFrom.z = vFrom.z - 10
- If KeyCode = vbKeyEscape Then g_state = -10
- If KeyCode = vbKeySpace Then rotateCamera
- 'If g_state = 1 Then g_state = 2 Else g_state = 1
- 'End If
-
- root.IdentityMatrix matrixView
- root.ViewMatrix matrixView, vFrom, vTo, vUp, 0#
- root_dd7_d3d7_Device.SetTransform D3DTRANSFORMSTATE_VIEW, matrixView
-
- End Sub
-
- Private Sub Form_Load()
- Dim nStartTime As Single
- Dim nEndTime As Single
- Dim frames As Long
-
- 'defaultWidth = 1024
- 'defaultHeight = 768
- defaultWidth = 640
- defaultHeight = 480
- defaultBit = 16
- g_state = 1
-
- Call Enumerate
- Call Initialize
- Call InitGraphics
-
- Me.Show
- Me.Height = g_mode.lHeight * Screen.TwipsPerPixelY
- Me.Width = g_mode.lWidth * Screen.TwipsPerPixelX
- Do While g_state > 0
- Do While g_state = 1
- DoEvents
- 'fps code snippet
- nStartTime = root.TickCount
- frames = frames + 1
- If (nStartTime - nEndTime) > 1000 Then
- FPS = frames
- frames = 0
- nEndTime = root.TickCount
- End If
- Call render
- Loop
-
- Loop
-
- Unload Me
-
- End Sub
-
- Private Sub Form_Unload(Cancel As Integer)
- root_dd7.SetCooperativeLevel Me.hWnd, DDSCL_NORMAL
- root_dd7.RestoreDisplayMode
-
-
- Set root_dd7_d3d7_Device = Nothing
- Set root_dd7_d3d7 = Nothing
- Set root_dd7_sZBuffer = Nothing
- Set root_dd7_d3d7 = Nothing
- Set root_dd7_sBack = Nothing
- Set root_dd7_sPrimary = Nothing
- Set root_dd7 = Nothing
- Set root = Nothing
- End Sub
-