Added :d to mouse shapes
This commit is contained in:
16
examples/projects/spire.lisp
Normal file
16
examples/projects/spire.lisp
Normal file
@@ -0,0 +1,16 @@
|
||||
; this demo shows how to use the mouse events to draw make a simple drawing tool.
|
||||
;
|
||||
(clear)
|
||||
;
|
||||
(def gradient-line
|
||||
(line frame-rect:c 0 frame-rect:c frame-rect:h))
|
||||
;
|
||||
(defn draw-circle
|
||||
(e)
|
||||
(
|
||||
(stroke
|
||||
(circle e:x e:y e:d) 1
|
||||
(gradient gradient-line
|
||||
("black" "#ffb545")))))
|
||||
;
|
||||
(on "mouse-move" draw-circle)
|
||||
@@ -1,37 +0,0 @@
|
||||
; this demo shows how to use the mouse events to draw make a simple drawing tool.
|
||||
;
|
||||
(clear)
|
||||
;
|
||||
(def prev-pos {:x 0 :y 0})
|
||||
;
|
||||
(defn stroke-color
|
||||
(e)
|
||||
(if
|
||||
(eq e:is-down true) "#ffb545" "#72dec2"))
|
||||
;
|
||||
(defn draw-line
|
||||
(e)
|
||||
(
|
||||
(if
|
||||
(eq e:is-down true)
|
||||
(
|
||||
(debug e:is-down)
|
||||
(stroke
|
||||
(line prev-pos:x prev-pos:y e:x e:y) 2 "white")
|
||||
(set prev-pos "x" e:x "y" e:y)
|
||||
(debug prev-pos)
|
||||
(debug e)))))
|
||||
;
|
||||
(defn draw-circle
|
||||
(e)
|
||||
(
|
||||
(debug e)
|
||||
(set prev-pos "x" e:x "y" e:y)
|
||||
(debug e:x)
|
||||
(stroke
|
||||
(circle e:x e:y 10) 4
|
||||
(stroke-color e))))
|
||||
;
|
||||
(on "mouse-down" draw-circle)
|
||||
(on "mouse-up" draw-circle)
|
||||
(on "mouse-move" draw-line)
|
||||
Reference in New Issue
Block a user