home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 3195
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 4680
- LinkTopic = "Form1"
- ScaleHeight = 3195
- ScaleWidth = 4680
- StartUpPosition = 3 'Windows Default
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Const TILEBMPCOLS As Long = 16
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = 27 Then Shutdown
- End Sub
- Private Sub Form_Load()
- 'set up the main form
- Me.Caption = "ViewMap"
- Me.AutoRedraw = False
- Me.BorderStyle = 1
- Me.ClipControls = False
- Me.ScaleMode = 3
- Me.width = Screen.TwipsPerPixelX * (SCREENWIDTH + 12)
- Me.height = Screen.TwipsPerPixelY * (SCREENHEIGHT + 30)
- Me.Show
- 'initialize Direct3D
- InitDirect3D Me.hWnd
- 'get reference to the back buffer
- Set backbuffer = d3ddev.GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO)
- 'load the bitmap file
- Set tiles = LoadSurface(App.Path & "\ireland.bmp", 1024, 576)
- 'load the map data from the Mappy export file
- LoadBinaryMap App.Path & "\ireland.mar", MAPWIDTH, MAPHEIGHT
- 'clear the screen to black
- d3ddev.Clear 0, ByVal 0, D3DCLEAR_TARGET, C_BLACK, 1, 0
- SatelliteView
- End Sub
- Public Sub SatelliteView()
- Dim tilex As Integer
- Dim tiley As Integer
- Dim x As Integer
- Dim y As Integer
- Dim tilenum As Integer
- Dim r As DxVBLibA.RECT
- Dim p As DxVBLibA.point
- 'draw tiles onto the scroll buffer surface
- For y = 0 To MAPHEIGHT - 1 Step 4
- For x = 0 To MAPWIDTH - 1 Step 4
-
- tilenum = mapdata(y * MAPWIDTH + x)
-
- r.Left = (tilenum Mod TILEBMPCOLS) * TILEWIDTH
- r.Top = (tilenum \ TILEBMPCOLS) * TILEHEIGHT
- r.Right = r.Left + 1
- r.bottom = r.Top + 1
-
- p.x = x / 4
- p.y = y / 4
-
- d3ddev.CopyRects tiles, r, 1, backbuffer, p
- Next x
- Next y
- End Sub
- Private Sub Form_Paint()
- d3ddev.Present ByVal 0, ByVal 0, 0, ByVal 0
- End Sub
-