Tile is easy.
I still cant seem to get it looking right though, which has to be something to do with my sin cos maths. so anyone got any ideas ?
; Plasma Test ; ; Yavin ; ; Teamrebellion.co.uk ; Const gfx_width=640 Const gfx_height=480 Graphics 640,480,16,0 SetBuffer BackBuffer() Cls Const size=100 Global temp_image temp_image=CreateImage(size,size) Global display_image display_image=CreateImage(gfx_width,gfx_height) Global counter% counter=1 Dim pos(size,size) Dim lCos(360) For looper=1 To 360 lcos(looper)=Cos(looper) Next While Not KeyHit(1) Cls draw_plasma() render_screen() For x=0 To gfx_width Step 198 For y=0 To gfx_height Step 198 DrawImage display_image,x,y Next Next Flip Wend Function render_screen() DrawImage temp_image,0,0 flip_vert() DrawImage temp_image,99,0 flip_vert() flip_hor() DrawImage temp_image,0,99 flip_vert() DrawImage temp_image,99,99 CopyRect 0,0,200,200,0,0,BackBuffer(),ImageBuffer(display_image) End Function Function flip_vert() SetBuffer ImageBuffer(temp_image) LockBuffer For x=1 To ImageWidth(temp_image) For y=1 To ImageHeight(temp_image) pos(x,y)=ReadPixelFast(x,y,ImageBuffer(temp_image)) Next Next For x=ImageWidth(temp_image) To 1 Step -1 For y=ImageHeight(temp_image) To 1 Step -1 WritePixelFast(x,y,pos(ImageWidth(temp_image)-x,y),ImageBuffer(temp_image)) Next Next UnlockBuffer SetBuffer BackBuffer() End Function Function flip_hor() SetBuffer ImageBuffer(temp_image) LockBuffer For x=1 To ImageWidth(temp_image) For y=1 To ImageHeight(temp_image) pos(x,y)=ReadPixelFast(x,y,ImageBuffer(temp_image)) Next Next For x=ImageWidth(temp_image) To 1 Step -1 For y=ImageHeight(temp_image) To 1 Step -1 WritePixelFast(x,y,pos(x,ImageHeight(temp_image)-y),ImageBuffer(temp_image)) Next Next UnlockBuffer SetBuffer BackBuffer() End Function Function draw_plasma() ;LOCAL VARS Local argb Local NewBuffer = ImageBuffer(temp_image) LockBuffer NewBuffer For looper=1 To size For inner=1 To size Local r%,g%,a,b,c a= -Cos(looper) * inner b= Cos(looper) * inner c= -Cos(looper) * inner a= a + Sin(inner) * looper b= b - Sin(inner) * looper c= c + Sin(inner) * looper a=a+counter b=b+counter c=c+counter Color a,b,c ;Plot looper,inner argb=(c Or (b Shl 8) Or (a Shl 16) Or ($ff000000)) ;Rect looper,inner,1,1,1 WritePixelFast looper,inner, argb, NewBuffer Next Next UnlockBuffer NewBuffer ;SaveBuffer (BackBuffer(),"test.bmp") counter=counter+2:If counter=>1000 Then counter=0 End Function
I still cant seem to get it looking right though, which has to be something to do with my sin cos maths. so anyone got any ideas ?