Skip to content

Commit

Permalink
Add support for on present.
Browse files Browse the repository at this point in the history
  • Loading branch information
phronmophobic committed Nov 6, 2024
1 parent 5d6f31c commit 133670c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/membrane/java2d.clj
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,9 @@
(.setColor ^Graphics2D *g* Color/white)
(.fillRect ^Graphics2D *g* 0 0 (.getWidth ^Component this) (.getHeight ^Component this))
(.setColor ^Graphics2D *g* Color/black)
(draw to-render)))))))
(draw to-render)
(when-let [on-present (::on-present window)]
(on-present to-render))))))))



Expand Down Expand Up @@ -1062,9 +1064,11 @@
view-fn
(fn [_]
(view-fn)))
window {:panel (atom nil)
:ui (atom nil)
:render view-fn}
window (merge
{:panel (atom nil)
:ui (atom nil)
:render view-fn}
(select-keys options [::on-present]))
panel (doto ^Component (make-panel window)
(.setFocusable true))
_ (reset! (:panel window)
Expand Down
6 changes: 5 additions & 1 deletion src/membrane/skia.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2537,7 +2537,11 @@
(Skia/skia_clear skia-resource)
(draw view)
(Skia/skia_flush skia-resource)
(glfw-call Void/TYPE glfwSwapBuffers window))))))

(glfw-call Void/TYPE glfwSwapBuffers window)

(when-let [on-present (::on-present this)]
(on-present view)))))))

(defonce window-chan (chan 1))

Expand Down

0 comments on commit 133670c

Please sign in to comment.