Skip to content

Commit

Permalink
[#15] Random function
Browse files Browse the repository at this point in the history
  • Loading branch information
jfacorro committed Nov 24, 2018
1 parent c8317f6 commit ff4ad2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/doodler/core.clje
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
(let [brush (wxDC/getBackground *canvas*)]
(wxBrush/setColour brush (apply color args))
(wxDC/setBackground *canvas* brush)
(wxDC/clear *canvas*)))
(clear)))

(defn fill
[& args]
Expand All @@ -79,6 +79,12 @@
[x y]
(wxDC/drawPoint *canvas* (tuple x y)))

(defn random
([max]
(dec (rand/uniform max)))
([min max]
(+ min (dec (rand/uniform max)))))

(defn rect
([x y w h]
(wxDC/drawRectangle *canvas* #erl[x y] #erl[w h]))
Expand Down
5 changes: 3 additions & 2 deletions src/doodler/sketch.clje
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,10 @@
:on-close on-close-fn}
;; Create bitmap after frame is visible to
;; get the right dimensions
(let [bitmap (make-bitmap canvas)]
(let [bitmap (make-bitmap canvas)
bitmap-dc (wxMemoryDC/new bitmap)]
{:bitmap bitmap
:bitmap-dc (wxMemoryDC/new bitmap)}))))
:bitmap-dc bitmap-dc}))))

;; Events

Expand Down

0 comments on commit ff4ad2b

Please sign in to comment.