Skip to content

Commit

Permalink
minor release removing splash screen for issue #105 - I suspect this …
Browse files Browse the repository at this point in the history
…will fix it...
  • Loading branch information
CmdrDats committed Nov 19, 2021
1 parent ee944dc commit 63df114
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 57 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject igoki "0.7"
(defproject igoki "0.7.1"
:description "Igoki, physical Go board/OGS interface"
:url "http://github.com/CmdrDats/igoki"
:license
Expand Down
58 changes: 2 additions & 56 deletions src/igoki/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,65 +9,13 @@
(:import
(org.slf4j.bridge SLF4JBridgeHandler)
(nu.pattern OpenCV)
(java.util.logging LogManager Level)
(javax.imageio ImageIO)
(java.awt Toolkit)))



(defn screen-size []
(let [ss (.getScreenSize (Toolkit/getDefaultToolkit))]
[(.width ss) (.height ss)]))


(defn image-size
"
See
http://stackoverflow.com/questions/4217896/how-can-i-determine-the\\
-dimensions-of-an-image-file-of-arbitrary-format-jpeg-p
"
[image-stream]
(let [image (ImageIO/read image-stream)]
[(.getWidth image) (.getHeight image)]))

(defn splash!
"
Use Seesaw to display an undecorated window based on graphic in
resources directory (splash screen).
"
[resource-file & {:keys [duration filename height width]
:or {duration 2500}}]
(let [[scrw scrh] (screen-size)
img_bg (s/icon resource-file)
[imgw imgh] (image-size resource-file)
xpos (/ (- scrw imgw) 2)
ypos (/ (- scrh imgh) 2)
fr (s/frame :size [imgw :by imgh]
:icon "igoki48.png"
:title "igoki"
:undecorated? true
:content (s/label :icon img_bg))]

(doto
(Thread.
(fn []
(s/move! fr :to [xpos ypos])
(s/show! fr)
(try
(Thread/sleep duration)
(finally
(s/hide! fr)))))
(.setDaemon true)
(.start))
#(when (s/visible? fr) (s/hide! fr))))

(java.util.logging LogManager Level)))

(OpenCV/loadShared)
(SLF4JBridgeHandler/install)
(.setLevel (.getLogger (LogManager/getLogManager) "") Level/INFO)



(defonce ctx (atom {}))
(defn start []
;; TODO: these are gross. refactor out these init steps.
Expand All @@ -78,6 +26,4 @@
(ui.main/main-frame ctx))

(defn -main [& args]
(let [hide-splash (splash! (io/resource "splash.png") :duration 30000)]
(start)
(hide-splash)))
(start))

0 comments on commit 63df114

Please sign in to comment.