Code: Select all
DisableDebugger
InitSprite()
InitKeyboard()
ExamineDesktops()
OpenScreen(DesktopWidth(0), DesktopHeight(0), 32, "")
CreateSprite(0, ScreenWidth() / 4, ScreenHeight() / 4)
Procedure drawAdditivePixel(xArea, yArea, wArea, hArea, ci)
x = xArea + Random(wArea - 1)
y = yArea + Random(hArea - 1)
pc = ci & $FFFFFFFF
nc = ci >> 32 & $FFFFFFFF
ic = Point(x, y)
r = Red(ic)
g = Green(ic)
b = Blue(ic)
pr = Red(pc)
pg = Green(pc)
pb = Blue(pc)
nr = Red(nc)
ng = Green(nc)
nb = Blue(nc)
r + pr - nr
g + pg - ng
b + pb - nb
If r > 255: r = 0: EndIf
If g > 255: g = 0: EndIf
If b > 255: b = 0: EndIf
If r < 0: r = 0: EndIf
If g < 0: g = 0: EndIf
If b < 0: b = 0: EndIf
c = RGB(r, g, b)
delta0 = 1
delta1 = 2
LineXY(x - delta0*2, y - delta0, x, y, c)
LineXY(x, y, x + delta0, y - delta0, c)
LineXY(x, y - delta1, x, y, c)
EndProcedure
Procedure drawBox(x, y, w, h, c)
Box(x, y, w, h, c)
EndProcedure
Procedure updateFloor(sprite, *draw, xScale.D, yScale.D, wScale.D, hScale.D, c, times = 1)
If StartDrawing(SpriteOutput(sprite) )
x.I = Int(OutputWidth() * xScale)
y.I = Int(OutputHeight() * yScale)
w.I = Int(OutputWidth() * wScale)
h.I = Int(OutputHeight() * hScale)
For i = 1 To times
CallFunctionFast(*draw, x, y, w, h, c)
Next
StopDrawing()
EndIf
EndProcedure
updateFloor(0, @drawBox(), 0.0, 0.0, 1.0, 1.0, RGB($FF, $FF, $00) )
updateFloor(0, @drawAdditivePixel(), 0.0, 0.0, 1.0, 1.0, RGB(2, 0, 1) << 32 | RGB(8, 8, 8), 1 << 15)
ZoomSprite(0, ScreenWidth(), ScreenHeight() )
SpriteQuality(1)
Repeat
Delay(2)
ClearScreen(0)
ExamineKeyboard()
updateFloor(0, @drawAdditivePixel(), 0.0, 0.0, 1.0, 1.0, RGB(0, 0, 0) << 32 | RGB(1, 1, 1), 1 << 15)
DisplaySprite(0, 0, 0)
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)