Dcb: Visual Basic Version
In the Visual Basic version, the load event handler calls the program's LoadBird() function to read the bird bitmap data from the BirdHC.dat file.
'*****************************************************************************
' *
' Dcb.frm *
' *
' This program demonstrates the Fastgraph for Windows direct color bitmap *
' display functions. *
' *
'*****************************************************************************
Const vbWidth = 320
Const vbHeight = 240
Dim Bird(40 * 20) As Integer
Dim hPal As Long
Dim hVB As Long
Dim cxClient As Long, cyClient As Long
Private Sub Form_Activate()
Call fg_realize(hPal)
Refresh
End Sub
Private Sub Form_Load()
ScaleMode = 3
Call fg_setdc(hDC)
hPal = fg_defpal()
Call fg_realize(hPal)
Call fg_vbinit
Call fg_vbdepth(16)
hVB = fg_vballoc(vbWidth, vbHeight)
Call fg_vbopen(hVB)
Call fg_vbcolors
Call fg_setcolorrgb(85, 255, 85)
Call fg_fillpage
Call LoadBird
End Sub
Private Sub Form_Paint()
Call fg_vbscale(0, vbWidth - 1, 0, vbHeight - 1, 0, cxClient - 1, 0, cyClient - 1)
End Sub
Private Sub Form_Resize()
cxClient = ScaleWidth
cyClient = ScaleHeight
Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call fg_vbclose
Call fg_vbfree(hVB)
Call fg_vbfin
End Sub
Private Sub mnuClipdcb_Click()
Call fg_fillpage
Call fg_move(-20, vbHeight / 2 + 10)
Call fg_clipdcb(Bird(0), 40, 20)
Call fg_vbscale(0, vbWidth - 1, 0, vbHeight - 1, 0, cxClient - 1, 0, cyClient - 1)
End Sub
Private Sub mnuDrawdcb_Click()
Call fg_fillpage
Call fg_move(vbWidth / 2 - 20, vbHeight / 2 + 10)
Call fg_drawdcb(Bird(0), 40, 20)
Call fg_vbscale(0, vbWidth - 1, 0, vbHeight - 1, 0, cxClient - 1, 0, cyClient - 1)
End Sub
Private Sub mnuFlipdcb_Click()
Call fg_fillpage
Call fg_move(vbWidth - 20, vbHeight / 2 + 10)
Call fg_flipdcb(Bird(0), 40, 20)
Call fg_vbscale(0, vbWidth - 1, 0, vbHeight - 1, 0, cxClient - 1, 0, cyClient - 1)
End Sub
Private Sub mnuPutdcb_Click()
Call fg_fillpage
Call fg_move(vbWidth / 2 - 20, vbHeight / 2 + 10)
Call fg_putdcb(Bird(0), 40, 20)
Call fg_vbscale(0, vbWidth - 1, 0, vbHeight - 1, 0, cxClient - 1, 0, cyClient - 1)
End Sub
Private Sub mnuRevdcb_Click()
Call fg_fillpage
Call fg_move(vbWidth / 2 - 20, vbHeight / 2 + 10)
Call fg_revdcb(Bird(0), 40, 20)
Call fg_vbscale(0, vbWidth - 1, 0, vbHeight - 1, 0, cxClient - 1, 0, cyClient - 1)
End Sub
Private Sub mnuExit_Click()
Unload Me
End Sub
Private Sub LoadBird()
Dim I As Long
Open App.Path & "\BirdHC.dat" For Input Access Read As #1
For I = 0 To 40 * 20 - 1
Input #1, Bird(I)
Next I
Close #1
End Sub
|