Graphics Reference
In-Depth Information
(V): Initial velocity
(R): Radius
(A): Initial mouse
click position
(B) Dragging
Dragging
(C) Current
mouse position
Figure I.1.
Dragging out a ball.
sizes, shoot the ball, and examine the parabolic free fall of the ball. For clarity,
we avoid graphics-specific complexities in 3D space and confine our discussion
to 2D space. Obviously, our simple program is neither sophisticated nor repre-
sentative of real applications. However, with slightly refined specifications, this
example contains all the essential components and behavioral characteristics of
more complex real-world interactive systems. We will use the design and devel-
opment of the ball-shooting program throughout all chapters in Part I to help us
consolidate the concepts.
Details of the Ball-Shooting Program
Our simple program has the following elements and behaviors.
•
The balls (objects).
The user can left-mouse-button-click and drag out a
new ball (circle) anywhere on the screen (see
Figure I.1
)
. Dragging out a
ball includes:
-
(A): initial mouse-button-click position defines the center of the cir-
cle;
-
(B): mouse-button-down and moving the mouse is the dragging ac-
tion;
-
(C): current mouse position while dragging allows us to define the
radius and the initial velocity. The radius R (in pixel units) is the dis-
Search WWH ::
Custom Search