|
-
Dec 18th, 2002, 10:48 AM
#1
Thread Starter
Member
Bit Map Stuff
I'm developing a program that requires many bitmaps to be manipulated about a picture box with a bit map background(drawing area). I attempt to capture a bitmap in the drawing area as I know its coordinates via a mouse down event and "drag" it around via a mousemove event. As the bitmap is moved I redraw the background and other bitmaps present in he drawing area back to their current locations. It seems to "sort of" work, but I start getting weird stuff happening. It seems a bit resource intensive to redraw everything as the bitmap is dragged.
I'm using Visual Basic with no DirectX. Can I do this In VB only or do I need all or some of DirectX? Thanks for any help.
-
Dec 18th, 2002, 02:07 PM
#2
No you don't need to use DX to pull it off...BTW don't redraw the whole screen all the time. Store the part of the bitmat that is behind what you are drawing, and then blt it to the "surface" again before next movement...
-
Dec 18th, 2002, 02:44 PM
#3
Thread Starter
Member
That's sounds like an excellent solution, but would you happen to have an example?
-
Dec 18th, 2002, 02:52 PM
#4
Originally posted by Don Jahns
That's sounds like an excellent solution, but would you happen to have an example?
Sorry, I had one once, but I think I have deleted it because I never use a static background in my games, so that thing don't sped up my game anyway...But I will tell you if I find anything...
-
Dec 18th, 2002, 02:53 PM
#5
Thread Starter
Member
Ok. Thanks for all of your help.
-
Dec 18th, 2002, 03:02 PM
#6
BTW look at this...
VB Code:
Dim rTemp as Rect
rTemp.Left = SpriteX
rTemp.Top = SpriteY
rTemp.Right = rTemp.Left + ddsdSprite.lWidth
rTemp.Bottom = rTemp.Top + ddsdSprite.lHeight
ddBackBuffer.BltFast SpriteX, SpriteY, ddBackground, rTemp, DDBLTFAST_WAIT
This is a DX example...(I'm always using DX, so thats why my code is in DX... ...It makes a rect called rTemp. The code sets the left,RIght,Top,and bottom properties that the sprite had. Then in the last line it Blt the background to the "screen", but it is only Blting the part of the background that rTemp is telling it to....you will have to write the last line here in your code using the form of blitting you are using....I don't know how you have written your code, so I can't tell you more specific...
-
Dec 18th, 2002, 03:44 PM
#7
Thread Starter
Member
Thanks again. I'll try that!
-
Dec 18th, 2002, 03:57 PM
#8
Thread Starter
Member
Sorry to bother you again, but you've been very helpful. But how would that translate to VB bitblt as it calls for a source Hdc and dest HDC?
Private Declare Function BitBlt Lib "gdi32" ( _
ByVal hDestDC As Long, _
ByVal X As Long, ByVal Y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, ByVal ySrc As Long, _
ByVal dwRop As Long _
) As Long
My attempt:
bitblt picboard.hdc,SpriteX,SpriteY,SpriteWidth,SpriteHeight,?.hdc,?,?...
---------
Dim rTemp as Rect
rTemp.Left = SpriteX
rTemp.Top = SpriteY
rTemp.Right = rTemp.Left + ddsdSprite.lWidth
rTemp.Bottom = rTemp.Top + ddsdSprite.lHeight
ddBackBuffer.BltFast SpriteX, SpriteY, ddBackground, rTemp, DDBLTFAST
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|