HumbleUI / HumbleUI/JWM

How do I use this from a repl?

Open
#168 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
643
Forks
51
PR merge metrics
No merged PRs in 30d

Description

I'm trying to use this from clojure. I have a persistent connection to a clojure repl and I'd like to develop without restarting my repl to incorporate a code change. If I launch the app, close the window by clicking the windows X button, and then eval `(example)` I don't get a working window. I get a window with a blank screen that just reports that it's "not responding". I also tried running the example in a thread but I get the same behavior: `(async/thread-call example)`
Thanks!

```clojure
(ns rgkirch.core
(:require [clojure.core.async :as async])
(:import [io.github.humbleui.jwm
App
Event
EventWindowCloseRequest
EventWindowScreenChange
EventWindowResize
EventFrame
LayerGL]
[java.util.function Consumer]))

(defn example
[]
(defonce init (App/init))
(def window (App/makeWindow))
(def layer (LayerGL.))
(defn paint []
(.makeCurrent layer)
(.swapBuffers layer))
(.attach layer window)
(.setTitle window "Hello World")
(.setEventListener window (reify Consumer
(accept [this e]
(do
(println e)
(cond
(instance? EventWindowCloseRequest e)
(do (.close window)
(App/terminate)) ;; terminate here? or this kills my jvm process?

(instance? EventWindowScreenChange e)
(do
(println "screen change")
(.reconfigure layer)
(let [rect (.getContentRect window)]
(.resize layer (.getWidth rect) (.getHeight rect)))
(paint))

(instance? EventWindowResize e)
(do
(println "resize")
(.resize layer (.getContentWidth e) (.getContentHeight e))
(paint))

(instance? EventFrame e)
(do
(paint)
(.requestFrame window)))))))
(.setVisible window true)
(.requestFrame window)
(defonce start (App/start))) ;; defonce here or no? same behavior either way...

(example)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.