/* GDIPLUS DEMO BY PETER WIRBELAUER 28.o6.2o12 */
/* Added Midi Charles Pegge */
include "gdip.inc"
include "minmidiT.inc"
sys hMidi,er
er=midiOutOpen(hMidi, 0, 0, 0, CALLBACK_NULL) ' 0=synth a 2=soft synth
midiOutShortMsg(hMidi, 0xff) 'reset
midiOutShortMsg(hMidi, 0x79B0) 'reset all controllers
midiOutShortMsg(hMidi, 0xC0+014*256) 'Tubular Bells
midiOutShortMsg(hMidi, 0xC1+127*256) 'GunShot
midiOutShortMsg(hMidi, 0xC2+052*256) 'Aaahs
'velocity pitch command channel
'byte3 byte2 nybble2 nybble1
'
Screen 640, 480, 1
Font= LoadFont "courier",24
SetSmoothMode 4
sys anzahl =1000, color, single aSpeed
sys xscreen =640, yscreen =480, i
sys xmitte = xscreen/2, ymitte = yscreen/2
Dim x(1000) as single
Dim y(1000) as single
Dim winkel(1000) as single
Dim speed(1000) as single
Dim sinus(360) as single
Dim cosinus(360) as single
for i=1 to anzahl
x(i) = xmitte
y(i) = ymitte
winkel(i)= Rand(1,360)
speed(i) = Rand(1,3)
next
for i=0 to 360
sinus(i) = sin(rad(i))
cosinus(i)= cos(rad(i))
next
Function xMove(single x,winkel,speed) as single
return x + Cosinus(winkel)*speed
End Function
Function yMove(single y,winkel,speed) as single
return y + Sinus(winkel)*speed
End Function
Function Distance(single x1,y1,x2,y2) as single
sys dx, dy
dx = x1-x2: dy = y1-y2
return abs(sqr(dx*dx+dy*dy))
End Function
SetCaption "AVATAR"
'
midiOutShortMsg(hMidi, 0x7f0090)
midiOutShortMsg(hMidi, 0x702890)
midiOutShortMsg(hMidi, 0x700091)
midiOutShortMsg(hMidi, 0x600892)
midiOutShortMsg(hMidi, 0x203292)
'PlayWav "cosmobumm.wav"
While Key(27)=0
ClsColor 255,2,2,2
for i=0 to anzahl
aSpeed = Distance (xmitte, ymitte, x(i), y(i)) /200 * speed(i)+1
x(i) = xMove(x(i), winkel(i), aSpeed)
y(i) = yMove(y(i), winkel(i), aSpeed)
if x(i) < 0 Or x(i) > xscreen Or y(i) < 0 Or y(i) > yscreen
x(i) = xmitte
y(i) = ymitte
winkel(i)= Rand(1,360)
speed(i) = Rand(1,3)
end if
color = speed(i)*100 - 55
FillOval x(i), y(i), 24,24, ARGB(55,color, color, color)
next
xmitte = xMouse
ymitte = yMouse
Flip
SetFps 90
Wend
midiOutClose(hMidi)
Ends