-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.ark
30 lines (24 loc) · 901 Bytes
/
test.ark
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
(import "sf.arkm")
(sf:window:init 640 480 "ArkSFML test")
(sf:window:setFPS 60)
(let font (sf:load:font "Arial.ttf"))
(let text (sf:text:make font "hello" 24 [255 255 255]))
(let start (time))
(while (sf:window:open?)
{
(mut event (sf:pollEvent))
(if (or (= event (sf:event "keyup" "escape")) (= event (sf:event "quit")))
(sf:window:close))
(mut current_time (- (time) start))
(sf:text:setColor text [
(+ 128 (* 127 (math:sin (+ 0 (* 0.8 current_time)))))
(+ 128 (* 127 (math:sin (+ 2 (* 0.8 current_time)))))
(+ 128 (* 127 (math:sin (+ 4 (* 0.8 current_time)))))
])
(sf:set:pos text
(+ 320 (* 260 (math:cos (* 0.5 current_time))))
(+ 240 (* 200 (math:sin (* 0.5 current_time)))))
(sf:window:clear 0 0 0)
(sf:draw text)
(sf:window:display)
})