Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Munching-squares/PureBasic/munching-squares.basic
Normal file
26
Task/Munching-squares/PureBasic/munching-squares.basic
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#palletteSize = 128
|
||||
Procedure.f XorPattern(x, y) ;compute the gradient value from the pixel values
|
||||
Protected result = x ! y
|
||||
ProcedureReturn Mod(result, #palletteSize) / #palletteSize
|
||||
EndProcedure
|
||||
|
||||
Procedure drawPattern()
|
||||
StartDrawing(ImageOutput(0))
|
||||
DrawingMode(#PB_2DDrawing_Gradient)
|
||||
CustomGradient(@XorPattern())
|
||||
;specify a gradient pallette from which only specific indexes will be used
|
||||
For i = 1 To #palletteSize
|
||||
GradientColor(1 / i, i * $BACE9B) ; or alternatively use $BEEFDEAD
|
||||
Next
|
||||
Box(0, 0, ImageWidth(0), ImageHeight(0))
|
||||
StopDrawing()
|
||||
EndProcedure
|
||||
|
||||
If OpenWindow(0, 0, 0, 128, 128, "XOR Pattern", #PB_Window_SystemMenu)
|
||||
CreateImage(0, WindowWidth(0), WindowHeight(0))
|
||||
drawPattern()
|
||||
ImageGadget(0, 0, 0, ImageWidth(0), ImageHeight(0), ImageID(0))
|
||||
Repeat
|
||||
event = WaitWindowEvent(20)
|
||||
Until event = #PB_Event_CloseWindow
|
||||
EndIf
|
||||
Loading…
Add table
Add a link
Reference in a new issue