extract texture-from-file into module
This commit is contained in:
parent
67e03c6736
commit
b43dc345d3
19
rc.fnl
19
rc.fnl
@ -1,6 +1,6 @@
|
|||||||
(local { : GdkPixbuf } (require :lgi))
|
|
||||||
(local { : view } (require :fennel))
|
(local { : view } (require :fennel))
|
||||||
|
|
||||||
|
(local texture (require :texture))
|
||||||
(local socket-repl (require :socket-repl))
|
(local socket-repl (require :socket-repl))
|
||||||
|
|
||||||
(let [repl-socket-name
|
(let [repl-socket-name
|
||||||
@ -13,25 +13,14 @@
|
|||||||
(socket-repl.start repl-socket-name))
|
(socket-repl.start repl-socket-name))
|
||||||
|
|
||||||
|
|
||||||
(fn texture-from-file [renderer filename]
|
|
||||||
(let [pixels
|
|
||||||
(let [(buf err) (GdkPixbuf.Pixbuf.new_from_file filename)]
|
|
||||||
(if (not buf) (print :err err))
|
|
||||||
buf)]
|
|
||||||
(renderer:texture_from_pixels
|
|
||||||
pixels.rowstride
|
|
||||||
pixels.width
|
|
||||||
pixels.height
|
|
||||||
(pixels:get_pixels))))
|
|
||||||
|
|
||||||
(kiwmi:on
|
(kiwmi:on
|
||||||
"output"
|
"output"
|
||||||
(fn [output]
|
(fn [output]
|
||||||
(output:set_mode 360 720 0)
|
(output:set_mode 360 720 0)
|
||||||
(let [r (output:renderer)
|
(let [r (output:renderer)
|
||||||
kill (texture-from-file r "close-window.png")
|
kill (texture.from-file r "close-window.png")
|
||||||
launch (texture-from-file r "launcher.png")
|
launch (texture.from-file r "launcher.png")
|
||||||
spinner (texture-from-file r "carousel.png")]
|
spinner (texture.from-file r "carousel.png")]
|
||||||
(output:on "render"
|
(output:on "render"
|
||||||
(fn [{: output : renderer}]
|
(fn [{: output : renderer}]
|
||||||
(let [bar-height 40
|
(let [bar-height 40
|
||||||
|
Loading…
Reference in New Issue
Block a user