BitBlt Text Map for a game intro messin up

Gamer X
03-11-2002, 11: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)

Kitaiko
03-11-2002, 11:48 PM
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





Sorry, It just looks better

Kitaiko
03-11-2002, 11:53 PM
Make sure your pic box's scalemode is in pixels.

Gamer X
03-12-2002, 07:27 AM
It is in pixels, and I couldn't figure out how to make the text go out all the way, as I haven't posted here in a while. I see now though.

Arigato,
GamerX (http://gamerx-creations.cjb.net)

Gamer X
03-12-2002, 08:23 AM
I found what was wrong in my code, I didn't know that the first integers after BitBlt defined the lower right hand corner! I have corrected it, but now I have a critical question. How do I define the upper-left hand corner??
Also, how do I disallow a letter from appearing until I want it to? Currently all the leters appear in the center of the screen in the same order they are in the JPEG. Is that normal? Should I just move them all off the screen and manually move them back as neccessary? Any response would be greatly appreciated.

Arigato,
GamerX (http://gamerx-creations.cjb.net)

Gamer X
03-12-2002, 10:47 PM
I got it to work, thanks for helping. . .

Arigato,
Gamer X (http://gamerx-creations.cjb.net)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum