IonicWind Software

Creative Basic => 2D/3D => Topic started by: GWS on January 22, 2012, 12:41:29 PM

Title: Drag a Bitmap
Post by: GWS on January 22, 2012, 12:41:29 PM
Hi,

Here's a nice bit of work from long ago by Tony Jones - circa 2002 .. :)

Tony says:
QuoteI originally wanted to write a card game in "pure" IBasic without the need for a 3rd party DLL, but knew that it would take way too long to come up with the support for it, mainly the drag and drop routines.

In any case, below is what I came up with. It's based on an example in C that I found from Microsoft for Windows 3.1 circa 1993.

This is a detailed piece of work that is worth some study, using many graphics API routines.

I've included the .exe file for those who would like to try it, but don't have CB loaded.

all the best, :)

Graham

[Code amended as per Brian's comment below]



Title: Re: Drag a Bitmap
Post by: Brian on January 23, 2012, 12:27:26 PM
Graham,

There's an error in this line (well, according to IWB, that is):

' Copy old background to screen
BitBlt(hdc,ImageInfo.bmX+dx,ImageInfo+dy,ImageInfo.bmWidth,ImageInfo.bmHeight,hdcOldBkg,0,0,SRCCOPY)

Needs changing to:
' Copy old background to screen
BitBlt(hdc,ImageInfo.bmX+dx,ImageInfo.bmY+dy,ImageInfo.bmWidth,ImageInfo.bmHeight,hdcOldBkg,0,0,SRCCOPY)

Brian
Title: Re: Drag a Bitmap
Post by: GWS on January 23, 2012, 12:51:54 PM
Brian,

Thanks for the correction.  Strange it didn't seem to affect the programs operation. ::)

I've altered the zip file in the first post ..

best wishes, :)

Graham

Title: Re: Drag a Bitmap
Post by: Brian on January 23, 2012, 03:50:06 PM
Graham,

Actually, it did. When you drag the bitmap down to the bottom of the screen, it reacts
quite differently to when you drag it to the top, left and right sides

Brian
Title: Re: Drag a Bitmap
Post by: GWS on January 23, 2012, 11:18:40 PM
Yep, I hadn't studied it, so I reckon it might need a bit of thought about what behaviour is required at the screen edges.

all the best, :)

Graham