Bleep
 Guru
 Joined: 09/01/2022 Location: United KingdomPosts: 795 |
| Posted: 11:54am 22 Nov 2022 |
|
|
|
Hi Volhout, Yes I like the way you've got the colours working with a limited set. :-) You could of course, make use of the framebuffer on the VGA, which means you can get rid of all the array saving and copying, which only saves a surprisingly small amount of time, but it does mean you can increase the number of pixies to 2600, for approx the same refresh rate, I've reduced the pixi size as well, because I thought it looked a bit better, your choice, also if you want the faster update, or more points? just change the loop step back to 5 amazingly, there is almost no difference between drawing a small box 1x1 or 2x2 or even 10x10 rather than using the pixel command? Regards, Kevin.
' Bubble Universe MODE 2 Dim Float u,a,p,q,t,v=0, x=0 Dim Integer g,b,i,j,c(51),d(51),e(51),n(51) 'Dim Integer f(51,51),l(51,51),m(51,51) Dim Integer m(41,51) Const w=MM.HRes/2, h=MM.VRes/2 Const r=(2*Pi)/235, o=h/2 CLS RGB(black)':Backlight 95 t=Rnd*10:Math set 1,e()'Math set 3,e() FRAMEBUFFER create FRAMEBUFFER write f
For g=0 To 41 For b=0 To 51 m(g,b)=RGB(g*6,b*5,128*(g+b>30)*(g+b<60)) If g<26 And b<13 Then m(g,b)=RGB(0,128,0) Next :Next
Do CLS Inc t,0.025:g=0:Timer =0 For i=50 To 255 Step 5 b=0:a=r*i 'Math Slice f(),g,,c() 'Math Slice l(),g,,d() 'Box c(),d(),e(),e(),0,,0 'Pixel c(),d(),0 For j=50 To 255 Step 4 p=i+v:q=a+x u=Sin(p)+Sin(q):v=Cos(p)+Cos(q) x=u+t:c(b)=w+u*o:d(b)=h+v*o Inc b Next Math Slice m(),g,,n() Box c(),d(),e(),e(),0,,n() 'Pixel c(),d(),n() 'Math Insert f(),g,,c() 'Math Insert l(),g,,d() Inc g Next i FRAMEBUFFER copy f,n Print Timer Loop
PS. just noticed that a subset of the pixels were being coloured black, so I've forced them to be mid green. Edited 2022-11-22 23:32 by Bleep |