diff --git a/carousel.png b/carousel.png new file mode 100644 index 0000000..cd74ac5 Binary files /dev/null and b/carousel.png differ diff --git a/close-window.png b/close-window.png new file mode 100644 index 0000000..3222031 Binary files /dev/null and b/close-window.png differ diff --git a/launcher.png b/launcher.png new file mode 100644 index 0000000..120e746 Binary files /dev/null and b/launcher.png differ diff --git a/rc.fnl b/rc.fnl index 4099104..aacbaf0 100644 --- a/rc.fnl +++ b/rc.fnl @@ -1,32 +1,52 @@ (local { : GdkPixbuf } (require :lgi)) (local { : view } (require :fennel)) -(var texture nil) -(local pixels - (let [(buf err) (GdkPixbuf.Pixbuf.new_from_file "globe.png")] - (if (not buf) (print :err err)) - buf)) + + +(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 "output" (fn [output] (output:set_mode 360 720 0) - (let [r (output:renderer)] - (set texture (r:texture_from_pixels - pixels.rowstride - pixels.width - pixels.height - (pixels:get_pixels))) + (let [r (output:renderer) + kill (texture-from-file r "close-window.png") + launch (texture-from-file r "launcher.png") + spinner (texture-from-file r "carousel.png")] (output:on "render" (fn [{: output : renderer}] - (renderer:draw_texture - texture - [1 0 0 - 0 1 0 - 0 0 1] - 150 150 0.7))) - (print :texture texture)))) + (let [bar-height 40 + matrix [1 0 0 + 0 1 0 + 0 0 1]] + (renderer:draw_rect :#00000077 + 0 (- 720 bar-height) + 690 360 bar-height) + (renderer:draw_texture + kill + matrix + 30 (- 720 bar-height) + 0.7) + (renderer:draw_texture + launch matrix + (- 180 (/ bar-height 2)) (- 720 bar-height) + 0.7) + (renderer:draw_texture + spinner + matrix + (- 360 30 bar-height) (- 720 bar-height) + 0.7))))))) + (kiwmi:on "view" (fn [view]