Graphics Reference
In-Depth Information
// Left mouse button up service routine
D3:
LMBUpRoutine
(mousePosition)
InsertHeroBallToAllWorldBalls()
DefiningNewHeroBall =
false
// Right mouse button down service routine
D4:
RMBDownRoutine
(mousePosition)
HeroBall = SelectHeroBallBasedOn (mousePosition )
if
(HeroBall != null)
SetSliderBarsWithHeroBallVelocity()
// Slider Bar change service routine
D5:
SliderBarRoutine
(sliderBarValues)
if
(HeroBall != null)
SetSliderBarsWithHeroBallVelocity(sliderBarValues)
// Timer expired service routine
D6:
ServiceTimer
()
// Move balls by velocities
and remove off-screen ones
UpdateSimulation()
// Sets status bar with number of balls on screen
EchoToStatusBar()
// Generates a redraw event
GUISystem
:: GenerateRedrawEvent
// Reflect propoer HeroBall velocity
if
(HeroBall != null)
SetSliderBarsWithHeroBallVelocity(sliderBarValues)
// Redraw event service routine
D7:
RedrawRoutine
()
DrawBalls(AllWorldBalls)
if
(DefiningNewHeroBall)
// Draw the new Hero Ball that is being defined
DrawBalls(HeroBall)
Listing 1.7.
(cont.)
The timer event definition (A2S2) sets up a periodic alarm for the application
to update the simulation of the free-falling balls. The service routines of the
user-generated application-specific events (D1-D5) are remarkably similar to the
Search WWH ::
Custom Search