Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Draggable BitBlt Items
#1
I have been messing around with BitBlt and something I want to do with it is make it so whatever your blitting to the screen can be interacted with and moved around. I examined the clicking player to set targets code and never had any luck for what I am aiming at. So this is what I am trying to do. I want to be able to drag a bitblt item, say you put an item on the screen like for GUI, a heart, or health bar, I want to be able to drag that across the screen to place it anywhere I want on the screen. I hope that makes sense haha. It would be very usefull because I have noticed a few people going to just full screen playing area, cutting out the big GUI menus and what not.
Reply
#2
Concept for this is pretty simple, but actually writing the code can be a bit of a pain so I'm too lazy to do tut.


Basicly, all you need to do is check where the mouse is being clicked, for example, if you click at the coord (200,300), you gotta check if 200 is between the left and right edges of the box area of which you want to drag, then check if 300 is between the top and bottom edges of the box area.

Then, when left click is down, when the mouse is moved, you move the rectangle which directs where to blt the thing, then you stop moving it again when left click is released

Code:
Sub MouseMove
if leftclick = true then
rect.left = Diff between old mouse coord and new mouse coord
rect.top = same thing as above
end if

You could store a reference to where on the rect was clicked on so you can move it acuratly, but I think i'd kinda start to confuse you if i tryed to explain it so all I can say is look into msdn for manually dragging objects (dont look at auto drag)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)