Results 1 to 4 of 4

Thread: VB6 - Complete BitBlt Overview

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2004
    Location
    The Netherlands
    Posts
    41

    Exclamation VB6 - Complete BitBlt Overview

    Hi r33d3r,

    Complete BitBlt Overview
    Yikes! That sounds like ****! Well I won't get in to advanced since I'm quite new to BitBlt as well. (2 non-stop days of brain cracking got me my knowledge so far)
    This topic will be updated with sources (for lazy people I guess, excuse me if I'm wrong ) and more questions.

    !!! PLEASE DON'T REPLY, SEND ME A PRIVATE MESSAGE INSTEAD !!!

    You should read this first!

    So there we are workin' with masking and stuff.
    Now we have some thing to watch out for!

    I use BitBlt and the pictures need to be visible? Why!
    No this isn't needed just do this:
    VB Code:
    1. Picture1.AutoRedraw = True
    2. Picture1.Visible = False
    Now BitBlt again and, see no picturebox but the BitBlt shows you what you wanted.


    Masking is difficult! Is there another way to do this?
    First you need to know that you COULD use masking. Though in many cases you don't need to really make things transparant. (This is a lazy way to accomplish things. ) Just equip the sprites with the unlayered tile now again this won't work in many occasions but sometimes this is just what we want and we don't need to do difficult masking.


    My screen starts to flash a little every now and then (or worse )
    Well this again is a AutoRedraw thing, I still can't find the use of letting this function on False but set
    VB Code:
    1. Picture1.AutoRedraw = True
    then the flashes should've stopped.
    Attached Files Attached Files
    Last edited by paddoswam; May 30th, 2005 at 06:35 AM.

  2. #2

    Thread Starter
    Member
    Join Date
    Dec 2004
    Location
    The Netherlands
    Posts
    41

    Re: VB6 - Complete BitBlt Overview

    Update I've added the attachment but you need to make the Form and Picture1 and Picture2!

    Form1.Picture1.picture = a tiled background.
    Form1.Picture2.picture = a single tile of Picture1 with a character or unit on it.

    SET AutoRedraw to TRUE! On all pictureboxes

    On the Form1.Picture1 object KeyDown
    This is the collision checking. (Very simple)
    VB Code:
    1. Private Sub Form1_KeyDown(KeyCode As Integer, Shift As Integer)
    2.     Dim tileFree As Boolean
    3.     Dim iCur As Long
    4.    
    5.  
    6.     iCur = 0
    7.     tileFree = True
    8.     Select Case KeyCode
    9.         Case 37
    10.         'Left
    11.             Do Until iCur = 255 Or tileFree = False
    12.                 If tBush(iCur).iY = tUnit.iY Then If tBush(iCur).iX = tUnit.iX - 16 Then tileFree = False
    13.                 iCur = iCur + 1
    14.             Loop
    15.             If tileFree = True Then tUnit.iX = tUnit.iX - 16
    16.         Case 38
    17.         'Up
    18.             Do Until iCur = 255 Or tileFree = False
    19.                 If tBush(iCur).iX = tUnit.iX Then If tBush(iCur).iY = tUnit.iY - 16 Then tileFree = False
    20.                 iCur = iCur + 1
    21.             Loop
    22.             If tileFree = True Then tUnit.iY = tUnit.iY - 16
    23.         Case 39
    24.         'Right
    25.             Do Until iCur = 255 Or tileFree = False
    26.                 If tBush(iCur).iY = tUnit.iY Then If tBush(iCur).iX = tUnit.iX + 16 Then tileFree = False
    27.                 iCur = iCur + 1
    28.             Loop
    29.             If tileFree = True Then tUnit.iX = tUnit.iX + 16
    30.         Case 40
    31.         'Down
    32.             Do Until iCur = 255 Or tileFree = False
    33.                 If tBush(iCur).iX = tUnit.iX Then If tBush(iCur).iY = tUnit.iY + 16 Then tileFree = False
    34.                 iCur = iCur + 1
    35.             Loop
    36.             If tileFree = True Then tUnit.iY = tUnit.iY + 16
    37.         Case 27
    38.             End
    39.     End Select
    40. End Sub
    Add this to the draw function, and add a Picture3 box for the unit

    VB Code:
    1. BitBlt form1.Picture1.hDC, tUnit.iX, tUnit.iY, 16, 16, Picture3.hDC, 0, 0, vbSrcCopy
    Last edited by paddoswam; May 30th, 2005 at 06:43 AM.

  3. #3
    Addicted Member frozie's Avatar
    Join Date
    Apr 2010
    Posts
    146

    Re: VB6 - Complete BitBlt Overview

    please post sorce code for this (vb code)

  4. #4
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: VB6 - Complete BitBlt Overview

    Frozie, he said in his first post, not to post here, but to send him a private message instead. You may want to do so.
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width