summaryrefslogtreecommitdiff
path: root/xd.c
diff options
context:
space:
mode:
Diffstat (limited to 'xd.c')
-rw-r--r--xd.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/xd.c b/xd.c
index abdb1c8..bf620e8 100644
--- a/xd.c
+++ b/xd.c
@@ -299,7 +299,7 @@ static DemoInfo demotbl[NO_DEMOS]=
UsesPixmap
},
{
- "Rain Demo",
+ "Rain Demo (LMB to change wind)",
RainDemo,
UsesPixmap
},
@@ -5114,6 +5114,8 @@ static void RainDemo(void)
static Dribble dribble[MAX_DRIBBLES];
+ static int wind;
+
int f, r;
if (!init)
@@ -5136,6 +5138,28 @@ static void RainDemo(void)
Cls();
+ if (mouse_b&Button1Mask)
+ {
+ static time_t bounce=0;
+
+ if (bounce!=time(NULL))
+ {
+ switch(wind)
+ {
+ case 0:
+ wind = 1;
+ break;
+ case 1:
+ wind = -1;
+ break;
+ case -1:
+ wind = 0;
+ break;
+ }
+ bounce=time(NULL);
+ }
+ }
+
if (RND(100) > 95)
{
for(f = 0; f < MAX_DROPS && drop[f].alive; f++)
@@ -5148,7 +5172,7 @@ static void RainDemo(void)
drop[f].life = RND2(height-20, height/2);
drop[f].y = 0;
drop[f].r = 0;
- drop[f].x = RND(width);
+ drop[f].x = RND(width) - (wind * width / 2);
}
}
@@ -5163,7 +5187,7 @@ static void RainDemo(void)
dribble[f].alive = TRUE;
dribble[f].life = height + DRIBBLE_LEN;
dribble[f].y = 0;
- dribble[f].x = RND(width);
+ dribble[f].x = RND(width) - (wind * width / 2);
for(r = 0; r < DRIBBLE_LEN; r++)
{
@@ -5193,7 +5217,7 @@ static void RainDemo(void)
if (dribble[f].life > 0)
{
dribble[f].y++;
- dribble[f].x += RND(3) - 1;
+ dribble[f].x += RND(3) - 1 + wind;
dribble[f].life--;
for(r = 0; r < DRIBBLE_LEN; r++)
@@ -5223,10 +5247,12 @@ static void RainDemo(void)
if (drop[f].life > 0)
{
drop[f].y++;
+ drop[f].x += wind;
drop[f].life--;
FCircle(drop[f].x, drop[f].y, 3, blue);
- Line(drop[f].x, drop[f].y, drop[f].x, drop[f].y - 5, blue);
+ Line(drop[f].x, drop[f].y,
+ drop[f].x - wind * 5, drop[f].y - 5, blue);
}
else
{