Skip to content

Commit

Permalink
[#15] Remove the :refresh flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jfacorro committed Nov 29, 2018
1 parent 47cc0a3 commit d253238
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/doodler/sketch.clje
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
[sketch]
(wxWindow/refresh (:canvas sketch)
#erl(#erl[:eraseBackground false]))
(assoc sketch :refresh true))
sketch)

(defn calculate-frame-rate
[current-frame-rate time-mark p-time-mark]
Expand All @@ -130,22 +130,20 @@
:current-frame-rate (calculate-frame-rate current-frame-rate
time-mark
p-time-mark)
:refresh false
:p-time-mark p-time-mark
:time-mark time-mark
:frame-delay delay
:frame-count (inc (sketch :frame-count)))))

(defn on-paint
[sketch]
[{bitmap :bitmap canvas :canvas pid :pid}]
(doodler.wx/batch
#(let [bitmap (:bitmap sketch)
dc (wxPaintDC/new (:canvas sketch))]
#(let [dc (wxPaintDC/new canvas)]
(try
(wxDC/drawBitmap dc bitmap #erl[0 0])
(finally
(wxPaintDC/destroy dc)))))
(u/send-message (:pid sketch) #erl[:draw (u/time-mark)]))
(u/send-message pid #erl[:draw (u/time-mark)]))

(defn on-draw
[sketch f]
Expand Down Expand Up @@ -282,12 +280,10 @@
refresh
u/noreply))
([#erl[:draw time-mark] sketch]
(if (:refresh sketch)
(-> sketch
(on-draw (:draw-fn sketch))
(next-refresh time-mark)
u/noreply)
(u/noreply sketch)))
(-> sketch
(on-draw (:draw-fn sketch))
(next-refresh time-mark)
u/noreply))
([wx sketch]
(u/noreply sketch)))

Expand Down

0 comments on commit d253238

Please sign in to comment.