Article View: comp.sys.amiga.tech
Article #13045How Does Workbench Do Dragging?
From: Kim DeVaughn
Date: Fri, 09 Jun 1989 23:09
Date: Fri, 09 Jun 1989 23:09
75 lines
3565 bytes
3565 bytes
[ "All sweet things have one thing in common ... a tendency to make you sick." ]
[ --Soolin ]
Yes, I am still around ... just VERY busy ...
I am posting the following for a co-worker of mine who doesn't have
access to the net. Any replies can be posted or email'd to me at
the address below ...
Thanks ...!
/kim /\../\
Mike Robinson asks:
I am trying to write what I thought was going to be a very simple
Solitaire program which uses the mouse. That is, by pressing the left
mouse button you will appear to "pick up" a set of cards, "drag" them
around the screen and, by releasing the button, "drop" them. Trouble is,
I cannot perfect the dragging.
I am rendering to an Intuition window opened up on a 640x200 screen with
(currently) two bitplanes. It is neither a GZZ nor a SBM window; there
are no refresh-type flags specified.
I am working with an in-progress version of the program which only moves
ONE card image. So we're talking about a rectangle of about 1" wide to
1.5" high.
The algorithm captures MOUSEMOVE messages. When the message port becomes
empty, it moves the card to the location specified by the last message.
So the number of moves issued should be substantially less than the total
number of mouse messages received. I have used several algorithms to try
to achieve the drag effect:
(a) Capture the background image. Then write the foreground. To move,
issue 3 blits in a row: old background, capture new background,
write new foreground.
(b) Use Layers. Create the foreground image as a SMART layer. (Notice
that I said that I didn't specify any refresh-types on either window
or screen. Hmm...) Move the layer with library calls.
Algorithm (a) works very badly. It flickers on the slightest of moves.
I surmise that this must be a beam-sync problem because it is noticeable
at the top of the screen and not at the bottom. The flickering would be
better described as 'streaking' since the image is filled with horizontal
bands of the wrong color.
Algorithm (b) works better. The streaking effect disappears, but the
whole image blinks in and out and the edge-clipping effect is very
pronounced. In a GIMMEZEROZERO window the image fails to follow the
mouse at all, but blinks on and off with as much as a quarter-second
between moves.
I feel that I'm getting closer to the answer with the Layers library, but
I'd be *extremely* grateful if someone could tell me, briefly, how
Workbench does it. Window-type, flag settings, what library call, etc.
If I could achieve dragging as well as Workbench does, for comparably
sized images, I'd be delighted. Thanks in advance for your help.
-Mike Robinson
Amdahl Education Center; Santa Clara, CA
--
UUCP: kim@amdahl.amdahl.com
or: {sun,decwrl,hplabs,pyramid,uunet,oliveb,ames}!amdahl!kim
DDD: 408-746-8462
USPS: Amdahl Corp. M/S 249, 1250 E. Arques Av, Sunnyvale, CA 94086
BIX: kdevaughn GEnie: K.DEVAUGHN CIS: 76535,25
Technical Details
Message-ID:
<927G02a733mv01@amdahl.uts.amdahl.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!oliveb!amdahl!kimShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!oliveb!amdahl!kim From: kim@uts.amdahl.com (Kim DeVaughn) Newsgroups: comp.sys.amiga.tech Subject: How Does Workbench Do Dragging? Message-ID: <927G02a733mv01@amdahl.uts.amdahl.com> Date: 9 Jun 89 23:09:29 GMT Organization: Amdahl Corporation, Sunnyvale, CA 94086 Lines: 75