Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

New version of IonicWind Basic just released.

GWS01GWS01 Posts: 10Member
IWBasic now has a shiny new version available, with more power than ever.

You can read about it here:

http://www.ionicwind.com/iwbasic.html

This Basic has a long pedigree, stretching back to IBasic Pro some years ago.

Free documentation in pdf form(nearly 800 pages), and ebook form, is available for download.

I'll give up trying to upload an example - it doesn't seem to upload properly.

Here's the source code instead ..

[code]
' Morphing Dots
' now in Ionic Wind IWBasic 2 - March 2011 ..
' adapted for color by GWS

DEF n,cnt,object,x3d,y3d,z3d,t,q,nx,ny,speed:INT
DEF vx,sinvx,cosvx,vy,sinvy,cosvy,vz,sinvz,cosvz,tx,ty,tz,ox:FLOAT

int rc,gc,bc,run
float c

Declare "user32", ShowCursor(flag:int),int
Declare "kernel32", Sleep(Milliseconds:int)

CONST numdots=30000
CONST numobjs=20
CONST distance=400
CONST ESC = &H1B
CONST scrnw = 1024
CONST scrnh = 768
CONST xhalf = scrnw/2
CONST yhalf = scrnh/2

DEF points[numdots+1,4],tpoint[numdots+1,4]:INT

object=1
cnt=0

IF CREATESCREEN(scrnw,scrnh,32,&WinProc) < 0
MESSAGEBOX 0,"Unable to create DirectX screen!","Error!"
END
ENDIF

' turn cursor off ..
ShowCursor(0)

Run=1

Do
cnt=cnt+1
If cnt>299
' added to change color for each object
rc = rnd(255)
gc = rnd(255)
bc = rnd(255)
object=object+1
if object>numobjs
object=1
endif
getobject(object)
cnt=0
EndIf

morphing()
threed()
FRONTPEN BackBuffer,RGB(0,100,255)
DRAWMODE BackBuffer,@TRANSPARENT
WRITETEXT 420,30, "IWBasic - Morphing Dots"
WRITETEXT 440,730, "Press Esc to Exit"
if object = 1 then WRITETEXT 435,400, "Generating Objects"
speed = FLIP 1
if object>1 then sleep(20)
FILLSCREEN 0

Until run=0

closescreen
END

SUB WinProc
SELECT @CLASS
CASE @IDCLOSEWINDOW
Run = 0
CASE @IDCHAR
IF @CODE = ESC
Run = 0
ENDIF
ENDSELECT
RETURN
ENDSUB

SUB threed()
vx=vx+0.05
vy=vy+0.05
vz=vz+0.05
sinvx=sin(vx)
cosvx=cos(vx)
sinvy=sin(vy)
cosvy=cos(vy)
sinvz=sin(vz)
cosvz=cos(vz)
Lockbuffer
For n=1 To numdots
x3d=tpoint[n,1]
y3d=tpoint[n,2]
z3d=tpoint[n,3]
ty=y3d*cosvx-z3d*sinvx
tz=y3d*sinvx+z3d*cosvx
tx=x3d*cosvy-tz*sinvy
tz=x3d*sinvy+tz*cosvy
ox=tx
tx=tx*cosvz-ty*sinvz
ty=ox*sinvz+ty*cosvz
nx=scrnh*tx/(distance-tz)+xhalf
ny=yhalf-scrnh*ty/(distance-tz)
' changed to vary color with depth
if tz>rnd(100)
c = tz/30
else
c = 1.0
endif
WRITEPIXEL(nx,ny, RGB(rc*c,gc*c,bc*c))
Next n
Unlockbuffer
return
ENDSUB

SUB getobject(obj:int)
Select obj

Case 1
For t=1 To numdots-1
points[t,1]=(RAND(1800)-900)/10*t/numdots
points[t,2]=(RAND(1800)-900)/10*t/numdots
points[t,3]=(RAND(1800)-900)/10*t/numdots
Next t
Case 2
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(t*360/numdots)*100
points[t,2]=Cos(xd)*Sin(t*360/numdots)*100
points[t,3]=Sin(xd)*100
Next t
Case 3
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(t*360/numdots)*100
points[t,2]=Cos(xd)*Sin(t*360/numdots)*100
points[t,3]=Sin(t*360/numdots)* 100
Next t
Case 4
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Sin(t*360/numdots)*Cos(t*360/numdots)*100
points[t,2]=Cos(xd)*Cos(t*360/numdots)*100
points[t,3]=Sin(t*360/numdots)*100
Next t
Case 5
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(xd)*100
points[t,2]=Cos(xd)*Sin(xd)*100
points[t,3]=Sin(t*360/numdots)*100
Next t
Case 6
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(xd)*100
points[t,2]=Cos(t*360/numdots)*Sin(xd)*100
points[t,3]=Sin(t*360/numdots)*100
Next t
Case 7
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(t*360/numdots)*Cos(t*360/numdots)*100
points[t,2]=Cos(t*360/numdots)*Sin(xd)*100
points[t,3]=Sin(t*360/numdots)*100
Next t
Case 8
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(t*360/numdots)*100
points[t,2]=Cos(xd)*Sin(t*360/numdots)*100
points[t,3]=Sin(xd)*Sin(t*360/numdots)*100
Next t
Case 9
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Sin(t*360/numdots)*Cos(t*360/numdots)*Sin(xd)*100
points[t,2]=Cos(t*360/numdots)*Sin(xd)*Cos(xd)*100
points[t,3]=Sin(xd)*Cos(t*360/numdots)*100
Next t
Case 10
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(t*360/numdots)*100
points[t,2]=Cos(t*360/numdots)*Sin(xd)*100
points[t,3]=Cos(xd)*Sin(xd)*100
Next t
Case 11
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(t*360/numdots)*Cos(xd)*100
points[t,2]=Cos(xd)*Sin(xd)*100
points[t,3]=Sin(xd)*100
Next t
Case 12
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(t*360/numdots)*100
points[t,2]=Sin(xd)*Sin(t*360/numdots)*100
points[t,3]=Sin(xd)*100
Next t
Case 13
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(t*360/numdots)*Cos(xd)*100
points[t,2]=Sin(t*360/numdots)*Sin(xd)*100
points[t,3]=Sin(t*360/numdots)*Sin(xd)*Cos(t*360/numdots)*Cos(xd)*200
Next t
Case 14
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(xd)*100
points[t,2]=Sin(t*360/numdots)*Sin(xd)*100
points[t,3]=Sin(t*360/numdots)*100
Next t
Case 15
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Sin(xd)*Cos(xd)*100
points[t,2]=Sin(xd)*Sin(t*360/numdots)*100
points[t,3]=Sin(t*360/numdots)*100
Next t
Case 16
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(t*360/numdots)*100
points[t,2]=Cos(t*360/numdots)*Sin(t*360/numdots)*100
points[t,3]=Sin(xd)*Cos(t*360/numdots)*100
Next t
Case 17
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(t*360/numdots)*Sin(t*360/numdots)*100
points[t,2]=Sin(t*360/numdots)*Sin(xd)*Cos(t*360/numdots)*100
points[t,3]=Sin(xd)*Cos(t*360/numdots)*100
Next t
Case 18
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Cos(xd)*100
points[t,2]=Cos(t*360/numdots)*Sin(t*360/numdots)*100
points[t,3]=Sin(t*360/numdots)*100
Next t
Case 19
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Cos(xd)*Sin(t*360/numdots)*100
points[t,2]=Cos(xd)*Cos(t*360/numdots)*100
points[t,3]=Cos(xd)*100
Next t
Case 20
For t=1 To numdots
xd=RAND(1800)
points[t,1]=Sin(xd)*Cos(xd)*Sin(t*360/numdots)*200
points[t,2]=Sin(t*360/numdots)*Cos(t*360/numdots)*Sin(xd)*200
points[t,3]=Sin(t*360/numdots)*Cos(xd)*Cos(t*360/numdots)*200
Next t
EndSelect

return
ENDSUB

SUB morphing()
For t=1 To numdots
For q=1 To 3
If points[t,q]>tpoint[t,q]
tpoint[t,q]=tpoint[t,q]+1
Endif
IF points[t,q]<tpoint[t,q]
tpoint[t,q]=tpoint[t,q]-1
Endif
Next q
Next t
return
ENDSUB
[/code]

If you download the trial version you can try it out ..

all the best,

Graham


Sign In or Register to comment.