Dark Bit Factory & Gravity
PROGRAMMING => Purebasic => Topic started by: AmigaJoker on April 20, 2015
-
Hi there,
I'm looking for the great Fractal Cracktro by Prestige ...
https://www.youtube.com/watch?v=_Bsr5a4tKkg :updance:
Is this possible in PureBasic?
-
Don't see why it shouldn't be possible. ^^
-
xres=512
yres=512
pieceSize.i=32
rotation.i=1
zoom.i=-1
OpenWindow(0, 0, 0, xres, yres, "CZ", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
hBMP.l=CreateImage(0, xres, yres)
hBMP2.l=CreateImage(1,18*18*32,32)
hdc1=GetDC_(WindowID(0))
;hBMP2.l=CreateCompatibleBitmap_(hdc1,18*18*32,32)
hdc2=CreateCompatibleDC_(hdc1);GetDC_(WindowID(0));
StartDrawing(ImageOutput(0))
For x=0 To xres-1
For y=0 To yres-1
a=(x!y)&255
Plot (x,y,RGB(a,a,a))
Next y
Next x
StopDrawing()
ImageGadget(5, 0, 0, xres, yres, ImageID(0))
p.i=0
shift.i=0;
x0=255+30+1
y0=255+45+2
Repeat
a=Random(255)
b=Random(255)
c=Random(255)
; For (var y = 0; y < 2; y ++) {
; For (var x = 0; x < 2; x ++) {
; putRandomPixel(
; 286 + x - (rotation < 0 ? 16 : 0),
; 302 + y - (rotation < 0 ? 16 : 0)
; );
; }
;}
For dy=-2 To 2
For dx=-2 To 2
SetPixel_(hdc1,x0+dx,y0+dy,RGB(a,c,b))
Next dx
Next dy
shift=0;
p=p+1;
p=p&7;
For i.i=0 To 4
shift=shift <<1;shl
shift=shift | ((p >>i)&1);shift:=shift Or ((p shr i) And 1);
Next i
bpos.i=0
SelectObject_(hdc2,hbmp2)
For y.i=0 To 16
For x.i=0 To 16
BitBlt_(hdc2,bpos,0,32,32,hdc1, x * pieceSize + shift + (16 - y) * rotation + x * zoom, y * pieceSize + shift + x * rotation - (16 - y) * zoom, #SRCCOPY)
;hDestDC,x,y,nWidth,nHeight,hSrcDC,xSrc,ySrc,dwRop
bpos=bpos+32
Next x
Next y
SelectObject_(hdc1,hbmp2)
bpos=0;bpos-32
For y.i=0 To 16
For x.i=0 To 16
BitBlt_(hdc1,x * pieceSize + shift + 8 * rotation + 8 * zoom, y * pieceSize + shift + 8 * rotation - 8 * zoom, 32, 32,hdc2, bpos, 0, #SRCCOPY)
;hDestDC,x,y,nWidth,nHeight,hSrcDC,xSrc,ySrc,dwRop
bpos=bpos+32
Next x
Next y
Until WindowEvent() = #PB_Event_CloseWindow
;Goto MyLoop
-
Hi @emook: Thank you. Is the complete intro available? :D
-
Sorry, I collected this code a while back and when you asked I knew I had the source that did the effect so posted :)
-
@ emook: Ok, thank you - maybe some other one have the complete source code ;)