fb:porticula NoPaste
rain. SLOW
Uploader: | flo |
Datum/Zeit: | 01.05.2009 19:15:21 |
#include "fbgfx.bi"
screenres 1024,768,32
'screenres 1024,768,32,,fb.gfx_alpha_primitives
dim as fb.image ptr overlay
declare sub overlay_rain(buf as fb.image ptr)
dim as fb.image ptr buffer,tmpbuf
buffer=imagecreate(1024,768,rgb(0,0,0))
dim as double s
do
s=timer
overlay_rain(buffer)
screenlock
cls
put(0,0),buffer,alpha
screenunlock
do: sleep 1: loop while (timer-s)<0.02
'sleep 20
loop while inkey =""
sleep
const rain_xspeed=-5*1.75
const rain_yspeed=20*1.75
const rain_xlen=-20
const rain_ylen=40
const rain_n=800
type TRain
x as double
y as double
dx as double
end type
sub overlay_rain(buf as fb.image ptr)
static as TRain rain(1 to rain_n)
static as integer init=0
dim as integer i,j
if init=0 then
for i=1 to rain_n
rain(i).x=rnd*1500
rain(i).y=rnd*768
rain(i).dx=rnd*2
next
init=1
end if
line buf,(0,0)-(1023,767),rgba(0,0,0,255),BF
for i=1 to rain_n
with rain(i)
.x+=rain_xspeed+.dx
.y+=rain_yspeed
if .y>768 or .x<0 then
.y=0+rain_yspeed*rnd
.x=rnd*1500
.dx=rnd*2
end if
for j=-2 to 2
line buf,(.x+j,.y)-(.x+rain_xlen+j,.y+rain_ylen),rgba(127-abs(j*32),130-abs(j*32),196-abs(j*48),127-abs(j*32))
next
'line buf,(.x+1,.y)-(.x+rain_xlen+1,.y+rain_ylen),rgba(127,127,127,127)
'line buf,(.x-1,.y)-(.x+rain_xlen-1,.y+rain_ylen),rgba(127,127,127,127)
end with
next
'line buf,(100+i*rain_xspeed,i*rain_yspeed)-(90+i*rain_xspeed,i*rain_yspeed+20),rgba(127,127,127,255)
end sub