3 # Copyright (C) 2000-2004 Carsten Haitzler, Geoff Harrison and various contributors
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to
7 # deal in the Software without restriction, including without limitation the
8 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 # sell copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice shall be included in
13 # all copies of the Software, its documentation and marketing & publicity
14 # materials, and acknowledgment shall be given in the documentation, materials
15 # and software packages that this Software was used.
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 # THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 # This is a little script that will create a window that says
25 # "Follow the Bouncing Ball" and then drops it to the bottom of the
26 # screen and slowly bounces it around.
27 # then when it's done bouncing it gets rid of it.
30 $s = `eesh screen size`;
33 ($crap,$width,$height) = split(/\s+/,$s);
34 if ($s =~ /.*size\s+(\d+)x(\d+)/) {
35 $width = $1; $height = $2;
38 `eesh dialog_ok \"Follow the Bouncing Ball\"`;
41 $s = `eesh win_op $ball move "?"`;
42 if ($s =~ /.*:\s+(\d+)\s+(\d+)/) {
43 $ballx = $1; $bally = $2;
45 $s = `eesh win_op $ball size "??"`;
46 if ($s =~ /.*:\s+(\d+)\s+(\d+)/) {
47 $ballw = $1; $ballh = $2;
49 #print "x,y=$ballx,$bally wxh=$ballw x $ballh\n";
51 # now for the fun part. make that baby bounce up and down.
52 # we're going to open a big pipe for this one and just shove data
55 open IPCPIPE,"| eesh";
57 @fallspeed = (30,25,20,15,10,5,4,3,2);
60 $originalbally = $bally;
61 $fallspeed = $fallspeed[i];
62 while($bally < ($height - $ballh)) {
63 if(($bally + $fallspeed + $ballh) < $height) {
66 $bally = $height - $ballh;
68 print IPCPIPE "win_op $ball move $ballx $bally\n";
69 system("usleep 20000");
73 $fallspeed = $fallspeed[i+1];
78 while($bally > ($originalbally + int($originalbally * (1/$#fallspeed)))) {
79 if(($bally - $fallspeed) >
80 ($originalbally + int($originalbally * (1/$#fallspeed)))) {
83 $bally = $originalbally + int($originalbally * (1/$#fallspeed));
85 print IPCPIPE "win_op $ball move $ballx $bally\n";
86 system("usleep 20000");
91 print IPCPIPE "win_op $ball close\n";