Image noise: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Replace with a working version) |
(added FreeBASIC) |
||
Line 1,036: | Line 1,036: | ||
{ { title "Black and White noise" } } |
{ { title "Black and White noise" } } |
||
<bw-noise-gadget> with-fps >>gadgets ;</lang> |
<bw-noise-gadget> with-fps >>gadgets ;</lang> |
||
=={{header|FreeBASIC}}== |
|||
<lang freebasic>' version 13-07-2018 |
|||
' compile with: fbc -s console |
|||
' or: fbc -s gui |
|||
' hit any to key to stop program |
|||
Randomize Timer |
|||
Screen 13 |
|||
If ScreenPtr = 0 Then |
|||
Print "Error setting video mode!" |
|||
End |
|||
End If |
|||
Palette 0, 0 ' black |
|||
Palette 1, RGB(255, 255, 255) ' white |
|||
Dim As UInteger c, x, y, Col |
|||
Dim As Double fps, t = Timer |
|||
' empty keyboard buffer |
|||
While InKey <> "" : Wend |
|||
While InKey = "" |
|||
For x = 0 To 319 |
|||
For y = 0 To 199 |
|||
' color is as integer, a float gets rounded off by FreeBASIC |
|||
PSet(x, y), Rnd |
|||
Next |
|||
Next |
|||
c += 1 |
|||
fps = c / (Timer - t) |
|||
WindowTitle "fps = " + Str(fps) |
|||
Wend</lang> |
|||
=={{header|Go}}== |
=={{header|Go}}== |