-3

我是Clojure新手,想在屏幕上画线和圆,而且应该是抗锯齿的,怎么做?如果有人可以将一些示例代码粘贴给我?

另一个问题,我定义了一个地图:

(def {:a 1, :b 2, :c 3}, i try to change it to be {:a 1, :b 99, :c 3},

怎么做?

4

1 回答 1

1

看看奎尔。 https://github.com/quil/quil

它基于 Processing http://processing.org并且很容易上手。

我认为这可以满足您的需求...改编自示例:

(ns foo
  (:use quil.core))

(defn setup []
  (smooth)                          ;;Turn on anti-aliasing
  (frame-rate 10)                    ;;Set framerate to 10 FPS
  (background 200))                 ;;Set the background colour to
                                    ;;  a nice shade of grey.
(defn draw []
  (stroke 0)              ;;Set the stroke colour to a black
  (stroke-weight 3)       ;;Set the stroke thickness to 3
  (line 10 10 50 50)
  (line 20 20 100 50))

(defsketch example                  ;;Define a new sketch named example
  :title "foo"  ;;Set the title of the sketch
  :setup setup                      ;;Specify the setup fn
  :draw draw                        ;;Specify the draw fn
  :size [323 200])
于 2012-09-20T04:20:47.567 回答