-
Notifications
You must be signed in to change notification settings - Fork 0
/
gradients.mar
42 lines (38 loc) · 1.2 KB
/
gradients.mar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import ui.mar
fun main(): Never {
var texture = screen_texture()
var patterns = list(
16#001122,
16#110022,
16#112200,
16#220011,
16#221100,
16#ff1122,
16#11ff22,
16#1122ff,
16#22ff11,
16#2211ff,
)
var enters = 0
println("Before loop")
loop {
var pattern = patterns.get(enters % patterns.len)
var rpattern = pattern & 16#ff0000 >> 16
var gpattern = pattern & 16#00ff00 >> 8
var bpattern = pattern & 16#0000ff
for x in 0..texture.width do
for y in 0..texture.height do {
var xcomponent = x * 255 / texture.width
var ycomponent = y * 255 / texture.height
var color = color(
if rpattern == 16#11 then xcomponent else if rpattern == 16#22 then ycomponent else rpattern.lower_byte().to_int(),
if gpattern == 16#11 then xcomponent else if gpattern == 16#22 then ycomponent else gpattern.lower_byte().to_int(),
if bpattern == 16#11 then xcomponent else if bpattern == 16#22 then ycomponent else bpattern.lower_byte().to_int(),
)
texture.&.draw(x @ y, color)
if get_pressed_key() is some(key) then if key is enter then enters.& += 1
}
texture.show()
}
exit(0)
}