2018-10-01 01:01:39 +02:00
|
|
|
%option enable_floats
|
|
|
|
|
|
|
|
~ main {
|
|
|
|
|
2018-10-02 22:52:05 +02:00
|
|
|
const word width = 320
|
|
|
|
const word height = 200
|
|
|
|
|
2018-10-01 01:01:39 +02:00
|
|
|
sub start() {
|
|
|
|
|
|
|
|
_vm_gfx_clearscr(0)
|
2018-10-03 01:11:28 +02:00
|
|
|
_vm_gfx_text(2, 2, 7, "Swirl !!!")
|
2018-10-01 01:01:39 +02:00
|
|
|
|
|
|
|
float x
|
|
|
|
float y
|
|
|
|
float t
|
|
|
|
byte color
|
|
|
|
|
|
|
|
while(1) {
|
2018-10-02 22:52:05 +02:00
|
|
|
x = sin(t*1.01) + cos(t*1.1234)
|
|
|
|
y = cos(t) + sin(t*0.03456)
|
|
|
|
_vm_gfx_pixel(screenx(x), screeny(y), color//16)
|
2018-10-01 01:01:39 +02:00
|
|
|
t += 0.01
|
|
|
|
color++
|
|
|
|
}
|
|
|
|
}
|
2018-10-02 22:52:05 +02:00
|
|
|
|
|
|
|
sub screenx(x: float) -> word {
|
|
|
|
return floor(x * width/4.1) + width // 2
|
|
|
|
}
|
|
|
|
sub screeny(y: float) -> word {
|
|
|
|
return floor(y * height/4.1) + height // 2
|
|
|
|
}
|
2018-10-01 01:01:39 +02:00
|
|
|
}
|