Gamer X
03-11-2002, 10:46 PM
Hello everybody! I am trying to make an intro for a game (it's going to be like the demo sequences back on the C64), and I can't get BitBlt to work properly.
I found a tutorial on BitBlt the other day, and set everything up as it directed. Then I added some cool code I found for BitBlt-ing a certain section of a pic to an array, and the picture doesn't divide correctly.
The picture I am using contains 57 letters 75pixels x 75pixels, in four rows of 13 and one of 5. I am using the following code to put each letter into an array defined by the letter's ASCII character.
-----------------
Sub RenderSprite()
Dim CharText As String
Dim i As Integer
Dim CurChar As String
CharText = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=/\~" & Chr(34) & "?,."
For i = 1 To Len(CharText)
CurChar = Mid$(CharText, i, 1)
BitBlt PB.hdc, Letter(Asc(CurChar)).x, Letter(Asc(CurChar)).y, ((i - 1) Mod 13) * 75, Int((i - 1) / 13) * 75, picLettermsk.hdc, 0, 0, vbMergePaint
BitBlt PB.hdc, Letter(Asc(CurChar)).x, Letter(Asc(CurChar)).y, ((i - 1) Mod 13) * 75, Int((i - 1) / 13) * 75, picLetter.hdc, 0, 0, vbSrcAnd
Next i
End Sub
------------------
I am using Visual Basic 4, if that has anything to do with it. The exact problem is in the sizing. If I select for the letter 'A' to move, it's sized fine. But any other letter is sized and aligned incorrectly. Any insights that could be given would be greatly appreciated, as I would like to learn and use BitBlt.
Arigato,
Gamer X (http://gamerx-creations.cjb.net)
I found a tutorial on BitBlt the other day, and set everything up as it directed. Then I added some cool code I found for BitBlt-ing a certain section of a pic to an array, and the picture doesn't divide correctly.
The picture I am using contains 57 letters 75pixels x 75pixels, in four rows of 13 and one of 5. I am using the following code to put each letter into an array defined by the letter's ASCII character.
-----------------
Sub RenderSprite()
Dim CharText As String
Dim i As Integer
Dim CurChar As String
CharText = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=/\~" & Chr(34) & "?,."
For i = 1 To Len(CharText)
CurChar = Mid$(CharText, i, 1)
BitBlt PB.hdc, Letter(Asc(CurChar)).x, Letter(Asc(CurChar)).y, ((i - 1) Mod 13) * 75, Int((i - 1) / 13) * 75, picLettermsk.hdc, 0, 0, vbMergePaint
BitBlt PB.hdc, Letter(Asc(CurChar)).x, Letter(Asc(CurChar)).y, ((i - 1) Mod 13) * 75, Int((i - 1) / 13) * 75, picLetter.hdc, 0, 0, vbSrcAnd
Next i
End Sub
------------------
I am using Visual Basic 4, if that has anything to do with it. The exact problem is in the sizing. If I select for the letter 'A' to move, it's sized fine. But any other letter is sized and aligned incorrectly. Any insights that could be given would be greatly appreciated, as I would like to learn and use BitBlt.
Arigato,
Gamer X (http://gamerx-creations.cjb.net)