2017-09-06 11:05:19 +03:00
|
|
|
(use IO)
|
|
|
|
(use String)
|
|
|
|
(use Int)
|
2017-06-26 12:15:03 +03:00
|
|
|
|
|
|
|
(deftype Vec2
|
|
|
|
[x Int
|
|
|
|
y Int])
|
|
|
|
|
|
|
|
(defmodule Vec2
|
|
|
|
(defn str [v]
|
|
|
|
(append
|
2017-09-07 19:55:43 +03:00
|
|
|
(append @"x: " (Int.str (Vec2.x v)))
|
|
|
|
(append @", y: " (Int.str (Vec2.y v)))))
|
2017-06-26 12:15:03 +03:00
|
|
|
(defn basic [] (Vec2.init 10 20)))
|
|
|
|
|
|
|
|
(defmodule Advanced
|
|
|
|
(deftype Mat4 [x Int]))
|
|
|
|
|
|
|
|
(defn main []
|
|
|
|
(let [v (ref (Vec2.basic))]
|
|
|
|
(do
|
|
|
|
(println (ref (Vec2.str v)))
|
|
|
|
(println (ref (str (Advanced.Mat4.x
|
|
|
|
(ref (Advanced.Mat4.set-x
|
|
|
|
(Advanced.Mat4.init 100)
|
|
|
|
200)))))))))
|
|
|
|
|
|
|
|
(build)
|
|
|
|
(run)
|
2017-09-08 13:24:57 +03:00
|
|
|
(quit)
|