Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
32
Task/Image-noise/Wren/image-noise.wren
Normal file
32
Task/Image-noise/Wren/image-noise.wren
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import "dome" for Window
|
||||
import "graphics" for Canvas, Color
|
||||
import "random" for Random
|
||||
|
||||
class Game {
|
||||
static init() {
|
||||
Window.title = "Image Noise"
|
||||
__w = 320
|
||||
__h = 240
|
||||
Window.resize(__w, __h)
|
||||
Canvas.resize(__w, __h)
|
||||
__r = Random.new()
|
||||
__t = System.clock
|
||||
}
|
||||
|
||||
static update() {}
|
||||
|
||||
static draw(dt) {
|
||||
Canvas.cls() // default background is black
|
||||
for (x in 0...__w) {
|
||||
for (y in 0...__h) {
|
||||
if (__r.int(2) == 0) {
|
||||
Canvas.pset(x, y, Color.white)
|
||||
}
|
||||
}
|
||||
}
|
||||
var t = System.clock
|
||||
var fps = (1/(t - __t)).round
|
||||
Canvas.print("FPS: %(fps)", 10, 10, Color.red)
|
||||
__t = t
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue